Skip to content

Commit 895e5ae

Browse files
committed
🎨 Flutter format.
1 parent 3ba2382 commit 895e5ae

File tree

6 files changed

+96
-82
lines changed

6 files changed

+96
-82
lines changed

lib/src/constants/constants.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@
44
///
55
export 'package:flutter_common_exports/flutter_common_exports.dart';
66

7-
export 'colors.dart';
7+
export 'colors.dart';

lib/src/widget/builder/slide_page_transition_builder.dart

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -37,20 +37,20 @@ class SlidePageTransitionBuilder<T> extends PageRoute<T> {
3737

3838
@override
3939
Widget buildPage(
40-
BuildContext context,
41-
Animation<double> animation,
42-
Animation<double> secondaryAnimation,
43-
) {
40+
BuildContext context,
41+
Animation<double> animation,
42+
Animation<double> secondaryAnimation,
43+
) {
4444
return builder;
4545
}
4646

4747
@override
4848
Widget buildTransitions(
49-
BuildContext context,
50-
Animation<double> animation,
51-
Animation<double> secondaryAnimation,
52-
Widget child,
53-
) {
49+
BuildContext context,
50+
Animation<double> animation,
51+
Animation<double> secondaryAnimation,
52+
Widget child,
53+
) {
5454
return SlideTransition(
5555
position: Tween<Offset>(
5656
begin: const Offset(0, 1),

lib/src/widget/camera_picker.dart

Lines changed: 52 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -67,44 +67,44 @@ class CameraPicker extends StatefulWidget {
6767
/// Build a dark theme according to the theme color.
6868
/// 通过主题色构建一个默认的暗黑主题
6969
static ThemeData themeData(Color themeColor) => ThemeData.dark().copyWith(
70-
buttonColor: themeColor,
71-
brightness: Brightness.dark,
72-
primaryColor: Colors.grey[900],
73-
primaryColorBrightness: Brightness.dark,
74-
primaryColorLight: Colors.grey[900],
75-
primaryColorDark: Colors.grey[900],
76-
accentColor: themeColor,
77-
accentColorBrightness: Brightness.dark,
78-
canvasColor: Colors.grey[850],
79-
scaffoldBackgroundColor: Colors.grey[900],
80-
bottomAppBarColor: Colors.grey[900],
81-
cardColor: Colors.grey[900],
82-
highlightColor: Colors.transparent,
83-
toggleableActiveColor: themeColor,
84-
cursorColor: themeColor,
85-
textSelectionColor: themeColor.withAlpha(100),
86-
textSelectionHandleColor: themeColor,
87-
indicatorColor: themeColor,
88-
appBarTheme: const AppBarTheme(
89-
brightness: Brightness.dark,
90-
elevation: 0,
91-
),
92-
colorScheme: ColorScheme(
93-
primary: Colors.grey[900],
94-
primaryVariant: Colors.grey[900],
95-
secondary: themeColor,
96-
secondaryVariant: themeColor,
97-
background: Colors.grey[900],
98-
surface: Colors.grey[900],
99-
brightness: Brightness.dark,
100-
error: const Color(0xffcf6679),
101-
onPrimary: Colors.black,
102-
onSecondary: Colors.black,
103-
onSurface: Colors.white,
104-
onBackground: Colors.white,
105-
onError: Colors.black,
106-
),
107-
);
70+
buttonColor: themeColor,
71+
brightness: Brightness.dark,
72+
primaryColor: Colors.grey[900],
73+
primaryColorBrightness: Brightness.dark,
74+
primaryColorLight: Colors.grey[900],
75+
primaryColorDark: Colors.grey[900],
76+
accentColor: themeColor,
77+
accentColorBrightness: Brightness.dark,
78+
canvasColor: Colors.grey[850],
79+
scaffoldBackgroundColor: Colors.grey[900],
80+
bottomAppBarColor: Colors.grey[900],
81+
cardColor: Colors.grey[900],
82+
highlightColor: Colors.transparent,
83+
toggleableActiveColor: themeColor,
84+
cursorColor: themeColor,
85+
textSelectionColor: themeColor.withAlpha(100),
86+
textSelectionHandleColor: themeColor,
87+
indicatorColor: themeColor,
88+
appBarTheme: const AppBarTheme(
89+
brightness: Brightness.dark,
90+
elevation: 0,
91+
),
92+
colorScheme: ColorScheme(
93+
primary: Colors.grey[900],
94+
primaryVariant: Colors.grey[900],
95+
secondary: themeColor,
96+
secondaryVariant: themeColor,
97+
background: Colors.grey[900],
98+
surface: Colors.grey[900],
99+
brightness: Brightness.dark,
100+
error: const Color(0xffcf6679),
101+
onPrimary: Colors.black,
102+
onSecondary: Colors.black,
103+
onSurface: Colors.white,
104+
onBackground: Colors.white,
105+
onError: Colors.black,
106+
),
107+
);
108108

109109
@override
110110
_CameraPickerState createState() => _CameraPickerState();
@@ -438,9 +438,14 @@ class _CameraPickerState extends State<CameraPicker> {
438438
Center(
439439
child: AnimatedContainer(
440440
duration: kThemeChangeDuration,
441-
width: isShootingButtonAnimate ? outerSize.width : (Screens.width / 5),
442-
height: isShootingButtonAnimate ? outerSize.height : (Screens.width / 5),
443-
padding: EdgeInsets.all(Screens.width / (isShootingButtonAnimate ? 10 : 35)),
441+
width: isShootingButtonAnimate
442+
? outerSize.width
443+
: (Screens.width / 5),
444+
height: isShootingButtonAnimate
445+
? outerSize.height
446+
: (Screens.width / 5),
447+
padding: EdgeInsets.all(
448+
Screens.width / (isShootingButtonAnimate ? 10 : 35)),
444449
decoration: BoxDecoration(
445450
color: Colors.white30,
446451
shape: BoxShape.circle,
@@ -453,11 +458,12 @@ class _CameraPickerState extends State<CameraPicker> {
453458
),
454459
),
455460
),
456-
if (isShowingProgress) CircleProgressBar(
457-
duration: 15.seconds,
458-
outerRadius: outerSize.width,
459-
ringsWidth: 2.0,
460-
),
461+
if (isShowingProgress)
462+
CircleProgressBar(
463+
duration: 15.seconds,
464+
outerRadius: outerSize.width,
465+
ringsWidth: 2.0,
466+
),
461467
],
462468
),
463469
),

lib/src/widget/circular_progress_bar.dart

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,11 @@ class CircleProgressBar extends StatefulWidget {
3030
State<StatefulWidget> createState() => CircleProgressState();
3131
}
3232

33-
class CircleProgressState extends State<CircleProgressBar> with SingleTickerProviderStateMixin {
33+
class CircleProgressState extends State<CircleProgressBar>
34+
with SingleTickerProviderStateMixin {
3435
final GlobalKey paintKey = GlobalKey();
35-
final StreamController<double> progressStreamController = StreamController<double>.broadcast();
36+
final StreamController<double> progressStreamController =
37+
StreamController<double>.broadcast();
3638

3739
AnimationController progressController;
3840
Animation<double> progressAnimation;
@@ -119,22 +121,22 @@ class ProgressPainter extends CustomPainter {
119121
final double innerRadius = center - ringsWidth * 2;
120122

121123
// if (progress > 0.0) {
122-
final double progressWidth = outerRadius - innerRadius;
124+
final double progressWidth = outerRadius - innerRadius;
123125
// if (radians > 0.0) {
124-
canvas.save();
125-
canvas.translate(0.0, size.width);
126-
canvas.rotate(-90.0.toRad);
127-
final Rect arcRect = Rect.fromCircle(
128-
center: offsetCenter,
129-
radius: drawRadius,
130-
);
131-
final Paint progressPaint = Paint()
132-
..color = ringsColor
133-
..style = PaintingStyle.stroke
134-
..strokeWidth = progressWidth;
135-
canvas
136-
..drawArc(arcRect, 0, radians, false, progressPaint)
137-
..restore();
126+
canvas.save();
127+
canvas.translate(0.0, size.width);
128+
canvas.rotate(-90.0.toRad);
129+
final Rect arcRect = Rect.fromCircle(
130+
center: offsetCenter,
131+
radius: drawRadius,
132+
);
133+
final Paint progressPaint = Paint()
134+
..color = ringsColor
135+
..style = PaintingStyle.stroke
136+
..strokeWidth = progressWidth;
137+
canvas
138+
..drawArc(arcRect, 0, radians, false, progressPaint)
139+
..restore();
138140
// }
139141
// }
140142
}

lib/src/widget/temp_picker.dart

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,14 @@ class _TempPickerState extends State<TempPicker> {
7676
Center(
7777
child: AnimatedContainer(
7878
duration: kThemeChangeDuration,
79-
width: isShootingButtonAnimate ? outerSize.width : (Screens.width / 5),
80-
height: isShootingButtonAnimate ? outerSize.height : (Screens.width / 5),
81-
padding: EdgeInsets.all(Screens.width / (isShootingButtonAnimate ? 10 : 35)),
79+
width: isShootingButtonAnimate
80+
? outerSize.width
81+
: (Screens.width / 5),
82+
height: isShootingButtonAnimate
83+
? outerSize.height
84+
: (Screens.width / 5),
85+
padding: EdgeInsets.all(
86+
Screens.width / (isShootingButtonAnimate ? 10 : 35)),
8287
decoration: BoxDecoration(
8388
color: Colors.white30,
8489
shape: BoxShape.circle,
@@ -91,11 +96,12 @@ class _TempPickerState extends State<TempPicker> {
9196
),
9297
),
9398
),
94-
if (isShowingProgress) CircleProgressBar(
95-
duration: 15.seconds,
96-
outerRadius: outerSize.width,
97-
ringsWidth: 2.0,
98-
),
99+
if (isShowingProgress)
100+
CircleProgressBar(
101+
duration: 15.seconds,
102+
outerRadius: outerSize.width,
103+
ringsWidth: 2.0,
104+
),
99105
],
100106
),
101107
),

lib/wechat_camera_picker.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ library wechat_camera_picker;
33
export 'package:photo_manager/photo_manager.dart';
44

55
export 'src/widget/camera_picker.dart';
6-
export 'src/widget/temp_picker.dart';
6+
export 'src/widget/temp_picker.dart';

0 commit comments

Comments
 (0)