李志伟 3 years ago
parent
commit
6d3299489c

+ 0
- 9
lib/main.dart View File

1
-
2
 import 'package:farmer_client/theme.dart';
1
 import 'package:farmer_client/theme.dart';
3
 import 'package:flutter/material.dart';
2
 import 'package:flutter/material.dart';
4
 import 'package:get/get.dart';
3
 import 'package:get/get.dart';
13
 void main() async {
12
 void main() async {
14
   await GetStorage.init();
13
   await GetStorage.init();
15
 
14
 
16
-
17
   runApp(const MyApp());
15
   runApp(const MyApp());
18
 }
16
 }
19
 
17
 
20
 class MyApp extends StatelessWidget {
18
 class MyApp extends StatelessWidget {
21
   const MyApp({Key? key}) : super(key: key);
19
   const MyApp({Key? key}) : super(key: key);
22
 
20
 
23
-
24
-
25
   // This widget is the root of your application.
21
   // This widget is the root of your application.
26
   @override
22
   @override
27
   Widget build(BuildContext context) {
23
   Widget build(BuildContext context) {
28
-
29
-    GetStorage box = GetStorage();
30
-
31
     return ScreenUtilInit(
24
     return ScreenUtilInit(
32
       designSize: const Size(375, 812),
25
       designSize: const Size(375, 812),
33
       minTextAdapt: true,
26
       minTextAdapt: true,
43
             Locale('zh', ''),
36
             Locale('zh', ''),
44
             Locale('en', ''),
37
             Locale('en', ''),
45
           ],
38
           ],
46
-
47
           theme: getTheme(),
39
           theme: getTheme(),
48
           initialRoute: '/splash',
40
           initialRoute: '/splash',
49
           defaultTransition: Transition.native,
41
           defaultTransition: Transition.native,
50
           routingCallback: routingCallback,
42
           routingCallback: routingCallback,
51
           initialBinding: AppBindings(),
43
           initialBinding: AppBindings(),
52
           getPages: pages,
44
           getPages: pages,
53
-
54
         );
45
         );
55
       },
46
       },
56
     );
47
     );

+ 25
- 2
lib/pages/TabBar/widgets/main/index.dart View File

1
+import 'package:get/get.dart';
2
+import 'package:get_storage/get_storage.dart';
3
+
1
 import './widgets/OtherColumn.dart';
4
 import './widgets/OtherColumn.dart';
2
 import './widgets/UserAddress.dart';
5
 import './widgets/UserAddress.dart';
3
 import './widgets/UserInfo.dart';
6
 import './widgets/UserInfo.dart';
12
 }
15
 }
13
 
16
 
14
 class _MainPageState extends State<MainPage> {
17
 class _MainPageState extends State<MainPage> {
18
+  GetStorage box = GetStorage();
15
   @override
19
   @override
16
   Widget build(BuildContext context) {
20
   Widget build(BuildContext context) {
17
     return Container(
21
     return Container(
41
                   height: 49.h,
45
                   height: 49.h,
42
                   child: ElevatedButton(
46
                   child: ElevatedButton(
43
                     onPressed: () {
47
                     onPressed: () {
44
-                      // _handelSubmit();
45
-                      print('用户点击了支付啊阿松大撒地方');
48
+                      showDialog(
49
+                          context: context,
50
+                          builder: (context) {
51
+                            return AlertDialog(
52
+                                content: Text("您确定退出登录吗?"),
53
+                                actions: <Widget>[
54
+                                  TextButton(
55
+                                    child: Text("取消"),
56
+                                    onPressed: () {
57
+                                      Navigator.pop(context, 'Cancle');
58
+                                    },
59
+                                  ),
60
+                                  TextButton(
61
+                                      child: Text("确定"),
62
+                                      onPressed: () {
63
+                                        Navigator.pop(context, "Ok");
64
+                                        box.remove('token');
65
+                                        Get.offNamed('/login');
66
+                                      })
67
+                                ]);
68
+                          });
46
                     },
69
                     },
47
                     child: const Text(
70
                     child: const Text(
48
                       "退出登陆",
71
                       "退出登陆",

+ 0
- 1
lib/pages/addressList/index.dart View File

36
         context: context,
36
         context: context,
37
         builder: (context) {
37
         builder: (context) {
38
           return AlertDialog(
38
           return AlertDialog(
39
-              title: Text("提示信息"),
40
               content: Text("您确定要删除此地址吗?"),
39
               content: Text("您确定要删除此地址吗?"),
41
               actions: <Widget>[
40
               actions: <Widget>[
42
                 TextButton(
41
                 TextButton(

+ 0
- 1
lib/utils/Request.dart View File

1
 import 'dart:convert';
1
 import 'dart:convert';
2
 
2
 
3
 import 'package:dio/dio.dart';
3
 import 'package:dio/dio.dart';
4
-import 'package:flutter/foundation.dart';
5
 import 'package:get/get.dart';
4
 import 'package:get/get.dart';
6
 import 'package:get_storage/get_storage.dart';
5
 import 'package:get_storage/get_storage.dart';
7
 
6