李志伟 3 years ago
parent
commit
88ded50777

+ 0
- 59
lib/pages/Information/ArticleInfo.dart View File

@@ -1,59 +0,0 @@
1
-import 'package:flutter/material.dart';
2
-import 'package:flutter_screenutil/flutter_screenutil.dart';
3
-
4
-class ArticleInfo extends StatelessWidget {
5
-  const ArticleInfo({Key? key}) : super(key: key);
6
-
7
-  @override
8
-  Widget build(BuildContext context) {
9
-    return Scaffold(
10
-        resizeToAvoidBottomInset: false,
11
-        appBar: AppBar(
12
-          title: Text('资讯'),
13
-          leading: Icon(Icons.arrow_back_ios),
14
-          // backgroundColor: Colors.transparent,
15
-          centerTitle: true,
16
-        ),
17
-        body: Container(
18
-          padding: EdgeInsets.fromLTRB(15, 30, 15, 50),
19
-
20
-          child: Column(
21
-            children: [
22
-              Container(
23
-                alignment: Alignment.center,
24
-                child:  Row(
25
-                  mainAxisAlignment: MainAxisAlignment.center,
26
-                  children: [
27
-                    Image(image: AssetImage('images/icons/decorate.png'),width: 17,),
28
-                    Text('我是22222222222标题',
29
-                    style: TextStyle(
30
-                      fontSize: 17.sp,
31
-                      fontWeight: FontWeight.bold,
32
-
33
-                    ),
34
-                    ),
35
-                    Image(image: AssetImage('images/icons/decorate.png'),width: 17),
36
-
37
-                  ],
38
-                ),
39
-              ),
40
-              Container(
41
-                padding: EdgeInsets.fromLTRB(0, 20, 0, 10),
42
-                width: 344.w,
43
-                child: Text('gr一年之计在于春,连日来,农业生产工作正在热火朝天的进行着:农技人员走村串户指导农户春耕生产,大型拖拉机忙着翻垦农田,植保无人机 ',
44
-                style: TextStyle(
45
-                  fontSize: 14.sp
46
-                ),
47
-                ) ,
48
-              ),
49
-              Container(
50
-                padding: EdgeInsets.fromLTRB(0, 10, 0,10),
51
-                child: Image(image: AssetImage('images/cars.png'),width:320.w,height:260.w,fit: BoxFit.fill,),
52
-              )
53
-            ],
54
-          ),
55
-        ),
56
-    );
57
-
58
-  }
59
-}

+ 0
- 141
lib/pages/Information/index.dart View File

