Skip to content

Commit c87a5aa

Browse files
author
Goodbird
committed
Fixed "percentage" parameter not working for circle progress bars, fixed height of the circle progress bars, applient minor tweaks to the way dragging works for circle progress bars
1 parent 43eca6c commit c87a5aa

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

lib/components/progress_bar/gf_progress_bar.dart

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,7 @@ class _GFProgressBarState extends State<GFProgressBar>
183183
void _updateProgress() {
184184
setState(() {
185185
_percentage = widget.percentage;
186+
_progress = _percentage;
186187
});
187188
}
188189

@@ -255,8 +256,8 @@ class _GFProgressBarState extends State<GFProgressBar>
255256
}
256257

257258
void _onDragUpdateCircular(Offset position, Size size) {
258-
final dx = position.dx - size.width / 2;
259-
final dy = position.dy - size.height / 2;
259+
final dx = position.dx;
260+
final dy = position.dy + widget.radius! / 2;
260261
final angle = atan2(dy, dx);
261262
final progress = angle / (2 * pi) + 0.5;
262263

@@ -278,7 +279,9 @@ class _GFProgressBarState extends State<GFProgressBar>
278279
final containerWidget = Container(
279280
margin: widget.margin,
280281
width: hasSetWidth ? widget.width : MediaQuery.of(context).size.width,
281-
height: widget.lineHeight,
282+
height: widget.type == GFProgressType.linear
283+
? widget.lineHeight
284+
: widget.radius!,
282285
padding: widget.padding,
283286
child: widget.type == GFProgressType.linear
284287
? GestureDetector(

0 commit comments

Comments
 (0)