|
@@ -1,10 +1,9 @@
|
1
|
|
-
|
2
|
1
|
import 'package:farmer_client/pages/splash/widgets/countdown.dart';
|
3
|
2
|
import 'package:get/get.dart';
|
4
|
3
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
5
|
4
|
import 'package:flutter/material.dart';
|
|
5
|
+import 'package:get_storage/get_storage.dart';
|
6
|
6
|
|
7
|
|
-import '../TabBar/index.dart';
|
8
|
7
|
|
9
|
8
|
class SplashScreen extends StatefulWidget {
|
10
|
9
|
const SplashScreen({Key? key}) : super(key: key);
|
|
@@ -14,44 +13,49 @@ class SplashScreen extends StatefulWidget {
|
14
|
13
|
}
|
15
|
14
|
|
16
|
15
|
class _SplashScreen extends State<SplashScreen> {
|
|
16
|
+ GetStorage box = GetStorage();
|
17
|
17
|
handleOnFinish() {
|
18
|
|
- Get.off(Home());
|
19
|
|
- // Get.toNamed("/addressList");
|
|
18
|
+ bool isLogin = box.hasData('token');
|
|
19
|
+ if (isLogin) {
|
|
20
|
+ Get.offNamed('/');
|
|
21
|
+ } else {
|
|
22
|
+ Get.offNamed('/login');
|
|
23
|
+ }
|
20
|
24
|
}
|
21
|
25
|
|
22
|
26
|
@override
|
23
|
27
|
Widget build(BuildContext context) {
|
24
|
28
|
return Scaffold(
|
25
|
29
|
body: Container(
|
26
|
|
- decoration: const BoxDecoration(
|
27
|
|
- image: DecorationImage(
|
28
|
|
- image: AssetImage("images/splash.png"),
|
29
|
|
- fit: BoxFit.cover,
|
30
|
|
- alignment: Alignment.topCenter),
|
|
30
|
+ decoration: const BoxDecoration(
|
|
31
|
+ image: DecorationImage(
|
|
32
|
+ image: AssetImage("images/splash.png"),
|
|
33
|
+ fit: BoxFit.cover,
|
|
34
|
+ alignment: Alignment.topCenter),
|
|
35
|
+ ),
|
|
36
|
+ child: Stack(
|
|
37
|
+ children: [
|
|
38
|
+ Positioned(
|
|
39
|
+ right: 15.w,
|
|
40
|
+ top: 50.h,
|
|
41
|
+ child: countdown(3, handleOnFinish),
|
31
|
42
|
),
|
32
|
|
- child: Stack(
|
33
|
|
- children: [
|
34
|
|
- Positioned(
|
35
|
|
- right: 15.w,
|
36
|
|
- top: 50.h,
|
37
|
|
- child: countdown(3, handleOnFinish),
|
38
|
|
- ),
|
39
|
|
- Positioned(
|
40
|
|
- bottom: 0,
|
41
|
|
- child: Container(
|
42
|
|
- width: 375.w,
|
43
|
|
- height: 60.w,
|
44
|
|
- child: Center(
|
45
|
|
- child: Image.asset(
|
46
|
|
- 'images/logo.png',
|
47
|
|
- width: 218.w,
|
48
|
|
- height: 50.w,
|
49
|
|
- ),
|
50
|
|
- ),
|
|
43
|
+ Positioned(
|
|
44
|
+ bottom: 0,
|
|
45
|
+ child: Container(
|
|
46
|
+ width: 375.w,
|
|
47
|
+ height: 60.w,
|
|
48
|
+ child: Center(
|
|
49
|
+ child: Image.asset(
|
|
50
|
+ 'images/logo.png',
|
|
51
|
+ width: 218.w,
|
|
52
|
+ height: 50.w,
|
51
|
53
|
),
|
52
|
54
|
),
|
53
|
|
- ],
|
|
55
|
+ ),
|
54
|
56
|
),
|
55
|
|
- ));
|
|
57
|
+ ],
|
|
58
|
+ ),
|
|
59
|
+ ));
|
56
|
60
|
}
|
57
|
61
|
}
|