@@ -1,141 +0,0 @@
1
-import 'package:flutter/material.dart';
2
-import 'package:flutter_screenutil/flutter_screenutil.dart';
3
-import 'package:get/get.dart';
4
-import 'package:get/get_core/src/get_main.dart';
5
-
6
-class Information extends StatefulWidget {
7
-  const Information({Key? key}) : super(key: key);
8
-
9
-  @override
10
-  State<Information> createState() => _InformationState();
11
-}
12
-
13
-class _InformationState extends State<Information> {
14
-  @override
15
-  Widget build(BuildContext context) {
16
-    return Scaffold(
17
-      resizeToAvoidBottomInset: false,
18
-      appBar: AppBar(
19
-        title: Text('资讯'),
20
-        leading: Icon(Icons.arrow_back_ios),
21
-        // backgroundColor: Colors.transparent,
22
-        centerTitle: true,
23
-      ),
24
-      body: ListView(
25
-        children: [
26
-          // ListTile用不好
27
-
28
-          GestureDetector(
29
-            child:
30
-            Container(
31
-                padding: EdgeInsets.fromLTRB(0, 30, 0, 30),
32
-                width: 310.w,
33
-                decoration: const BoxDecoration(
34
-                    border:Border(
35
-                        bottom:
36
-                        BorderSide(width: 0.5, color: Color(0x20000000)
37
-                          // 0x17000000
38
-                        ))
39
-                ),
40
-                child: Row(
41
-                  children: [
42
-                    Container(
43
-                      margin: EdgeInsets.fromLTRB(15, 0, 11, 0),
44
-                      width: 100,
45
-                      height: 100,
46
-                      decoration: BoxDecoration(
47
-                        image:  DecorationImage(
48
-                          image: AssetImage('images/cars.png'),
49
-                          fit: BoxFit.cover,
50
-                        ),
51
-
52
-                        borderRadius: BorderRadius.circular(12),
53
-                      ),
54
-                    )
55
-                    ,
56
-                    Column(
57
-                      crossAxisAlignment: CrossAxisAlignment.start,
58
-                      children: [
59
-                        Container(
60
-                          width: 240.w,
61
-                          padding: EdgeInsets.fromLTRB(0, 0, 0, 30),
62
-                          child: Text("我我就是一个标题,什阿三大苏打333萨达萨达萨达v么特不是",
63
-                              softWrap: true,
64
-                              maxLines: 2,
65
-                              textAlign: TextAlign.left,
66
-                              overflow: TextOverflow.ellipsis,
67
-                              style: TextStyle(
68
-                                fontSize: 17.sp, fontWeight: FontWeight.bold,)),
69
-                        ),
70
-                        Container(
71
-                          child: Text('2022-02-09'),
72
-                        )
73
-                      ],
74
-                    )
75
-                  ],
76
-                )
77
-            ),
78
-            onTap: () {
79
-              Get.toNamed('/ArticleInfo');
80
-            },
81
-          ),
82
-          GestureDetector(
83
-            child:
84
-            Container(
85
-                padding: EdgeInsets.fromLTRB(0, 30, 0, 30),
86
-                width: 310.w,
87
-                decoration: const BoxDecoration(
88
-                    border:Border(
89
-                        bottom:
90
-                        BorderSide(width: 0.5, color: Color(0x20000000)
91
-                          // 0x17000000
92
-                        ))
93
-                ),
94
-                child: Row(
95
-                  children: [
96
-                    Container(
97
-                      margin: EdgeInsets.fromLTRB(15, 0, 11, 0),
98
-                      width: 100,
99
-                      height: 100,
100
-                      decoration: BoxDecoration(
101
-                        image:  DecorationImage(
102
-                          image: AssetImage('images/cars.png'),
103
-                          fit: BoxFit.cover,
104
-                        ),
105
-
106
-                        borderRadius: BorderRadius.circular(12),
107
-                      ),
108
-                    )
109
-                    ,
110
-                    Column(
111
-                      crossAxisAlignment: CrossAxisAlignment.start,
112
-                      children: [
113
-                        Container(
114
-                          width: 240.w,
115
-                          padding: EdgeInsets.fromLTRB(0, 0, 0, 30),
116
-                          child: Text("我我就是一个标题,什阿三大苏打333萨达萨达萨达v么特不是",
117
-                              softWrap: true,
118
-                              maxLines: 2,
119
-                              textAlign: TextAlign.left,
120
-                              overflow: TextOverflow.ellipsis,
121
-                              style: TextStyle(
122
-                                fontSize: 17.sp, fontWeight: FontWeight.bold,)),
123
-                        ),
124
-                        Container(
125
-                          child: Text('2022-02-09'),
126
-                        )
127
-                      ],
128
-                    )
129
-                  ],
130
-                )
131
-            ),
132
-            onTap: () {
133
-              print('进入资讯详情');
134
-            },
135
-          )
136
-
137
-        ],
138
-      ),
139
-    );
140
-  }
141
-}

+ 128
- 10
lib/pages/home/index.dart View File

