Skip to content

Commit 61bb43b

Browse files
committed
Update
1 parent 06a2703 commit 61bb43b

File tree

1 file changed

+89
-24
lines changed

1 file changed

+89
-24
lines changed

lib/screens/welcome_screen.dart

Lines changed: 89 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -8,41 +8,92 @@ class WelcomeScreen extends StatefulWidget {
88
_WelcomeScreenState createState() => _WelcomeScreenState();
99
}
1010

11-
class _WelcomeScreenState extends State<WelcomeScreen> with SingleTickerProviderStateMixin{
11+
class _WelcomeScreenState extends State<WelcomeScreen>
12+
with TickerProviderStateMixin {
1213
AnimationController? controller;
14+
AnimationController? controller1;
15+
AnimationController? controller2;
16+
Animation? animation;
17+
Animation? animation2;
1318

14-
@override
15-
void initState() {
16-
super.initState();
17-
controller = AnimationController(
19+
void update() {
20+
controller = AnimationController(
1821
duration: const Duration(seconds: 1),
19-
vsync: this,
22+
vsync: this,
2023
);
2124
controller?.forward();
22-
controller?.addListener(()
23-
{
24-
setState(() {
25+
controller?.addListener(
26+
() {
27+
setState(() {});
28+
print(controller?.value);
29+
},
30+
);
31+
}
32+
33+
void update2() {
34+
controller2 = AnimationController(
35+
duration: const Duration(seconds: 1),
36+
vsync: this,
37+
);
2538

26-
});
27-
print(controller?.value);
28-
},
39+
controller2?.forward();
40+
animation =
41+
ColorTween(begin: Colors.blueGrey, end: Colors.white).animate(controller2!);
42+
43+
animation2 = CurvedAnimation(parent: controller2!, curve: Curves.easeInCirc);
44+
45+
controller2?.addListener(
46+
() {
47+
setState(() {});
48+
print(animation?.value);
49+
print(animation2?.value);
50+
},
51+
);
52+
}
53+
54+
void update3() {
55+
controller1 = AnimationController(
56+
duration: const Duration(seconds: 1),
57+
vsync: this,
58+
upperBound: 100,
2959
);
60+
controller1?.forward();
61+
controller1?.addListener(
62+
() {
63+
setState(() {});
64+
print(controller1?.value);
65+
},
66+
);
67+
}
3068

31-
// AnimationController controller = AnimationController(
32-
// duration: const Duration(seconds: 1),
33-
// vsync: this,
34-
// );
35-
// controller.forward();
36-
// controller.addListener(()
37-
// {
38-
// print(controller.value);
39-
// },
40-
// );
69+
@override
70+
void dispose() {
71+
controller?.dispose();
72+
super.dispose();
73+
}
74+
75+
@override
76+
void initState() {
77+
super.initState();
78+
update();
79+
update2();
80+
update3();
4181
}
82+
// AnimationController controller = AnimationController(
83+
// duration: const Duration(seconds: 1),
84+
// vsync: this,
85+
// );
86+
// controller.forward();
87+
// controller.addListener(()
88+
// {
89+
// print(controller.value);
90+
// },
91+
// );
92+
4293
@override
4394
Widget build(BuildContext context) {
4495
return Scaffold(
45-
backgroundColor: Colors.red.withOpacity(controller!.value),
96+
backgroundColor: animation?.value,
4697
body: Padding(
4798
padding: EdgeInsets.symmetric(horizontal: 24.0),
4899
child: Column(
@@ -55,7 +106,7 @@ class _WelcomeScreenState extends State<WelcomeScreen> with SingleTickerProvider
55106
tag: 'logo',
56107
child: Container(
57108
child: Image.asset('images/logo.png'),
58-
height: 60.0,
109+
height: animation2!.value*100,
59110
),
60111
),
61112
Text(
@@ -106,6 +157,20 @@ class _WelcomeScreenState extends State<WelcomeScreen> with SingleTickerProvider
106157
),
107158
),
108159
),
160+
SizedBox(
161+
height: 48.0,
162+
),
163+
Container(
164+
child: Center(
165+
child: Text(
166+
'Loading : ${controller1!.value.toInt()}%',
167+
style: TextStyle(
168+
fontSize: 20.0,
169+
fontWeight: FontWeight.w900,
170+
),
171+
),
172+
),
173+
),
109174
],
110175
),
111176
),

0 commit comments

Comments
 (0)