@@ -3,6 +3,47 @@ import 'package:getflutter/types/gf_progress_type.dart';
33import 'package:vector_math/vector_math_64.dart' as math;
44
55class GFProgressBar extends StatefulWidget {
6+
7+ GFProgressBar ({
8+ Key key,
9+ this .percentage = 0.2 ,
10+ this .circleWidth = 5.0 ,
11+ this .circleStartAngle = 0.0 ,
12+ @required this .radius,
13+ this .backgroundColor = const Color (0xFFB8C7CB ),
14+ Color progressBarColor,
15+ this .linearGradient,
16+ this .animation = false ,
17+ this .animationDuration = 500 ,
18+ this .child,
19+ this .autoAlive = true ,
20+ this .animateFromLastPercentage = false ,
21+ this .reverse = false ,
22+ this .mask,
23+ this .type,
24+ this .progressHeadType,
25+ this .lineHeight = 5.0 ,
26+ this .width,
27+ this .fromRightToLeft = false ,
28+ this .leading,
29+ this .trailing,
30+ this .padding = const EdgeInsets .symmetric (horizontal: 10 ),
31+ this .alignment = MainAxisAlignment .start,
32+ this .clipLinearGradient = false ,
33+ }) : super (key: key) {
34+ if (linearGradient != null && progressBarColor != null ) {
35+ throw ArgumentError (
36+ 'Cannot provide both linearGradient and progressBarColor' );
37+ }
38+ _progressBarColor = progressBarColor ?? Colors .red;
39+
40+ assert (circleStartAngle >= 0.0 );
41+ if (percentage < 0.0 || percentage > 1.0 ) {
42+ throw Exception ('Percent value must be a double between 0.0 and 1.0' );
43+ }
44+ }
45+
46+
647 ///width of the Circular Progress bar
748 final double width;
849
@@ -80,44 +121,7 @@ class GFProgressBar extends StatefulWidget {
80121 ///type of double which should be from 0 to 1 to indicate the progress of the ProgressBars
81122 final double percentage;
82123
83- GFProgressBar ({
84- Key key,
85- this .percentage = 0.2 ,
86- this .circleWidth = 5.0 ,
87- this .circleStartAngle = 0.0 ,
88- @required this .radius,
89- this .backgroundColor = const Color (0xFFB8C7CB ),
90- Color progressBarColor,
91- this .linearGradient,
92- this .animation = false ,
93- this .animationDuration = 500 ,
94- this .child,
95- this .autoAlive = true ,
96- this .animateFromLastPercentage = false ,
97- this .reverse = false ,
98- this .mask,
99- this .type,
100- this .progressHeadType,
101- this .lineHeight = 5.0 ,
102- this .width,
103- this .fromRightToLeft = false ,
104- this .leading,
105- this .trailing,
106- this .padding = const EdgeInsets .symmetric (horizontal: 10 ),
107- this .alignment = MainAxisAlignment .start,
108- this .clipLinearGradient = false ,
109- }) : super (key: key) {
110- if (linearGradient != null && progressBarColor != null ) {
111- throw ArgumentError (
112- 'Cannot provide both linearGradient and progressBarColor' );
113- }
114- _progressBarColor = progressBarColor ?? Colors .red;
115124
116- assert (circleStartAngle >= 0.0 );
117- if (percentage < 0.0 || percentage > 1.0 ) {
118- throw Exception ('Percent value must be a double between 0.0 and 1.0' );
119- }
120- }
121125
122126 @override
123127 _GFProgressBarState createState () => _GFProgressBarState ();
@@ -133,7 +137,7 @@ class _GFProgressBarState extends State<GFProgressBar>
133137 @override
134138 void initState () {
135139 if (widget.animation) {
136- _animationController = new AnimationController (
140+ _animationController = AnimationController (
137141 vsync: this ,
138142 duration: Duration (milliseconds: widget.animationDuration));
139143 _animation = Tween (begin: 0.0 , end: widget.percentage)
@@ -149,7 +153,7 @@ class _GFProgressBarState extends State<GFProgressBar>
149153 }
150154
151155 if (widget.animation) {
152- circular_animation_controller = new AnimationController (
156+ circular_animation_controller = AnimationController (
153157 vsync: this ,
154158 duration: Duration (milliseconds: widget.animationDuration));
155159 circular_animation = Tween (begin: 0.0 , end: widget.percentage)
@@ -165,13 +169,13 @@ class _GFProgressBarState extends State<GFProgressBar>
165169 }
166170 }
167171
168- _updateProgress () {
172+ void _updateProgress () {
169173 setState (() {
170174 _percentage = widget.percentage;
171175 });
172176 }
173177
174- _updateprogressPercent () {
178+ void _updateprogressPercent () {
175179 setState (() {
176180 _progressPercent = widget.percentage;
177181 });
@@ -227,7 +231,7 @@ class _GFProgressBarState extends State<GFProgressBar>
227231 @override
228232 Widget build (BuildContext context) {
229233 super .build (context);
230- var item = List <Widget >();
234+ final item = List <Widget >();
231235 if (widget.leading != null ) {
232236 item.add (widget.leading);
233237 }
@@ -283,7 +287,7 @@ class _GFProgressBarState extends State<GFProgressBar>
283287 return widget.type == GFProgressType .linear
284288 ? Material (
285289 color: Colors .transparent,
286- child: new Container (
290+ child: Container (
287291 child: Row (
288292 mainAxisAlignment: widget.alignment,
289293 crossAxisAlignment: CrossAxisAlignment .center,
0 commit comments