File tree Expand file tree Collapse file tree 5 files changed +64
-0
lines changed Expand file tree Collapse file tree 5 files changed +64
-0
lines changed Original file line number Diff line number Diff line change @@ -202,4 +202,9 @@ const PAGE_ITEMS = [
202202 "img" : PageImage .FLUTTER_OPEN ,
203203 "click" : PageName .ANIM_HERO ,
204204 },
205+ {
206+ "title" : PageName .ANIM_FADE_TRANS ,
207+ "img" : PageImage .FLUTTER_OPEN ,
208+ "click" : PageName .ANIM_FADE_TRANS ,
209+ },
205210];
Original file line number Diff line number Diff line change @@ -45,4 +45,5 @@ class PageName {
4545 static const ANIM_CONTAINER = "AnimationContainer" ;
4646 static const ANIM_CROSS_FADE = "AnimationCrossFade" ;
4747 static const ANIM_HERO = "HeroPage" ;
48+ static const ANIM_FADE_TRANS = "FadeTranstion" ;
4849}
Original file line number Diff line number Diff line change @@ -59,6 +59,7 @@ class FlutterOpenApp extends StatelessWidget {
5959 PageName .ANIM_CONTAINER : (context) => AnimatedContainerPage (),
6060 PageName .ANIM_CROSS_FADE : (context) => AnimCrossFadePage (),
6161 PageName .ANIM_HERO : (context) => HeroPage (),
62+ PageName .ANIM_FADE_TRANS : (context) => FadeTransitionPage (),
6263 },
6364 );
6465 }
Original file line number Diff line number Diff line change 1+ ///
2+ /// Created by NieBin on 2019/6/8
3+ /// Github: https://github.com/nb312
4+ 5+ import "package:flutter/material.dart" ;
6+ import 'package:flutter_widgets/const/_const.dart' ;
7+
8+ class FadeTransitionPage extends StatefulWidget {
9+ @override
10+ _FadeTransitionState createState () => _FadeTransitionState ();
11+ }
12+
13+ class _FadeTransitionState extends State <FadeTransitionPage >
14+ with SingleTickerProviderStateMixin {
15+ Animation <double > _animation;
16+ AnimationController _controller;
17+
18+ Widget _fadeTrans () => FadeTransition (
19+ opacity: _animation,
20+ child: Text (
21+ "Hello world" ,
22+ style: TextStyle (color: RED_LIGHT ),
23+ ),
24+ );
25+
26+ @override
27+ void initState () {
28+ _controller =
29+ AnimationController (duration: Duration (seconds: 3 ), vsync: this );
30+ CurvedAnimation curvedAnimation =
31+ CurvedAnimation (parent: _controller, curve: Curves .easeOut);
32+ _animation = Tween (begin: 0.0 , end: 1.0 ).animate (curvedAnimation);
33+ super .initState ();
34+ }
35+
36+ @override
37+ Widget build (BuildContext context) {
38+ return Scaffold (
39+ appBar: AppBar (
40+ title: Text (PageName .ANIM_FADE_TRANS ),
41+ ),
42+ body: Column (
43+ children: < Widget > [
44+ _fadeTrans (),
45+ FloatingActionButton (
46+ child: Text ("Click Me" ),
47+ onPressed: () {
48+ _controller.reset ();
49+ _controller.forward ();
50+ },
51+ )
52+ ],
53+ ),
54+ );
55+ }
56+ }
Original file line number Diff line number Diff line change @@ -6,3 +6,4 @@ export "AnimationPage.dart";
66export 'AnimatedContainerPage.dart' ;
77export 'AnimCrossFadePage.dart' ;
88export 'HeroPage.dart' ;
9+ export 'FadeTransitionPage.dart' ;
You can’t perform that action at this time.
0 commit comments