@@ -24,24 +24,14 @@ class _UnitSplashState extends State<UnitSplash> with TickerProviderStateMixin {
2424 AnimationController _controller;
2525 AnimationController _secondController;
2626 double _factor;
27- double _secondFactor = 0.0 ;
2827 Animation _curveAnim;
29- Animation _curveAnim2;
30- Animation _bouncAnim;
28+
3129 bool _animEnd = false ;
3230
3331 @override
3432 void initState () {
35- // SystemUiOverlayStyle systemUiOverlayStyle =
36- // SystemUiOverlayStyle(statusBarColor: Colors.red);
37- // SystemChrome.setSystemUIOverlayStyle(systemUiOverlayStyle);
38- // SystemChrome.setSystemUIOverlayStyle(
39- // SystemUiOverlayStyle(statusBarColor: Colors.blue));
40- SystemUiOverlayStyle systemUiOverlayStyle = SystemUiOverlayStyle (
41- // systemNavigationBarColor: Colors.transparent,
42- statusBarColor: Colors .transparent);
33+ SystemUiOverlayStyle systemUiOverlayStyle = SystemUiOverlayStyle (statusBarColor: Colors .transparent);
4334 SystemChrome .setSystemUIOverlayStyle (systemUiOverlayStyle);
44- // SystemChrome.setEnabledSystemUIOverlays([]);
4535
4636 _controller =
4737 AnimationController (duration: Duration (milliseconds: 1000 ), vsync: this )
@@ -58,18 +48,13 @@ class _UnitSplashState extends State<UnitSplash> with TickerProviderStateMixin {
5848 });
5949 _secondController =
6050 AnimationController (duration: Duration (milliseconds: 600 ), vsync: this )
61- ..addListener (() => setState (() {
62- return _secondFactor = _curveAnim2.value;
63- }))
6451 ..addStatusListener ((s) {
6552 if (s == AnimationStatus .completed) {
6653 Navigator .of (context).pushReplacementNamed (Router .nav);
6754 }
6855 });
6956 _curveAnim =
7057 CurvedAnimation (parent: _controller, curve: Curves .fastOutSlowIn);
71- _curveAnim2 =
72- CurvedAnimation (parent: _secondController, curve: Curves .fastOutSlowIn);
7358 _controller.forward ();
7459 super .initState ();
7560 }
@@ -79,14 +64,7 @@ class _UnitSplashState extends State<UnitSplash> with TickerProviderStateMixin {
7964 var winH = MediaQuery .of (context).size.height;
8065 var winW = MediaQuery .of (context).size.width;
8166
82- return
83- // GestureDetector(
84- // onTap: () {
85- // _controller.reset();
86- // _controller.forward();
87- // },
88- // child:
89- Scaffold (
67+ return Scaffold (
9068 body: Stack (
9169 alignment: Alignment .center,
9270 children: < Widget > [
@@ -103,7 +81,6 @@ class _UnitSplashState extends State<UnitSplash> with TickerProviderStateMixin {
10381 buildPower (),
10482 ],
10583 ),
106- // ),
10784 );
10885 }
10986
@@ -113,8 +90,7 @@ class _UnitSplashState extends State<UnitSplash> with TickerProviderStateMixin {
11390 color: Theme .of (context).primaryColor,
11491 fontWeight: FontWeight .bold,
11592 shadows: [
116- Shadow (
117- //阴影
93+ const Shadow (
11894 color: Colors .grey,
11995 offset: Offset (1.0 , 1.0 ), blurRadius: 1.0 ,
12096 )
@@ -131,7 +107,7 @@ class _UnitSplashState extends State<UnitSplash> with TickerProviderStateMixin {
131107 AlignmentTween (begin: Alignment (- 1 , 0 ), end: Alignment .center)
132108 .animate (_secondController),
133109 child: AnimatedOpacity (
134- duration: Duration (milliseconds: 300 ),
110+ duration: const Duration (milliseconds: 300 ),
135111 opacity: _animEnd ? 1.0 : 0.0 ,
136112 child: ShaderMask (
137113 shaderCallback: _buildShader,
@@ -156,8 +132,8 @@ class _UnitSplashState extends State<UnitSplash> with TickerProviderStateMixin {
156132 Widget buildLogo (Color primaryColor) {
157133 return SlideTransition (
158134 position: Tween <Offset >(
159- begin: Offset (0 , 0 ),
160- end: Offset (0 , - 1.5 ),
135+ begin: const Offset (0 , 0 ),
136+ end: const Offset (0 , - 1.5 ),
161137 ).animate (_controller),
162138 child: RotationTransition (
163139 turns: _controller,
@@ -179,27 +155,24 @@ class _UnitSplashState extends State<UnitSplash> with TickerProviderStateMixin {
179155 );
180156 }
181157
182- Widget buildHead () {
183- return SlideTransition (
158+ Widget buildHead () => SlideTransition (
184159 position: Tween <Offset >(
185- end: Offset (0 , 0 ),
186- begin: Offset (0 , - 5 ),
160+ end: const Offset (0 , 0 ),
161+ begin: const Offset (0 , - 5 ),
187162 ).animate (_controller),
188163 child: Container (
189164 height: 45 ,
190165 width: 45 ,
191166 child: Image .asset ('assets/images/icon_head.png' ),
192167 ));
193- }
194168
195- Widget buildPower () {
196- return Positioned (
169+ Widget buildPower () => Positioned (
197170 bottom: 30 ,
198171 right: 30 ,
199172 child: AnimatedOpacity (
200- duration: Duration (milliseconds: 300 ),
173+ duration: const Duration (milliseconds: 300 ),
201174 opacity: _animEnd ? 1.0 : 0.0 ,
202- child: Text ("Power By 张风捷特烈" ,
175+ child: const Text ("Power By 张风捷特烈" ,
203176 style: TextStyle (
204177 color: Colors .grey,
205178 shadows: [
@@ -210,5 +183,4 @@ class _UnitSplashState extends State<UnitSplash> with TickerProviderStateMixin {
210183 ],
211184 fontSize: 16 ))),
212185 );
213- }
214186}
0 commit comments