Skip to content

Commit c8571d1

Browse files
style: format all files
1 parent 73dbd66 commit c8571d1

6 files changed

+88
-105
lines changed

lib/main.dart

+2-4
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ class MyHomePage extends StatefulWidget {
3131
State<MyHomePage> createState() => _MyHomePageState();
3232
}
3333

34-
class _MyHomePageState extends State<MyHomePage> with SingleTickerProviderStateMixin{
35-
34+
class _MyHomePageState extends State<MyHomePage>
35+
with SingleTickerProviderStateMixin {
3636
late final ProgressController _controller;
3737

3838
@override
@@ -110,7 +110,6 @@ class _MyHomePageState extends State<MyHomePage> with SingleTickerProviderStateM
110110
}
111111
}
112112

113-
114113
class Button extends StatelessWidget {
115114
const Button({
116115
super.key,
@@ -135,4 +134,3 @@ class Button extends StatelessWidget {
135134
);
136135
}
137136
}
138-

lib/multi_slice_progress_indicator.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@ import 'package:flutter/rendering.dart';
99
part './src/constants.dart';
1010
part 'src/animation.dart';
1111
part 'src/rendering.dart';
12-
part './src/widget.dart';
12+
part './src/widget.dart';

lib/src/animation.dart

+36-39
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,15 @@
11
part of multi_slice_progress_indicator;
22

3-
abstract class ProgressAnimation extends ProxyAnimation{
4-
3+
abstract class ProgressAnimation extends ProxyAnimation {
54
ProgressAnimation([super.animation]);
65

76
double of(int sliceIndex);
87
double ofInnerSlice();
98
double ofMiddleSlice();
109
double ofOutterSlice();
11-
1210
}
1311

14-
class CurvedProgressAnimation extends ProgressAnimation{
15-
12+
class CurvedProgressAnimation extends ProgressAnimation {
1613
CurvedProgressAnimation({
1714
Animation<double> parent = kAlwaysDismissedAnimation,
1815
Curve innerSliceCurve = _defaultInnerSliceAnimationCurve,
@@ -27,7 +24,7 @@ class CurvedProgressAnimation extends ProgressAnimation{
2724
final Curve _innerSliceCurve;
2825
final Curve _middleSliceCurve;
2926
final Curve _outterSliceCurve;
30-
27+
3128
@override
3229
double of(int sliceIndex) => _values[sliceIndex];
3330

@@ -47,7 +44,7 @@ class CurvedProgressAnimation extends ProgressAnimation{
4744
}
4845

4946
void _updateValues() {
50-
if (_isReversing)
47+
if (_isReversing)
5148
_updateValuesWithFlippedCurves();
5249
else
5350
_updateValuesWithCurves();
@@ -72,23 +69,22 @@ class CurvedProgressAnimation extends ProgressAnimation{
7269
}
7370
}
7471

75-
7672
class ProgressController {
77-
7873
ProgressController({
7974
required TickerProvider vsync,
8075
Duration forewardAnimationDuration = _defaultForewardAnimationDuration,
8176
Duration reverseAnimationDuration = _defaultReverseAnimationDuration,
8277
Duration completeAnimationDuration = _defaultCompleteAnimationDuration,
83-
}) : _animationController = AnimationController(vsync: vsync,),
78+
}) : _animationController = AnimationController(
79+
vsync: vsync,
80+
),
8481
_forewardAnimationDuration = forewardAnimationDuration,
8582
_reverseAnimationDuration = reverseAnimationDuration,
8683
_completeAnimationDuration = completeAnimationDuration,
8784
_startAngleProxyAnimation = CurvedProgressAnimation(),
8885
_successColorsOpacityProxyAnimation = CurvedProgressAnimation(),
8986
_failureColorsOpacityProxyAnimation = CurvedProgressAnimation();
9087

91-
9288
final AnimationController _animationController;
9389
final Duration _forewardAnimationDuration;
9490
final Duration _reverseAnimationDuration;
@@ -99,15 +95,16 @@ class ProgressController {
9995
ProgressAnimation get startAngle => _startAngleProxyAnimation;
10096
final ProgressAnimation _startAngleProxyAnimation;
10197

102-
ProgressAnimation get successColorsOpacity => _successColorsOpacityProxyAnimation;
98+
ProgressAnimation get successColorsOpacity =>
99+
_successColorsOpacityProxyAnimation;
103100
final ProgressAnimation _successColorsOpacityProxyAnimation;
104101

105-
ProgressAnimation get failureColorsOpacity => _failureColorsOpacityProxyAnimation;
102+
ProgressAnimation get failureColorsOpacity =>
103+
_failureColorsOpacityProxyAnimation;
106104
final ProgressAnimation _failureColorsOpacityProxyAnimation;
107-
108105

109-
Future<void> start() async{
110-
if(!_canStart())
106+
Future<void> start() async {
107+
if (!_canStart())
111108
return;
112109

113110
_prepareToStart();
@@ -120,7 +117,7 @@ class ProgressController {
120117
void _prepareToStart() {
121118
_runCompeleter = Completer();
122119
_updateAnimationDuration(_forewardAnimationDuration);
123-
120+
124121
_startAngleProxyAnimation.parent = _animationController;
125122
_successColorsOpacityProxyAnimation.parent = kAlwaysDismissedAnimation;
126123
_failureColorsOpacityProxyAnimation.parent = kAlwaysDismissedAnimation;
@@ -136,9 +133,9 @@ class ProgressController {
136133
_stopCompleter?.complete();
137134
_startAngleProxyAnimation.parent = kAlwaysCompleteAnimation;
138135
}
139-
140-
Future<void> completeWithSuccess() async{
141-
if(!_canStop())
136+
137+
Future<void> completeWithSuccess() async {
138+
if (!_canStop())
142139
return;
143140

144141
await stop();
@@ -156,13 +153,13 @@ class ProgressController {
156153
_successColorsOpacityProxyAnimation.parent = kAlwaysCompleteAnimation;
157154
}
158155

159-
Future<void> completeWithFailure() async{
160-
if(!_canStop())
156+
Future<void> completeWithFailure() async {
157+
if (!_canStop())
161158
return;
162159

163160
await stop();
164161
_prepareToCompleteWithFailure();
165-
await _forewardAnimation();
162+
await _forewardAnimation();
166163
_doAfterCompleteWithFailure();
167164
}
168165

@@ -180,23 +177,23 @@ class ProgressController {
180177
return _animationController.forward();
181178
}
182179

183-
Future<void> stop() async{
184-
if(!_canStop())
180+
Future<void> stop() async {
181+
if (!_canStop())
185182
return;
186183

187184
_runCompeleter!.complete();
188185
_stopCompleter = Completer();
189-
186+
190187
return _stopCompleter!.future;
191188
}
192189

193190
bool _canStop() => !(_runCompeleter?.isCompleted ?? true);
194-
195-
Future<void> reverse() async{
196-
if(!_canReverse())
191+
192+
Future<void> reverse() async {
193+
if (!_canReverse())
197194
return;
198195

199-
_prepareToReverse();
196+
_prepareToReverse();
200197
await _reversAnimation();
201198
_refresh();
202199
}
@@ -209,12 +206,12 @@ class ProgressController {
209206
_updateAnimationDuration(_reverseAnimationDuration);
210207

211208
_startAngleProxyAnimation.parent = _animationController;
212-
213-
if(_successColorsOpacityProxyAnimation.parent == kAlwaysCompleteAnimation)
209+
210+
if (_successColorsOpacityProxyAnimation.parent == kAlwaysCompleteAnimation)
214211
_successColorsOpacityProxyAnimation.parent = _animationController;
215-
216-
if(_failureColorsOpacityProxyAnimation.parent == kAlwaysCompleteAnimation)
217-
_failureColorsOpacityProxyAnimation.parent = _animationController;
212+
213+
if (_failureColorsOpacityProxyAnimation.parent == kAlwaysCompleteAnimation)
214+
_failureColorsOpacityProxyAnimation.parent = _animationController;
218215
}
219216

220217
Future<void> _reversAnimation() async {
@@ -226,16 +223,16 @@ class ProgressController {
226223
_startAngleProxyAnimation.parent = kAlwaysDismissedAnimation;
227224
_successColorsOpacityProxyAnimation.parent = kAlwaysDismissedAnimation;
228225
_failureColorsOpacityProxyAnimation.parent = kAlwaysDismissedAnimation;
229-
226+
230227
_runCompeleter = null;
231228
_stopCompleter = null;
232229
}
233230

234-
void _updateAnimationDuration(Duration newDuration){
231+
void _updateAnimationDuration(Duration newDuration) {
235232
_animationController.duration = newDuration;
236233
}
237-
234+
238235
void dispose() {
239236
_animationController.dispose();
240237
}
241-
}
238+
}

lib/src/constants.dart

+1-3
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ const _defaultColors = <Color>[
2323
];
2424

2525
const _defaultSuccessColors = <Color>[
26-
// Colors.lightGreen,
26+
// Colors.lightGreen,
2727
Color(0xFF00838F), //800
2828
Color(0xFF0097A7), //700
2929
Color(0xFF00BCD4), //500
@@ -44,5 +44,3 @@ const _defaultFailureColors = <Color>[
4444
];
4545

4646
const _defaultColorStops = <double>[0.25, 0.35, 0.5, 0.65, 0.8, 0.9, 0.97];
47-
48-

0 commit comments

Comments
 (0)