1- //import 'package:flutter/material.dart';
2- //import 'package:getflutter/getflutter.dart';
3- //
4- //class GFProgressBar extends StatefulWidget {
5- // @override
6- // _GFProgressBarState createState() => _GFProgressBarState();
7- //}
8- //
9- //class _GFProgressBarState extends State<GFProgressBar> {
10- // @override
11- // Widget build(BuildContext context) {
12- // return Container();
13- // }
14- //}
15-
161
172import 'package:flutter/material.dart' ;
183import 'package:getflutter/types/gf_progress_type.dart' ;
194import 'package:vector_math/vector_math_64.dart' as math;
205
21- enum LinearStrokeCap { butt, round, roundAll , circular}
6+ enum LinearBarType { butt, round, roundAll , circular}
227
23- enum CircularStrokeCap { butt, round, square }
8+ enum CircularBarType { butt, round, square }
249
2510enum ArcType {
2611 HALF ,
@@ -29,48 +14,50 @@ enum ArcType {
2914
3015class GFProgressBar extends StatefulWidget {
3116
32- ///width of the
17+ ///width of the Circular Progress bar
3318 final double width;
3419
35- ///Height of the line
20+ ///Height of the Linear Progress Bar
3621 final double lineHeight;
3722
3823
39- ///First color applied to the complete line
40- final Color backgroundColor;
24+ ///type of dynamic , backgroundColor used to change the backgroundColor of the progress bar
25+ final dynamic backgroundColor;
26+
4127
4228 Color get progressBarColor => _progressBarColor;
4329
44- Color _progressBarColor;
30+ ///type of Color , used to change the color of the active progress line
31+ dynamic _progressBarColor;
4532
46- ///true if you want the Line to have animation
33+ ///type of bool which allows the progress line to animate when the percentage values are changed
4734 final bool animation;
4835
4936 ///duration of the animation in milliseconds, It only applies if animation attribute is true
5037 final int animationDuration;
5138
52- ///widget at the left of the Line
39+ ///type of Widget which can be used in the first place before the progress bar
5340 final Widget leading;
5441
55-
42+ /// type of [Color] or [GFColor] used to fill the arc background of the circular bar
5643 final dynamic fillColor;
5744
58- ///widget at the right of the Line
45+ ///type of Widget which can be used in the last place after the progress bar
5946 final Widget trailing;
6047
61- ///widget inside the Line
48+ ///type of Widget which is used to identity the percentage of progress complete
6249 final Widget child;
6350
64- ///The kind of finish to place on the end of lines drawn, values supported: butt, round, roundAll
65- final LinearStrokeCap linearBarType;
51+ ///the types of linear progress bar which will be reflected on the edges and of types, butt, round, roundAll
52+ final LinearBarType linearBarType;
6653
67- ///alignment of the Row ( leading-widget-child- trailing)
54+ ///type of MainAxisAlignment used to align the leading, trailing and the progress bar in a fashion
6855 final MainAxisAlignment alignment;
6956
70- ///padding to the GFProgressBar
57+ ///type of EdgeInsets which gives padding to the GFProgressBar
7158 final EdgeInsets padding;
7259
73- /// set true if you want to animate the linear from the last progressPercent value you set
60+ /// set true if you want to animate the linear from the last progressPercentage value you set
7461 final bool animateFromLastPercentage;
7562
7663 /// If present, this will make the progress bar colored by this gradient.
@@ -79,40 +66,44 @@ class GFProgressBar extends StatefulWidget {
7966 final LinearGradient linearGradient;
8067
8168 /// set false if you don't want to preserve the state of the widget
82- final bool addAutomaticKeepAlive ;
69+ final bool autoAlive ;
8370
84- /// set true if you want to animate the linear from the right to left (RTL)
71+ /// set true if you want to animate the linear bar from the right to left
8572 final bool fromRightToLeft;
8673
8774 /// Creates a mask filter that takes the progress shape being drawn and blurs it.
8875 final MaskFilter mask;
8976
9077 /// Set true if you want to display only part of [linearGradient] based on progressPercent value
91- /// (ie. create 'VU effect'). If no [linearGradient] is specified this option is ignored.
78+ /// If no [linearGradient] is specified this option is ignored.
9279 final bool clipLinearGradient;
9380
81+
82+ ///type of [GFProgressType] which changes the shape of progress bar based on the type ie, circle and linear
9483 final GFProgressType type ;
9584
96- ///Width of the line of the Circle
85+ ///type of double which defines the width of the Circle in CircularProgressBar
9786 final double circleWidth;
9887
99- ///The kind of finish to place on the end of lines drawn, values supported: butt, round, square
100- final CircularStrokeCap circularBarType;
88+ ///the types of Circular progress bar which will be reflected on the arcs and of types, butt, round, roundAll
89+ final CircularBarType circularBarType;
10190
102- ///the angle which the circle will start the progress (in degrees, eg: 0.0, 45.0, 90.0)
91+ ///type of double in which the angle on the circle starts to progress (in degrees, eg: 0.0, 45.0, 90.0)
10392 final double circleStartAngle;
10493
105-
106- /// set the arc type
94+ ///type of ArcType which defines different types arcs in Circular Progress Bar ie, round and square
10795 final ArcType arcType;
10896
109- /// set a circular background color when use the arcType property
110- final Color arcBackgroundColor;
97+ ///type of [Color] or [GFColor] used to set background color of the arc in CircularProgress Bar
98+ final dynamic arcBackgroundColor;
11199
112- /// set true when you want to display the progress in reverse mode
100+ ///type of bool used to display the progress in reverse mode
113101 final bool reverse;
102+
103+ ///type of double used to show the radius of Circular Progress Bar
114104 final double radius;
115105
106+ ///type of double which should be from 0 to 1 to indicate the progress of the ProgressBars
116107 final double percentage;
117108
118109
@@ -129,7 +120,7 @@ class GFProgressBar extends StatefulWidget {
129120 this .animation = false ,
130121 this .animationDuration = 500 ,
131122 this .child,
132- this .addAutomaticKeepAlive = true ,
123+ this .autoAlive = true ,
133124 this .circularBarType,
134125 this .arcBackgroundColor,
135126 this .arcType,
@@ -147,10 +138,6 @@ class GFProgressBar extends StatefulWidget {
147138 this .alignment = MainAxisAlignment .start,
148139 this .clipLinearGradient = false ,
149140 this .fillColor,
150-
151-
152-
153-
154141 }) : super (key: key) {
155142 if (linearGradient != null && progressBarColor != null ) {
156143 throw ArgumentError (
@@ -366,7 +353,7 @@ _updateProgress() {
366353 }
367354
368355 @override
369- bool get wantKeepAlive => widget.addAutomaticKeepAlive ;
356+ bool get wantKeepAlive => widget.autoAlive ;
370357}
371358
372359class LinearPainter extends CustomPainter {
@@ -378,7 +365,7 @@ class LinearPainter extends CustomPainter {
378365 final fromRightToLeft;
379366 final Color progressBarColor;
380367 final Color backgroundColor;
381- final LinearStrokeCap linearBarType;
368+ final LinearBarType linearBarType;
382369 final LinearGradient linearGradient;
383370 final MaskFilter mask;
384371 final bool clipLinearGradient;
@@ -390,7 +377,7 @@ class LinearPainter extends CustomPainter {
390377 this .fromRightToLeft,
391378 this .progressBarColor,
392379 this .backgroundColor,
393- this .linearBarType = LinearStrokeCap .butt,
380+ this .linearBarType = LinearBarType .butt,
394381 this .linearGradient,
395382 this .mask,
396383 this .clipLinearGradient,
@@ -405,9 +392,9 @@ class LinearPainter extends CustomPainter {
405392 _paintLine.style = PaintingStyle .stroke;
406393 _paintLine.strokeWidth = circleWidth;
407394
408- if (linearBarType == LinearStrokeCap .round) {
395+ if (linearBarType == LinearBarType .round) {
409396 _paintLine.strokeCap = StrokeCap .round;
410- } else if (linearBarType == LinearStrokeCap .butt) {
397+ } else if (linearBarType == LinearBarType .butt) {
411398 _paintLine.strokeCap = StrokeCap .butt;
412399 } else {
413400 _paintLine.strokeCap = StrokeCap .round;
@@ -480,7 +467,7 @@ class CirclePainter extends CustomPainter {
480467 final double radius;
481468 final Color progressBarColor;
482469 final Color backgroundColor;
483- final CircularStrokeCap circularBarType;
470+ final CircularBarType circularBarType;
484471 final double circleStartAngle;
485472 final LinearGradient linearGradient;
486473 final Color arcBackgroundColor;
@@ -495,7 +482,7 @@ class CirclePainter extends CustomPainter {
495482 this .progressBarColor,
496483 this .backgroundColor,
497484 this .circleStartAngle = 0.0 ,
498- this .circularBarType = CircularStrokeCap .round,
485+ this .circularBarType = CircularBarType .round,
499486 this .linearGradient,
500487 this .reverse,
501488 this .arcBackgroundColor,
@@ -514,9 +501,9 @@ class CirclePainter extends CustomPainter {
514501 _paintLine.color = progressBarColor;
515502 _paintLine.style = PaintingStyle .stroke;
516503 _paintLine.strokeWidth = circleWidth;
517- if (circularBarType == CircularStrokeCap .round) {
504+ if (circularBarType == CircularBarType .round) {
518505 _paintLine.strokeCap = StrokeCap .round;
519- } else if (circularBarType == CircularStrokeCap .butt) {
506+ } else if (circularBarType == CircularBarType .butt) {
520507 _paintLine.strokeCap = StrokeCap .butt;
521508 } else {
522509 _paintLine.strokeCap = StrokeCap .square;
0 commit comments