李志伟 3 年之前
父節點
當前提交
6d3299489c
共有 4 個檔案被更改,包括 25 行新增13 行删除
  1. 0
    9
      lib/main.dart
  2. 25
    2
      lib/pages/TabBar/widgets/main/index.dart
  3. 0
    1
      lib/pages/addressList/index.dart
  4. 0
    1
      lib/utils/Request.dart

+ 0
- 9
lib/main.dart 查看文件

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

+ 25
- 2
lib/pages/TabBar/widgets/main/index.dart 查看文件

@@ -1,3 +1,6 @@
1
+import 'package:get/get.dart';
2
+import 'package:get_storage/get_storage.dart';
3
+
1 4
 import './widgets/OtherColumn.dart';
2 5
 import './widgets/UserAddress.dart';
3 6
 import './widgets/UserInfo.dart';
@@ -12,6 +15,7 @@ class MainPage extends StatefulWidget {
12 15
 }
13 16
 
14 17
 class _MainPageState extends State<MainPage> {
18
+  GetStorage box = GetStorage();
15 19
   @override
16 20
   Widget build(BuildContext context) {
17 21
     return Container(
@@ -41,8 +45,27 @@ class _MainPageState extends State<MainPage> {
41 45
                   height: 49.h,
42 46
                   child: ElevatedButton(
43 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 70
                     child: const Text(
48 71
                       "退出登陆",

+ 0
- 1
lib/pages/addressList/index.dart 查看文件

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

+ 0
- 1
lib/utils/Request.dart 查看文件

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