11import 'package:flutter/material.dart' ;
2- import 'package:flutter_animation_set/widget/behavior_animation .dart' ;
2+ import 'package:flutter_animation_set/widget/behavior_animations .dart' ;
33import 'package:flutter_animation_set/widget/transition_animations.dart' ;
4+ import 'package:flutter_animation_set/animation_set.dart' ;
5+ import 'package:flutter_animation_set/animator.dart' ;
46
57void main () => runApp (AnimatorSetActivity ());
68
@@ -19,37 +21,81 @@ class AnimatorSetState extends State<AnimatorSetActivity> {
1921 primaryColor: Colors .white,
2022 ),
2123 home: Scaffold (
22- appBar: AppBar (),
23- body: GridView .count (
24- crossAxisCount: 4 ,
25- children: < Widget > [
26- BoxColor (child: YYRotatingPlane (), color: Color (0xFFD35413 )),
27- BoxColor (child: YYDoubleBounce (), color: Color (0xFF2F3E50 )),
28- BoxColor (child: YYWave (), color: Color (0xFF00BA9B )),
29- BoxColor (child: YYWanderingCubes (), color: Color (0xFF3279B5 )),
30- BoxColor (child: YYFadingFour (), color: Color (0xFF323232 )),
31- BoxColor (child: YYFadingCube (), color: Color (0xFF58BD60 )),
32- BoxColor (child: YYPulse (), color: Color (0xFF7D8A8B )),
33- BoxColor (child: YYThreeBounce (), color: Color (0xFFD35413 )),
34- BoxColor (child: YYThreeLine (), color: Color (0xFFF48A8B )),
35- BoxColor (child: YYCubeGrid (), color: Color (0xFFD35413 )),
36- BoxColor (child: YYRotatingCircle (), color: Color (0xFF3279B5 )),
37- BoxColor (child: YYPumpingHeart (), color: Color (0xFFF4A352 )),
38- BoxColor (child: YYRipple (), color: Color (0xFF58BD60 )),
39- BoxColor (child: YYRotateLine (), color: Color (0xFF00BA9B )),
40- BoxColor (child: YYCubeFadeIn (), color: Color (0xFFFCCB63 )),
41- BoxColor (child: YYBlinkGrid (), color: Color (0xFF323232 )),
42- BoxColor (child: YYFadeButton (), color: Color (0xFF3279B5 )),
43- BoxColor (child: YYSingleLike (), color: Color (0xFFF4A352 )),
44- BoxColor (child: YYLove (), color: Color (0xFF2F3E50 )),
45- BoxColor (child: YYSpringMenu (), color: Color (0xFF00BA9B )),
46- BoxColor (child: YYFoldMenu (), color: Color (0xFF58BD60 )),
47- ],
48- )),
24+ appBar: AppBar (),
25+ body: CustomScrollView (
26+ slivers: < Widget > [
27+ SliverToBoxAdapter (
28+ child: Padding (
29+ padding: EdgeInsets .all (12.0 ),
30+ child: Text ("Transition Animations" ),
31+ ),
32+ ),
33+ SliverGrid .count (
34+ crossAxisCount: 4 ,
35+ children: < Widget > [
36+ BoxColor (child: YYRotatingPlane (), color: Color (0xFFD35413 )),
37+ BoxColor (child: YYDoubleBounce (), color: Color (0xFF2F3E50 )),
38+ BoxColor (child: YYWave (), color: Color (0xFF00BA9B )),
39+ BoxColor (child: YYWanderingCubes (), color: Color (0xFF3279B5 )),
40+ BoxColor (child: YYFadingFour (), color: Color (0xFF323232 )),
41+ BoxColor (child: YYFadingCube (), color: Color (0xFF58BD60 )),
42+ BoxColor (child: YYPulse (), color: Color (0xFF7D8A8B )),
43+ BoxColor (child: YYThreeBounce (), color: Color (0xFFD35413 )),
44+ BoxColor (child: YYThreeLine (), color: Color (0xFFF48A8B )),
45+ BoxColor (child: YYCubeGrid (), color: Color (0xFFD35413 )),
46+ BoxColor (child: YYRotatingCircle (), color: Color (0xFF3279B5 )),
47+ BoxColor (child: YYPumpingHeart (), color: Color (0xFFF4A352 )),
48+ BoxColor (child: YYRipple (), color: Color (0xFF58BD60 )),
49+ BoxColor (child: YYRotateLine (), color: Color (0xFF00BA9B )),
50+ BoxColor (child: YYCubeFadeIn (), color: Color (0xFFFCCB63 )),
51+ BoxColor (child: YYBlinkGrid (), color: Color (0xFF323232 )),
52+ ],
53+ ),
54+ SliverToBoxAdapter (
55+ child: Padding (
56+ padding: EdgeInsets .all (12.0 ),
57+ child: Text ("Behavior Animations" ),
58+ ),
59+ ),
60+ SliverGrid .count (
61+ crossAxisCount: 4 ,
62+ children: < Widget > [
63+ BoxColor (child: YYFadeButton (), color: Color (0xFF3279B5 )),
64+ BoxColor (child: YYSingleLike (), color: Color (0xFFF4A352 )),
65+ BoxColor (child: YYLove (), color: Color (0xFF2F3E50 )),
66+ BoxColor (child: YYSpringMenu (), color: Color (0xFF00BA9B )),
67+ BoxColor (child: YYFoldMenu (), color: Color (0xFF58BD60 )),
68+ ],
69+ ),
70+ SliverToBoxAdapter (
71+ child: Padding (
72+ padding: EdgeInsets .all (12.0 ),
73+ child: Text ("Leaning Curves" ),
74+ ),
75+ ),
76+ SliverList (
77+ delegate: SliverChildBuilderDelegate (
78+ (BuildContext context, int index) {
79+ return box[index];
80+ },
81+ childCount: 2 ,
82+ ),
83+ ),
84+ ],
85+ ),
86+ ),
4987 );
5088 }
5189}
5290
91+ var box = [
92+ BoxColor (
93+ child: CurvesLeaning (curve: Curves .linear), color: Color (0xFF000000 )),
94+ BoxColor (
95+ child: CurvesLeaning (curve: Curves .bounceInOut),
96+ color: Color (0xFF000000 )),
97+ ];
98+
5399class BoxColor extends StatefulWidget {
54100 BoxColor ({this .child, this .color = Colors .black});
55101
@@ -74,3 +120,48 @@ class BoxColorState extends State<BoxColor> {
74120 );
75121 }
76122}
123+
124+ class CurvesLeaning extends StatefulWidget {
125+ CurvesLeaning ({this .curve});
126+
127+ Curve curve;
128+
129+ @override
130+ State <StatefulWidget > createState () {
131+ return CurvesLeaningState ();
132+ }
133+ }
134+
135+ class CurvesLeaningState extends State <CurvesLeaning > {
136+ @override
137+ Widget build (BuildContext context) {
138+ return Padding (
139+ padding: EdgeInsets .all (12.0 ),
140+ child: Flex (
141+ direction: Axis .vertical,
142+ children: < Widget > [
143+ Container (
144+ width: MediaQuery .of (context).size.width,
145+ child: AnimatorSet (
146+ child: SizedBox (
147+ child: Container (
148+ color: Colors .white,
149+ ),
150+ width: 20 ,
151+ height: 20 ,
152+ ),
153+ animatorSet: [
154+ TX (
155+ duration: 2000 ,
156+ from: 0.0 ,
157+ to: 80.0 ,
158+ curve: widget.curve,
159+ )
160+ ],
161+ ),
162+ ),
163+ ],
164+ ),
165+ );
166+ }
167+ }
0 commit comments