@@ -13,6 +13,7 @@ import 'package:flutter_unit/app/blocs/global/global_state.dart';
13
13
14
14
import 'flutter_unit_text.dart' ;
15
15
import 'dart:ui' as ui;
16
+
16
17
/// create by 张风捷特烈 on 2020-03-07
17
18
/// contact me by email [email protected]
18
19
/// 说明: app 闪屏页
@@ -24,75 +25,92 @@ class StandardUnitSplash extends StatefulWidget {
24
25
_StandardUnitSplashState createState () => _StandardUnitSplashState ();
25
26
}
26
27
27
- class _StandardUnitSplashState extends State <StandardUnitSplash > with TickerProviderStateMixin {
28
- static const int _minCost = 1500 ;
28
+ class _StandardUnitSplashState extends State <StandardUnitSplash >
29
+ with TickerProviderStateMixin {
30
+ static const int _minCost = 1500 ;
29
31
30
- int _recoder = 0 ;
32
+ int _recorder = 0 ;
31
33
32
- final Paint paint = Paint ()..style= PaintingStyle .stroke..shader= ui.Gradient .linear (
33
- const Offset (0 , 0 ), const Offset (22 , 0 ), [Colors .red,Colors .yellow,Colors .blue,Colors .green], [1 / 4 ,2 / 4 ,3 / 4 ,1 ],TileMode .mirror,Matrix4 .rotationZ (pi/ 4 ).storage);
34
+ final Paint paint = Paint ()
35
+ ..style = PaintingStyle .stroke
36
+ ..shader = ui.Gradient .linear (
37
+ const Offset (0 , 0 ),
38
+ const Offset (22 , 0 ),
39
+ [Colors .red, Colors .yellow, Colors .blue, Colors .green],
40
+ [1 / 4 , 2 / 4 , 3 / 4 , 1 ],
41
+ TileMode .mirror,
42
+ Matrix4 .rotationZ (pi / 4 ).storage,
43
+ );
34
44
35
45
@override
36
46
void initState () {
37
47
super .initState ();
38
- _recoder = DateTime .now ().millisecondsSinceEpoch;
39
- SystemChrome .setSystemUIOverlayStyle (
40
- const SystemUiOverlayStyle (
41
- statusBarColor: Colors .transparent,
42
- ),
43
- );
48
+ _recorder = DateTime .now ().millisecondsSinceEpoch;
44
49
}
45
50
46
51
@override
47
52
Widget build (BuildContext context) {
48
53
final Size winSize = MediaQuery .of (context).size;
49
- return Material (
50
- child: BlocListener <AppBloc , AppState >(
51
- listener: _listenStart,
52
- child: Column (
53
- children: [
54
- const Spacer (),
55
- Expanded (child: Wrap (
56
- direction: Axis .vertical,
57
- alignment: WrapAlignment .center,
58
- crossAxisAlignment: WrapCrossAlignment .center,
59
- children: [
60
- Stack (
61
- children: [
62
- Text ("U" ,style: TextStyle (
63
- fontSize: 26 ,
64
- height: 1 ,
65
- fontWeight: FontWeight .bold,
66
- foreground: paint
67
- ),),
68
- const FlutterLogo (size: 60 ),
69
- ],
70
- ),
71
- const SizedBox (height: 20 ,),
72
- _buildFlutterUnitText (winSize.height, winSize.width),
73
- ],
74
- )),
75
- Expanded (child: Stack (
76
- alignment: Alignment .bottomCenter,
54
+ return AnnotatedRegion <SystemUiOverlayStyle >(
55
+ value: const SystemUiOverlayStyle (
56
+ statusBarColor: Colors .transparent,
57
+ statusBarIconBrightness: Brightness .dark),
58
+ child: Material (
59
+ child: BlocListener <AppBloc , AppState >(
60
+ listener: _listenStart,
61
+ child: Column (
77
62
children: [
78
- Positioned (bottom: 15 , child: Wrap (
63
+ const Spacer (),
64
+ Expanded (
65
+ child: Wrap (
79
66
direction: Axis .vertical,
80
67
alignment: WrapAlignment .center,
81
68
crossAxisAlignment: WrapCrossAlignment .center,
82
- children: const [
83
- Text ("Power By 张风捷特烈" , style: UnitTextStyle .splashShadows),
84
- Text ("· 2021 · @编程之王 " , style: UnitTextStyle .splashShadows),
69
+ children: [
70
+ Stack (
71
+ children: [
72
+ Text (
73
+ "U" ,
74
+ style: TextStyle (
75
+ fontSize: 26 ,
76
+ height: 1 ,
77
+ fontWeight: FontWeight .bold,
78
+ foreground: paint),
79
+ ),
80
+ const FlutterLogo (size: 60 ),
81
+ ],
82
+ ),
83
+ const SizedBox (
84
+ height: 20 ,
85
+ ),
86
+ _buildFlutterUnitText (winSize.height, winSize.width),
85
87
],
86
88
)),
89
+ Expanded (
90
+ child: Stack (
91
+ alignment: Alignment .bottomCenter,
92
+ children: [
93
+ Positioned (
94
+ bottom: 15 ,
95
+ child: Wrap (
96
+ direction: Axis .vertical,
97
+ alignment: WrapAlignment .center,
98
+ crossAxisAlignment: WrapCrossAlignment .center,
99
+ children: const [
100
+ Text ("Power By 张风捷特烈" ,
101
+ style: UnitTextStyle .splashShadows),
102
+ Text ("· 2021 · @编程之王 " ,
103
+ style: UnitTextStyle .splashShadows),
104
+ ],
105
+ )),
106
+ ],
107
+ ))
87
108
],
88
- ))
89
- ],
90
- )
109
+ )),
91
110
),
92
111
);
93
112
}
94
113
95
-
96
114
Widget _buildFlutterUnitText (double winH, double winW) {
97
115
return FlutterUnitText (
98
116
text: StrUnit .appName,
@@ -102,17 +120,15 @@ class _StandardUnitSplashState extends State<StandardUnitSplash> with TickerProv
102
120
103
121
// 监听资源加载完毕,启动,触发事件
104
122
void _listenStart (BuildContext context, AppState state) {
105
- int cost = DateTime .now ().millisecondsSinceEpoch - _recoder;
106
- BlocProvider .of <WidgetsBloc >(context).add (const EventTabTap (WidgetFamily .statelessWidget));
123
+ int cost = DateTime .now ().millisecondsSinceEpoch - _recorder;
124
+ BlocProvider .of <WidgetsBloc >(context)
125
+ .add (const EventTabTap (WidgetFamily .statelessWidget));
107
126
BlocProvider .of <LikeWidgetBloc >(context).add (const EventLoadLikeData ());
108
127
BlocProvider .of <CategoryBloc >(context).add (const EventLoadCategory ());
109
- if (cost< _minCost){
110
- Future .delayed (Duration (milliseconds: _minCost- cost)).then ((value){
128
+ if (cost < _minCost) {
129
+ Future .delayed (Duration (milliseconds: _minCost - cost)).then ((value) {
111
130
Navigator .of (context).pushReplacementNamed (UnitRouter .nav);
112
131
});
113
132
}
114
-
115
133
}
116
-
117
134
}
118
-
0 commit comments