@@ -2,8 +2,6 @@ import 'package:flutter/material.dart';
22import 'package:getflutter/types/gf_progress_type.dart' ;
33import 'package:vector_math/vector_math_64.dart' as math;
44
5- enum LinearStrokeCap { butt, round, roundAll }
6-
75class GFProgressBar extends StatefulWidget {
86 ///width of the Circular Progress bar
97 final double width;
@@ -28,7 +26,6 @@ class GFProgressBar extends StatefulWidget {
2826 ///type of Widget which can be used in the first place before the progress bar
2927 final Widget leading;
3028
31-
3229 ///type of Widget which can be used in the last place after the progress bar
3330 final Widget trailing;
3431
@@ -83,14 +80,8 @@ class GFProgressBar extends StatefulWidget {
8380 ///type of double which should be from 0 to 1 to indicate the progress of the ProgressBars
8481 final double percentage;
8582
86- final LinearStrokeCap linearStrokeCap;
87-
88-
89-
90-
9183 GFProgressBar ({
9284 Key key,
93- this .linearStrokeCap,
9485 this .percentage = 0.2 ,
9586 this .circleWidth = 5.0 ,
9687 this .circleStartAngle = 0.0 ,
@@ -112,7 +103,7 @@ class GFProgressBar extends StatefulWidget {
112103 this .fromRightToLeft = false ,
113104 this .leading,
114105 this .trailing,
115- this .padding = const EdgeInsets .symmetric (horizontal: 10.0 ),
106+ this .padding = const EdgeInsets .symmetric (horizontal: 10 ),
116107 this .alignment = MainAxisAlignment .start,
117108 this .clipLinearGradient = false ,
118109 }) : super (key: key) {
@@ -124,7 +115,7 @@ class GFProgressBar extends StatefulWidget {
124115
125116 assert (circleStartAngle >= 0.0 );
126117 if (percentage < 0.0 || percentage > 1.0 ) {
127- throw Exception (" Percent value must be a double between 0.0 and 1.0" );
118+ throw Exception (' Percent value must be a double between 0.0 and 1.0' );
128119 }
129120 }
130121
@@ -256,7 +247,6 @@ class _GFProgressBarState extends State<GFProgressBar>
256247 linearGradient: widget.linearGradient,
257248 backgroundColor: widget.backgroundColor,
258249 circleWidth: widget.lineHeight,
259- linearStrokeCap: widget.linearStrokeCap,
260250 mask: widget.mask,
261251 clipLinearGradient: widget.clipLinearGradient,
262252 ),
@@ -301,11 +291,10 @@ class _GFProgressBarState extends State<GFProgressBar>
301291 )),
302292 )
303293 : Material (
304-
305294 child: Container (
306295 child: Column (
307- mainAxisAlignment : MainAxisAlignment .center,
308- mainAxisSize : MainAxisSize .min ,
296+ crossAxisAlignment : CrossAxisAlignment .center,
297+ mainAxisAlignment : MainAxisAlignment .spaceBetween ,
309298 children: item,
310299 )),
311300 );
@@ -327,12 +316,10 @@ class LinearPainter extends CustomPainter {
327316 final LinearGradient linearGradient;
328317 final MaskFilter mask;
329318 final bool clipLinearGradient;
330- GFProgressHeadType progressHeadType = GFProgressHeadType .circular;
331- final LinearStrokeCap linearStrokeCap;
319+ GFProgressHeadType progressHeadType;
332320
333321 LinearPainter ({
334322 this .circleWidth,
335- this .linearStrokeCap = LinearStrokeCap .butt,
336323 this .progress,
337324 this .child,
338325 this .fromRightToLeft,
@@ -353,32 +340,12 @@ class LinearPainter extends CustomPainter {
353340 _paintLine.style = PaintingStyle .stroke;
354341 _paintLine.strokeWidth = circleWidth;
355342
356- // if (progressHeadType == GFProgressHeadType.circular) {
357- // _paintLine.strokeCap = StrokeCap.round;
358- // } else if (progressHeadType == GFProgressHeadType.square) {
359- // _paintLine.strokeCap = StrokeCap.square;
360- // }
361-
362-
363- if (linearStrokeCap == LinearStrokeCap .round) {
364- _paintLine.strokeCap = StrokeCap .round;
365- } else if (linearStrokeCap == LinearStrokeCap .butt) {
366- _paintLine.strokeCap = StrokeCap .butt;
367- } else {
368- _paintLine.strokeCap = StrokeCap .round;
369- _paintBackground.strokeCap = StrokeCap .round;
370- }
371-
372-
373- if (progressHeadType == GFProgressHeadType .circular) {
374- _paintLine.strokeCap = StrokeCap .round;
375- } else if (progressHeadType == GFProgressHeadType .square) {
343+ if (progressHeadType == GFProgressHeadType .square) {
376344 _paintLine.strokeCap = StrokeCap .square;
377345 } else {
378346 _paintLine.strokeCap = StrokeCap .round;
379347 _paintBackground.strokeCap = StrokeCap .round;
380348 }
381-
382349 }
383350
384351 @override
@@ -438,7 +405,6 @@ class LinearPainter extends CustomPainter {
438405class CirclePainter extends CustomPainter {
439406 final Paint _paintBackground = Paint ();
440407 final Paint _paintLine = Paint ();
441- final Paint _paintBackgroundStartAngle = Paint ();
442408 final double circleWidth;
443409 final double progress;
444410 final double radius;
@@ -475,8 +441,6 @@ class CirclePainter extends CustomPainter {
475441 } else if (progressHeadType == GFProgressHeadType .square) {
476442 _paintLine.strokeCap = StrokeCap .square;
477443 }
478-
479-
480444 }
481445
482446 @override
@@ -500,16 +464,6 @@ class CirclePainter extends CustomPainter {
500464
501465 double circleStartAngleFixedMargin = 1.0 ;
502466
503- // if (arcBackgroundColor != null) {
504- // canvas.drawArc(
505- // Rect.fromCircle(center: child, radius: radius),
506- // math.radians(-90.0 + fixedStartAngle),
507- // math.radians(360 * circleStartAngleFixedMargin),
508- // false,
509- // _paintBackgroundStartAngle,
510- // );
511- // }
512-
513467 if (reverse) {
514468 final start = math
515469 .radians (360 * circleStartAngleFixedMargin - 90.0 + fixedStartAngle);
0 commit comments