李志伟 3 年前
父节点
当前提交
e27eb08ac4
共有 15 个文件被更改,包括 83 次插入21 次删除
  1. 二进制
      images/index/borderImg.png
  2. 二进制
      images/index/goback.png
  3. 二进制
      images/index/index.png
  4. 二进制
      images/index/indexActive.png
  5. 二进制
      images/index/job.png
  6. 二进制
      images/index/jobActive.png
  7. 二进制
      images/index/orderList.png
  8. 二进制
      images/index/position.png
  9. 二进制
      images/index/search.png
  10. 二进制
      images/index/user.png
  11. 二进制
      images/index/userActive.png
  12. 2
    1
      lib/pages/Login/index.dart
  13. 69
    19
      lib/pages/home/index.dart
  14. 1
    1
      lib/routes/middleWares.dart
  15. 11
    0
      pubspec.yaml

二进制
images/index/borderImg.png 查看文件


二进制
images/index/goback.png 查看文件


二进制
images/index/index.png 查看文件


二进制
images/index/indexActive.png 查看文件


二进制
images/index/job.png 查看文件


二进制
images/index/jobActive.png 查看文件


二进制
images/index/orderList.png 查看文件


二进制
images/index/position.png 查看文件


二进制
images/index/search.png 查看文件


二进制
images/index/user.png 查看文件


二进制
images/index/userActive.png 查看文件


+ 2
- 1
lib/pages/Login/index.dart 查看文件

@@ -8,6 +8,7 @@ import 'package:flutter_screenutil/flutter_screenutil.dart';
8 8
 import 'package:get/get.dart';
9 9
 import 'package:worker_client/widgets/Cell.dart';
10 10
 import 'package:worker_client/widgets/GradientButton.dart';
11
+import 'package:worker_client/pages/home/index.dart';
11 12
 import '../../models/entities/person.dart';
12 13
 import '../../services/user.dart';
13 14
 
@@ -84,7 +85,7 @@ class _Login extends State<Login> {
84 85
           userLogin(phone, qCode).then((res) {
85 86
             userInfo(Person.fromJson(res['person']));
86 87
             Fluttertoast.showToast(msg: '登录成功!');
87
-            Get.back();
88
+            Get.off(Home());
88 89
           }).catchError((err) {
89 90
             Fluttertoast.showToast(msg: err);
90 91
           });

+ 69
- 19
lib/pages/home/index.dart 查看文件

@@ -1,29 +1,79 @@
1 1
 import 'package:flutter/material.dart';
2 2
 import 'package:get/get.dart';
3
+import 'package:flutter_screenutil/flutter_screenutil.dart';
3 4
 
4
-class Home extends StatelessWidget {
5
+class Home extends StatefulWidget {
6
+  const Home({Key? key}) : super(key: key);
7
+
8
+  @override
9
+  _Home createState() => _Home();
10
+}
11
+class _Home extends State<Home> {
12
+
13
+  List images = [
14
+    ['images/index/index.png', 'images/index/indexActive.png'],
15
+    ['images/index/job.png', 'images/index/jobActive.png'],
16
+    ['images/index/user.png', 'images/index/userActive.png'],
17
+  ];
18
+
19
+  final List _titles = ['首页', '好物', '双11'];
20
+  int _currentIndex = 0;
5 21
   @override
6 22
   Widget build(BuildContext context) {
7
-    // controller.person
8 23
     return Scaffold(
9 24
       appBar: AppBar(
10
-        title: Text('首页'),
11
-      ),
12
-      body: GestureDetector(
13
-        onTap: () {
14
-          Get.snackbar(
15
-            "Hey i'm a Get SnackBar!", // title
16
-            "It's unbelievable! I'm using SnackBar without context, without boilerplate, without Scaffold, it is something truly amazing!", // message
17
-            icon: Icon(Icons.alarm),
18
-            shouldIconPulse: true,
19
-            barBlur: 20,
20
-            isDismissible: true,
21
-            duration: Duration(seconds: 3),
22
-          );
23
-          // Get.snackbar('Hi', 'i am a modern snackbar');
24
-        },
25
-        child: const Text("首页内容"),
25
+        elevation: 0,
26
+        centerTitle: true,
27
+        backgroundColor: Colors.white,
28
+        title: Text(
29
+          '首页',
30
+          style:
31
+          TextStyle(color: Colors.black, fontSize: 17.sp, letterSpacing: 2),
32
+        ),
26 33
       ),
34
+
27 35
     );
28 36
   }
29
-}
37
+  }
38
+// class Home extends StatelessWidget {
39
+//   @override
40
+//   Widget build(BuildContext context) {
41
+//     // controller.person
42
+//     return Scaffold(
43
+//       appBar: AppBar(
44
+//         elevation: 0,
45
+//         centerTitle: true,
46
+//         backgroundColor: Colors.white,
47
+//         title: Text(
48
+//           '首页',
49
+//           style:
50
+//               TextStyle(color: Colors.black, fontSize: 17.sp, letterSpacing: 2),
51
+//         ),
52
+//       ),
53
+//       body: GestureDetector(
54
+//         onTap: () {
55
+//           Get.snackbar(
56
+//             "Hey i'm a Get SnackBar!", // title
57
+//             "It's unbelievable! I'm using SnackBar without context, without boilerplate, without Scaffold, it is something truly amazing!", // message
58
+//             icon: Icon(Icons.alarm),
59
+//             shouldIconPulse: true,
60
+//             barBlur: 20,
61
+//             isDismissible: true,
62
+//             duration: Duration(seconds: 3),
63
+//           );
64
+//           // Get.snackbar('Hi', 'i am a modern snackbar');
65
+//         },
66
+//         child: const Text("首页内容"),
67
+//       ),
68
+//       bottomNavigationBar: BottomNavigationBar(
69
+//         items: const <BottomNavigationBarItem>[
70
+//           BottomNavigationBarItem(title: Text('首页'),icon: Icon(Icons.home)),
71
+//           BottomNavigationBarItem(title: Text('书籍'),icon: Icon(Icons.book)),
72
+//           BottomNavigationBarItem(title: Text('我的'),icon: Icon(Icons.perm_identity)),
73
+//         ],
74
+//       ),
75
+//     );
76
+//   }
77
+// }
78
+
79
+

+ 1
- 1
lib/routes/middleWares.dart 查看文件

@@ -11,6 +11,6 @@ void routingCallback (routing) {
11 11
   if (!isLogin && !isSplashScreen && !isLoginPage) {
12 12
     // addPostFrameCallback 作用是等当前帧绘制完成之后再加载
13 13
     // https://github.com/jonataslaw/getx/issues/262
14
-    SchedulerBinding.instance?.addPostFrameCallback((_) => Get.toNamed('/login'));
14
+    SchedulerBinding.instance?.addPostFrameCallback((_) => Get.offNamed('/login'));
15 15
   }
16 16
 }

+ 11
- 0
pubspec.yaml 查看文件

@@ -70,6 +70,17 @@ flutter:
70 70
     - images/login/VerificationCode.png
71 71
     - images/login/checkedImg.png
72 72
     - images/login/unChecked.png
73
+    - images/index/borderImg.png
74
+    - images/index/goback.png
75
+    - images/index/index.png
76
+    - images/index/indexActive.png
77
+    - images/index/job.png
78
+    - images/index/jobActive.png
79
+    - images/index/orderList.png
80
+    - images/index/position.png
81
+    - images/index/search.png
82
+    - images/index/user.png
83
+    - images/index/userActive.png
73 84
   # To add assets to your application, add an assets section, like this:
74 85
   # assets:
75 86
   #   - images/a_dot_burr.jpeg