@@ -1,11 +1,129 @@
1
-
2
-import 'package:flutter/material.dart';
3
-
4
-class Home extends StatelessWidget {
5
-  @override
6
-  Widget build(BuildContext context) {
7
-    // controller.person
8
-    return const Scaffold(body: Text("首页"),);
9
-  }
10
-
1
+
2
+import 'package:farmer_client/pages/home/widgets/Information/index.dart';
3
+import 'package:flutter/material.dart';
4
+import 'package:flutter_screenutil/flutter_screenutil.dart';
5
+import 'package:farmer_client/pages/home/widgets/main/index.dart';
6
+import 'package:farmer_client/pages/home/widgets/order/index.dart';
7
+class Home extends StatefulWidget {
8
+  const Home({Key? key}) : super(key: key);
9
+
10
+  @override
11
+  _Home createState() => _Home();
12
+}
13
+
14
+class _Home extends State<Home> {
15
+  //下标   当前tab
16
+  int _tabIndex = 0;
17
+
18
+  final List _titles = ['首页', '订单', '资讯','我的'];
19
+  final tabTextStyleSelected = TextStyle(
20
+      color: const Color(0xFFFF703B),
21
+      fontSize: 15.sp,
22
+      fontWeight: FontWeight.bold); //选线卡选中字体颜色
23
+  final tabTextStyleNormal = TextStyle(
24
+      color: const Color(0xFF323232),
25
+      fontSize: 15.sp,
26
+      fontWeight: FontWeight.bold); //选项卡未选中字体颜色
27
+
28
+  TextStyle getTabTextStyle(int curIndex) {
29
+    //设置tabbar 选中和未选中的状态文本
30
+    if (curIndex == _tabIndex) {
31
+      return tabTextStyleSelected;
32
+    }
33
+    return tabTextStyleNormal;
34
+  }
35
+
36
+  // 切换底部选项卡,标题的变化设置
37
+  Text getTabTitle(int curIndex) {
38
+    return Text(_titles[curIndex], style: getTabTextStyle(curIndex));
39
+  }
40
+
41
+  List images = [
42
+    ['images/index/HomesOFFImgaes.png', 'images/index/HomesNOImgaes.png'],
43
+    ['images/index/OrdersOFFImgaes.png', 'images/index/OrdersNOImgaes.png'],
44
+    ['images/index/newsONImages.png', 'images/index/newsOFFImages.png'],
45
+    ['images/index/MineOFFImgaes.png', 'images/index/MineNOImgaes.png'],
46
+  ];
47
+  Image getTabIcon(int curIndex) {
48
+    //设置tabbar选中和未选中的状态图标
49
+    if (curIndex == _tabIndex) {
50
+      return Image.asset(
51
+        images[curIndex][1],
52
+        width: 22.w,
53
+        height: 22.w,
54
+      );
55
+    }
56
+    return Image.asset(
57
+      images[curIndex][0],
58
+      width: 22.w,
59
+      height: 22.w,
60
+    );
61
+  }
62
+
63
+  Image getTabImage(path) {
64
+    return Image.asset(path, width: 22.w, height: 22.w);
65
+  }
66
+
67
+  //内容
68
+  var _body = [Text('我是首页'), OrderPage(),Information(), MainPage()];
69
+
70
+  Widget tabBar(index) {
71
+    return GestureDetector(
72
+      behavior: HitTestBehavior.opaque,
73
+      onTap: () {
74
+        setState(() {
75
+          _tabIndex = index;
76
+        });
77
+      },
78
+      child: Container(
79
+        width: 93.w,
80
+        height: 65.h,
81
+        child: Column(
82
+          children: [
83
+            getTabIcon(index),
84
+            Padding(
85
+              padding: EdgeInsets.fromLTRB(0, 6.h, 0, 0),
86
+              child: getTabTitle(index),
87
+            )
88
+          ],
89
+        ),
90
+      ),
91
+    );
92
+  }
93
+
94
+  @override
95
+  Widget build(BuildContext context) {
96
+    return Scaffold(
97
+      appBar: AppBar(
98
+        elevation: 0,
99
+        centerTitle: true,
100
+        backgroundColor: Colors.white,
101
+        title: Text(
102
+          _titles[_tabIndex],
103
+          style: TextStyle(
104
+              color: Colors.black,
105
+              fontSize: 17.sp,
106
+              letterSpacing: 2,
107
+              fontWeight: FontWeight.bold),
108
+        ),
109
+      ),
110
+      body: _body[_tabIndex],
111
+      bottomNavigationBar: Container(
112
+        padding: EdgeInsets.fromLTRB(0, 7.h, 0, 7.h),
113
+        decoration: BoxDecoration(
114
+          color: const Color(0xFFFFFFFF),
115
+          boxShadow: [
116
+            BoxShadow(
117
+              color: const Color(0x14000000),
118
+              offset: Offset(0, -2.w),
119
+              blurRadius: 3.w,
120
+            ),
121
+          ],
122
+        ),
123
+        child: Row(
124
+          children:_titles.asMap().keys.map((index) =>tabBar(index)).toList(),
125
+        ),
126
+      ),
127
+    );
128
+  }
11 129
 }

+ 123
- 0
lib/pages/home/widgets/Information/index.dart View File

@@ -0,0 +1,123 @@
1
+import 'package:flutter/material.dart';
2
+import 'package:flutter_screenutil/flutter_screenutil.dart';
3
+import 'package:get/get.dart';
4
+import 'package:get/get_core/src/get_main.dart';
5
+
6
+class Information extends StatefulWidget {
7
+  const Information({Key? key}) : super(key: key);
8
+
9
+  @override
10
+  State<Information> createState() => _InformationState();
11
+}
12
+
13
+class _InformationState extends State<Information> {
14
+  @override
15
+  Widget build(BuildContext context) {
16
+    return ListView(
17
+      children: [
18
+        // ListTile用不好
19
+
20
+        GestureDetector(
21
+          child: Container(
22
+              padding: EdgeInsets.fromLTRB(0, 30, 0, 30),
23
+              width: 310.w,
24
+              decoration: const BoxDecoration(
25
+                  border: Border(
26
+                      bottom: BorderSide(width: 0.5, color: Color(0x20000000)
27
+                          // 0x17000000
28
+                          ))),
29
+              child: Row(
30
+                children: [
31
+                  Container(
32
+                    margin: EdgeInsets.fromLTRB(15, 0, 11, 0),
33
+                    width: 100,
34
+                    height: 100,
35
+                    decoration: BoxDecoration(
36
+                      image: DecorationImage(
37
+                        image: AssetImage('images/cars.png'),
38
+                        fit: BoxFit.cover,
39
+                      ),
40
+                      borderRadius: BorderRadius.circular(12),
41
+                    ),
42
+                  ),
43
+                  Column(
44
+                    crossAxisAlignment: CrossAxisAlignment.start,
45
+                    children: [
46
+                      Container(
47
+                        width: 240.w,
48
+                        padding: EdgeInsets.fromLTRB(0, 0, 0, 30),
49
+                        child: Text("我我就是一个标题,什阿三大苏打333萨达萨达萨达v么特不是",
50
+                            softWrap: true,
51
+                            maxLines: 2,
52
+                            textAlign: TextAlign.left,
53
+                            overflow: TextOverflow.ellipsis,
54
+                            style: TextStyle(
55
+                              fontSize: 17.sp,
56
+                              fontWeight: FontWeight.bold,
57
+                            )),
58
+                      ),
59
+                      Container(
60
+                        child: Text('2022-02-09'),
61
+                      )
62
+                    ],
63
+                  )
64
+                ],
65
+              )),
66
+          onTap: () {
67
+            Get.toNamed('/ArticleInfo');
68
+          },
69
+        ),
70
+        GestureDetector(
71
+          child: Container(
72
+              padding: EdgeInsets.fromLTRB(0, 30, 0, 30),
73
+              width: 310.w,
74
+              decoration: const BoxDecoration(
75
+                  border: Border(
76
+                      bottom: BorderSide(width: 0.5, color: Color(0x20000000)
77
+                          // 0x17000000
78
+                          ))),
79
+              child: Row(
80
+                children: [
81
+                  Container(
82
+                    margin: EdgeInsets.fromLTRB(15, 0, 11, 0),
83
+                    width: 100,
84
+                    height: 100,
85
+                    decoration: BoxDecoration(
86
+                      image: DecorationImage(
87
+                        image: AssetImage('images/cars.png'),
88
+                        fit: BoxFit.cover,
89
+                      ),
90
+                      borderRadius: BorderRadius.circular(12),
91
+                    ),
92
+                  ),
93
+                  Column(
94
+                    crossAxisAlignment: CrossAxisAlignment.start,
95
+                    children: [
96
+                      Container(
97
+                        width: 240.w,
98
+                        padding: EdgeInsets.fromLTRB(0, 0, 0, 30),
99
+                        child: Text("我我就是一个标题,什阿三大苏打333萨达萨达萨达v么特不是",
100
+                            softWrap: true,
101
+                            maxLines: 2,
102
+                            textAlign: TextAlign.left,
103
+                            overflow: TextOverflow.ellipsis,
104
+                            style: TextStyle(
105
+                              fontSize: 17.sp,
106
+                              fontWeight: FontWeight.bold,
107
+                            )),
108
+                      ),
109
+                      Container(
110
+                        child: Text('2022-02-09'),
111
+                      )
112
+                    ],
113
+                  )
114
+                ],
115
+              )),
116
+          onTap: () {
117
+            print('进入资讯详情');
118
+          },
119
+        )
120
+      ],
121
+    );
122
+  }
123
+}

+ 72
- 0
lib/pages/home/widgets/main/index.dart View File

@@ -0,0 +1,72 @@
1
+import './widgets/OtherColumn.dart';
2
+import './widgets/UserAddress.dart';
3
+import './widgets/UserInfo.dart';
4
+import 'package:flutter/material.dart';
5
+import 'package:flutter_screenutil/flutter_screenutil.dart';
6
+
7
+class MainPage extends StatefulWidget {
8
+  const MainPage({Key? key}) : super(key: key);
9
+
10
+  @override
11
+  State<MainPage> createState() => _MainPageState();
12
+}
13
+
14
+class _MainPageState extends State<MainPage> {
15
+  @override
16
+  Widget build(BuildContext context) {
17
+    return Container(
18
+      alignment: Alignment.center,
19
+      child: ListView(
20
+        children: [
21
+          Column(
22
+            children: [
23
+              UserInfo(), //头部,头像手机号姓名
24
+              UserAddress(), //用户地址
25
+              OtherColumn(), //功能菜单栏
26
+              Container(
27
+                height: 70.h,
28
+                margin: EdgeInsets.only(top: 0, bottom: 40.0),
29
+                alignment: Alignment.bottomCenter,
30
+                decoration: BoxDecoration(
31
+                  boxShadow: [
32
+                    BoxShadow(
33
+                      blurRadius: 10, //阴影范围
34
+                      spreadRadius: 0.1, //阴影浓度
35
+                      color: Colors.grey.withOpacity(0.2), //阴影颜色
36
+                    ),
37
+                  ],
38
+                ),
39
+                child: SizedBox(
40
+                  width: 315.w,
41
+                  height: 49.h,
42
+                  child: ElevatedButton(
43
+                    onPressed: () {
44
+                      // _handelSubmit();
45
+                      print('用户点击了支付啊阿松大撒地方');
46
+                    },
47
+                    child: const Text(
48
+                      "退出登陆",
49
+                      style: TextStyle(
50
+                          fontSize: 18,
51
+                          color: Colors.black,
52
+                          fontWeight: FontWeight.bold),
53
+                    ),
54
+                    style: ButtonStyle(
55
+                      elevation: MaterialStateProperty.all(0),
56
+                      backgroundColor:
57
+                          MaterialStateProperty.all(const Color(0xFFFFFFFF)),
58
+                      shape: MaterialStateProperty.all(
59
+                          const RoundedRectangleBorder(
60
+                              borderRadius:
61
+                                  BorderRadius.all(Radius.circular(24.4)))),
62
+                    ),
63
+                  ),
64
+                ),
65
+              ),
66
+            ],
67
+          ),
68
+        ],
69
+      ),
70
+    );
71
+  }
72
+}

lib/pages/main/widgets/OtherColumn.dart → lib/pages/home/widgets/main/widgets/OtherColumn.dart View File

@@ -34,7 +34,7 @@ class OtherColumn extends StatelessWidget {
34 34
                 child: Padding(
35 35
                   padding: EdgeInsets.fromLTRB(12.w, 0, 0, 0),
36 36
                   child: Text(
37
-                    '地址信息',
37
+                    '设置',
38 38
                     style: TextStyle(
39 39
                       color: Color(0xff333333),
40 40
                       fontWeight: FontWeight.bold,

lib/pages/main/widgets/UserAddress.dart → lib/pages/home/widgets/main/widgets/UserAddress.dart View File

@@ -1,5 +1,6 @@
1 1
 import 'package:flutter/material.dart';
2 2
 import 'package:flutter_screenutil/flutter_screenutil.dart';
3
+import 'package:get/get.dart';
3 4
 
4 5
 class UserAddress extends StatelessWidget {
5 6
   const UserAddress({Key? key}) : super(key: key);
@@ -43,23 +44,23 @@ class UserAddress extends StatelessWidget {
43 44
                     ),
44 45
                   ),
45 46
                 )),
46
-            Row(
47
-              mainAxisAlignment: MainAxisAlignment.spaceBetween,
48
-              children: [
49
-                Container(
50
-                  child: Row(
51
-                    mainAxisAlignment: MainAxisAlignment.spaceBetween,
52
-                    children: [
53
-                      Padding(
54
-                        padding: EdgeInsets.fromLTRB(17.w, 0, 10.w, 0),
55
-                        child: Image(
56
-                          image: AssetImage('images/gpsImgae.png'),
57
-                          width: 12.w,
47
+            GestureDetector(
48
+              child: Row(
49
+                mainAxisAlignment: MainAxisAlignment.spaceBetween,
50
+                children: [
51
+                  Container(
52
+                    child: Row(
53
+                      mainAxisAlignment: MainAxisAlignment.spaceBetween,
54
+                      children: [
55
+                        Padding(
56
+                          padding: EdgeInsets.fromLTRB(17.w, 0, 10.w, 0),
57
+                          child: Image(
58
+                            image: AssetImage('images/gpsImgae.png'),
59
+                            width: 12.w,
60
+                          ),
58 61
                         ),
59
-                      ),
60
-                      Container(
61
-                        width: 260,
62
-                        child: GestureDetector(
62
+                        Container(
63
+                          width: 260,
63 64
                           child: Text(
64 65
                             '请填写详细地址请填写详细地址请填写详细地址',
65 66
                             softWrap: true,
@@ -71,26 +72,26 @@ class UserAddress extends StatelessWidget {
71 72
                               fontSize: 17,
72 73
                             ),
73 74
                           ),
74
-                          onTap: () {
75
-                            print('修改地址');
76
-                          },
77 75
                         ),
78
-                      )
79
-                    ],
76
+                      ],
77
+                    ),
80 78
                   ),
81
-                ),
82
-                Container(
83
-                  alignment: Alignment.center,
84
-                  padding: EdgeInsets.fromLTRB(0, 0, 30.w, 0),
85
-                  child: Text(
86
-                    '>>',
87
-                    style: TextStyle(
88
-                      fontWeight: FontWeight.bold,
89
-                      fontSize: 17,
79
+                  Container(
80
+                    alignment: Alignment.center,
81
+                    padding: EdgeInsets.fromLTRB(0, 0, 30.w, 0),
82
+                    child: Text(
83
+                      '>>',
84
+                      style: TextStyle(
85
+                        fontWeight: FontWeight.bold,
86
+                        fontSize: 17,
87
+                      ),
90 88
                     ),
91 89
                   ),
92
-                ),
93
-              ],
90
+                ],
91
+              ),
92
+              onTap: () {
93
+                Get.toNamed("/addressList");
94
+              },
94 95
             ),
95 96
           ],
96 97
         ));

lib/pages/main/widgets/UserInfo.dart → lib/pages/home/widgets/main/widgets/UserInfo.dart View File


lib/pages/order/index.dart → lib/pages/home/widgets/order/index.dart View File

@@ -1,7 +1,7 @@
1
+import 'package:farmer_client/widgets/OrderInfoCard.dart';
1 2
 import 'package:flutter/material.dart';
2 3
 import 'package:flutter_screenutil/flutter_screenutil.dart';
3 4
 
4
-import '../../widgets/OrderInfoCard.dart';
5 5
 
6 6
 
7 7
 
@@ -17,22 +17,12 @@ class OrderPage extends StatefulWidget {
17 17
 class _OrderPageState extends State<OrderPage> {
18 18
   @override
19 19
   Widget build(BuildContext context) {
20
-    return Scaffold(
21
-      resizeToAvoidBottomInset: false,
22
-      appBar:  AppBar(
23
-        title:  Text('订单'),
24
-        leading:  Icon(Icons.arrow_back_ios),
25
-        backgroundColor: Color(0xff2b9270),
26
-        // backgroundColor: Colors.transparent,
27
-        centerTitle: true,
28
-
29
-      ),
30
-      body:      Column(
20
+    return Column(
31 21
         children: [
32 22
           OrderInfoCard(),
33 23
 
34 24
           Container(
35
-            height: 130.h,
25
+            height: 80.h,
36 26
             margin: EdgeInsets.only(top: 20.0, bottom: 0.0),
37 27
             alignment: Alignment.bottomCenter,
38 28
             child: SizedBox(
@@ -63,7 +53,6 @@ class _OrderPageState extends State<OrderPage> {
63 53
             ),
64 54
           ),
65 55
         ],
66
-      ),
67 56
     );
68 57
 
69 58
   }

+ 0
- 86
lib/pages/main/index.dart View File

@@ -1,86 +0,0 @@
1
-import 'package:farmer_client/pages/main/widgets/OtherColumn.dart';
2
-import 'package:farmer_client/pages/main/widgets/UserAddress.dart';
3
-import 'package:farmer_client/pages/main/widgets/UserInfo.dart';
4
-import 'package:flutter/material.dart';
5
-import 'package:flutter_screenutil/flutter_screenutil.dart';
6
-
7
-
8
-class MainPage extends StatefulWidget {
9
-  const MainPage({Key? key}) : super(key: key);
10
-
11
-  @override
12
-  State<MainPage> createState() => _MainPageState();
13
-}
14
-
15
-class _MainPageState extends State<MainPage> {
16
-  @override
17
-  Widget build(BuildContext context) {
18
-    return Scaffold(
19
-      resizeToAvoidBottomInset: false,
20
-      appBar:  AppBar(
21
-        title:  Text('我的'),
22
-        leading:  Icon(Icons.arrow_back_ios),
23
-        // backgroundColor: Colors.transparent,
24
-        centerTitle: true,
25
-
26
-      ),
27
-      body:Container(
28
-        alignment: Alignment.center,
29
-        child:   ListView(
30
-          children: [
31
-            Column(
32
-              children: [
33
-                UserInfo(),//头部,头像手机号姓名
34
-                UserAddress(),//用户地址
35
-                OtherColumn(),//功能菜单栏
36
-                Container(
37
-                  height: 70.h,
38
-                  margin: EdgeInsets.only(top: 0, bottom: 40.0),
39
-                  alignment: Alignment.bottomCenter,
40
-                  decoration:  BoxDecoration(
41
-                    boxShadow: [
42
-                      BoxShadow(
43
-                        blurRadius: 10, //阴影范围
44
-                        spreadRadius: 0.1, //阴影浓度
45
-                        color: Colors.grey.withOpacity(0.2), //阴影颜色
46
-                      ),
47
-                    ],
48
-                  ),
49
-                  child: SizedBox(
50
-                    width: 315.w,
51
-                    height: 49.h,
52
-                    child: ElevatedButton(
53
-                      onPressed: () {
54
-                        // _handelSubmit();
55
-                        print('用户点击了支付啊阿松大撒地方');
56
-                      },
57
-                      child: const Text(
58
-                        "退出登陆",
59
-                        style: TextStyle(
60
-                            fontSize: 18,
61
-                            color: Colors.black,
62
-                            fontWeight: FontWeight.bold),
63
-                      ),
64
-                      style: ButtonStyle(
65
-                        elevation: MaterialStateProperty.all(0),
66
-                        backgroundColor:
67
-                        MaterialStateProperty.all(const Color(0xFFFFFFFF)),
68
-                        shape: MaterialStateProperty.all(
69
-                            const RoundedRectangleBorder(
70
-                                borderRadius:
71
-                                BorderRadius.all(Radius.circular(24.4)))),
72
-                      ),
73
-                    ),
74
-                  ),
75
-                ),
76
-              ],
77
-            ),
78
-          ],
79
-        )
80
-
81
-      )
82
-
83
-
84
-    );
85
-  }
86
-}

+ 56
- 16
lib/pages/splash/splash.dart View File

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

+ 47
- 45
lib/pages/splash/widgets/countdown.dart View File

@@ -1,45 +1,47 @@
1
-
2
-import 'dart:async';
3
-
4
-import 'package:farmer_client/utils/timer.dart';
5
-import 'package:flutter/widgets.dart';
6
-import 'package:get/get.dart';
7
-
8
-// Widget countdown(void Function() onFinish) {
9
-//   int _countdown = 3;
10
-//   late StateSetter _update;
11
-//   late Timer _timer;
12
-//   _timer = setInterval((_) {
13
-//     if (_countdown <= 1) {
14
-//       _timer.cancel();
15
-//       onFinish();
16
-//       return;
17
-//     }
18
-//
19
-//     _update((){
20
-//       _countdown -= 1;
21
-//     });
22
-//   }, 1000);
23
-//
24
-//   return StatefulBuilder(builder: (context, setState) {
25
-//     _update = setState;
26
-//     return Text(_countdown.toString());
27
-//   });
28
-// }
29
-
30
-Widget countdown(int sec, void Function() onFinish) {
31
-  var _countdown = Rx<int>(sec);
32
-
33
-  late Timer _timer;
34
-  _timer = setInterval((_) {
35
-    if (_countdown.value <= 1) {
36
-      _timer.cancel();
37
-      onFinish();
38
-      return;
39
-    }
40
-
41
-    _countdown.value -= 1;
42
-  }, 1000);
43
-
44
-  return Obx(() =>Text(_countdown.value.toString()));
45
-}
1
+
2
+import 'dart:async';
3
+
4
+import 'package:farmer_client/utils/timer.dart';
5
+import 'package:flutter/widgets.dart';
6
+import 'package:get/get.dart';
7
+import 'package:flutter_screenutil/flutter_screenutil.dart';
8
+
9
+Widget countdown(int sec, void Function() onFinish) {
10
+  var _countdown = Rx<int>(sec);
11
+
12
+  late Timer _timer;
13
+  _timer = setInterval((_) {
14
+    if (_countdown.value <= 1) {
15
+      _timer.cancel();
16
+      onFinish();
17
+      return;
18
+    }
19
+    _countdown.value -= 1;
20
+  }, 1000);
21
+
22
+  return Obx(
23
+        () => GestureDetector(
24
+      onTap: () {
25
+        _timer.cancel();
26
+        // return;
27
+        // onFinish();
28
+      },
29
+      child: Container(
30
+        width: 50.w,
31
+        height: 30.h,
32
+        alignment: const Alignment(0, 0),
33
+        decoration: const BoxDecoration(
34
+            borderRadius: BorderRadius.all(Radius.circular(20)),
35
+            color: Color(0x77222222)),
36
+        child: Text(
37
+          _countdown.value.toString() + '跳过',
38
+          style: TextStyle(
39
+            fontSize: 13.sp,
40
+            letterSpacing: 2,
41
+            color: const Color(0xFFFFFFFF),
42
+          ),
43
+        ),
44
+      ),
45
+    ),
46
+  );
47
+}