Skip to content

Commit 3b5feed

Browse files
committed
Update
1 parent 06a2703 commit 3b5feed

File tree

1 file changed

+83
-23
lines changed

1 file changed

+83
-23
lines changed

lib/screens/welcome_screen.dart

Lines changed: 83 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -8,37 +8,79 @@ 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;
1317

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

26-
});
27-
print(controller?.value);
28-
},
2940
);
41+
animation = CurvedAnimation(parent: controller2!, curve: Curves.decelerate);
42+
controller2?.forward();
43+
controller2?.addListener(
44+
() {
45+
setState(() {});
46+
print(animation?.value);
47+
},
48+
);
49+
}
50+
void update3(){
51+
controller1 = AnimationController(
52+
duration: const Duration(seconds: 1),
53+
vsync: this,
54+
upperBound: 100,
3055

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-
// );
56+
);
57+
controller1?.forward();
58+
controller1?.addListener(
59+
() {
60+
setState(() {});
61+
print(controller1?.value);
62+
},
63+
);
4164
}
65+
@override
66+
void initState() {
67+
super.initState();
68+
update();
69+
update2();
70+
update3();
71+
72+
}
73+
// AnimationController controller = AnimationController(
74+
// duration: const Duration(seconds: 1),
75+
// vsync: this,
76+
// );
77+
// controller.forward();
78+
// controller.addListener(()
79+
// {
80+
// print(controller.value);
81+
// },
82+
// );
83+
4284
@override
4385
Widget build(BuildContext context) {
4486
return Scaffold(
@@ -55,7 +97,7 @@ class _WelcomeScreenState extends State<WelcomeScreen> with SingleTickerProvider
5597
tag: 'logo',
5698
child: Container(
5799
child: Image.asset('images/logo.png'),
58-
height: 60.0,
100+
height: animation!.value*100,
59101
),
60102
),
61103
Text(
@@ -106,9 +148,27 @@ class _WelcomeScreenState extends State<WelcomeScreen> with SingleTickerProvider
106148
),
107149
),
108150
),
151+
SizedBox(
152+
height: 48.0,
153+
),
154+
Container(
155+
child:Center(
156+
child: Text(
157+
'Loading : ${controller1!.value.toInt()}%',
158+
style: TextStyle(
159+
fontSize: 20.0,
160+
fontWeight: FontWeight.w900,
161+
),
162+
),
163+
),
164+
165+
),
109166
],
167+
110168
),
169+
111170
),
171+
112172
);
113173
}
114174
}

0 commit comments

Comments
 (0)