张延森 3 лет назад
Родитель
Сommit
fc5ebb51e8
57 измененных файлов: 1664 добавлений и 418 удалений
  1. Двоичные данные
      images/icons/ListBack.png
  2. Двоичные данные
      images/icons/cancel.png
  3. Двоичные данные
      images/icons/decorate.png
  4. Двоичные данные
      images/icons/delete.png
  5. Двоичные данные
      images/icons/edit.png
  6. Двоичные данные
      images/icons/goback.png
  7. Двоичные данные
      images/icons/goback_white.png
  8. Двоичные данные
      images/icons/home.png
  9. Двоичные данные
      images/icons/home_white.png
  10. Двоичные данные
      images/icons/locationImage.png
  11. Двоичные данные
      images/icons/scoreOFF.png
  12. Двоичные данные
      images/icons/scoreON.png
  13. Двоичные данные
      images/icons/starOff.png
  14. Двоичные данные
      images/icons/starOn.png
  15. Двоичные данные
      images/icons/timeImage.png
  16. 0
    0
      images/index/HomesNOImgaes.png
  17. 0
    0
      images/index/HomesOFFImgaes.png
  18. 0
    0
      images/index/MineNOImgaes.png
  19. 0
    0
      images/index/MineOFFImgaes.png
  20. 0
    0
      images/index/OrdersNOImgaes.png
  21. 0
    0
      images/index/OrdersOFFImgaes.png
  22. 0
    0
      images/index/newsOFFImages.png
  23. 0
    0
      images/index/newsONImages.png
  24. Двоичные данные
      images/logo.png
  25. Двоичные данные
      images/ordersListImga.png
  26. Двоичные данные
      images/splash.png
  27. 17
    0
      lib/main.dart
  28. 14
    0
      lib/models/entities/Address.dart
  29. 59
    0
      lib/pages/ArticleInfo/ArticleInfo.dart
  30. 267
    0
      lib/pages/OrderConfirmation/index.dart
  31. 0
    0
      lib/pages/OrderConfirmation/widgets/timeDatePicker.dart
  32. 131
    0
      lib/pages/TabBar/index.dart
  33. 123
    0
      lib/pages/TabBar/widgets/Information/index.dart
  34. 72
    0
      lib/pages/TabBar/widgets/main/index.dart
  35. 155
    0
      lib/pages/TabBar/widgets/main/widgets/OtherColumn.dart
  36. 33
    32
      lib/pages/TabBar/widgets/main/widgets/UserAddress.dart
  37. 4
    1
      lib/pages/TabBar/widgets/main/widgets/UserInfo.dart
  38. 62
    0
      lib/pages/TabBar/widgets/order/index.dart
  39. 110
    0
      lib/pages/addAddress/index.dart
  40. 127
    0
      lib/pages/addressList/index.dart
  41. 153
    0
      lib/pages/addressList/widget/AddressCard.dart
  42. 0
    11
      lib/pages/home/index.dart
  43. 0
    109
      lib/pages/home2.dart
  44. 2
    2
      lib/pages/index.dart
  45. 45
    44
      lib/pages/login/login.dart
  46. 0
    40
      lib/pages/main/index.dart
  47. 0
    97
      lib/pages/main/widgets/OtherColumn.dart
  48. 4
    4
      lib/pages/orderInfo/index.dart
  49. 57
    16
      lib/pages/splash/splash.dart
  50. 39
    45
      lib/pages/splash/widgets/countdown.dart
  51. 127
    0
      lib/pages/userInfo/index.dart
  52. 14
    4
      lib/routes/pages.dart
  53. 5
    0
      lib/widgets/CarsCard.dart
  54. 9
    4
      lib/widgets/DefaultButton.dart
  55. 1
    0
      lib/widgets/OrderListCard.dart
  56. 12
    0
      pubspec.lock
  57. 22
    9
      pubspec.yaml

Двоичные данные
images/icons/ListBack.png Просмотреть файл


Двоичные данные
images/icons/cancel.png Просмотреть файл


Двоичные данные
images/icons/decorate.png Просмотреть файл


Двоичные данные
images/icons/delete.png Просмотреть файл


Двоичные данные
images/icons/edit.png Просмотреть файл


Двоичные данные
images/icons/goback.png Просмотреть файл


Двоичные данные
images/icons/goback_white.png Просмотреть файл


Двоичные данные
images/icons/home.png Просмотреть файл


Двоичные данные
images/icons/home_white.png Просмотреть файл


Двоичные данные
images/icons/locationImage.png Просмотреть файл


Двоичные данные
images/icons/scoreOFF.png Просмотреть файл


Двоичные данные
images/icons/scoreON.png Просмотреть файл


Двоичные данные
images/icons/starOff.png Просмотреть файл


Двоичные данные
images/icons/starOn.png Просмотреть файл


Двоичные данные
images/icons/timeImage.png Просмотреть файл


images/HomesNOImgaes.png → images/index/HomesNOImgaes.png Просмотреть файл


images/HomesOFFImgaes.png → images/index/HomesOFFImgaes.png Просмотреть файл


images/MineNOImgaes.png → images/index/MineNOImgaes.png Просмотреть файл


images/MineOFFImgaes.png → images/index/MineOFFImgaes.png Просмотреть файл


images/OrdersNOImgaes.png → images/index/OrdersNOImgaes.png Просмотреть файл


images/OrdersOFFImgaes.png → images/index/OrdersOFFImgaes.png Просмотреть файл


images/newsOFFImages.png → images/index/newsOFFImages.png Просмотреть файл


images/newsONImages.png → images/index/newsONImages.png Просмотреть файл


Двоичные данные
images/logo.png Просмотреть файл


Двоичные данные
images/ordersListImga.png Просмотреть файл


Двоичные данные
images/splash.png Просмотреть файл


+ 17
- 0
lib/main.dart Просмотреть файл

@@ -5,21 +5,27 @@ import 'package:get/get.dart';
5 5
 import 'package:get_storage/get_storage.dart';
6 6
 import 'package:flutter_screenutil/flutter_screenutil.dart';
7 7
 
8
+import 'package:flutter_localizations/flutter_localizations.dart';
9
+
8 10
 import 'models/index.dart';
9 11
 import 'routes/index.dart';
10 12
 
11 13
 void main() async {
12 14
   await GetStorage.init();
13 15
 
16
+
14 17
   runApp(const MyApp());
15 18
 }
16 19
 
17 20
 class MyApp extends StatelessWidget {
18 21
   const MyApp({Key? key}) : super(key: key);
19 22
 
23
+
24
+
20 25
   // This widget is the root of your application.
21 26
   @override
22 27
   Widget build(BuildContext context) {
28
+
23 29
     GetStorage box = GetStorage();
24 30
 
25 31
     return ScreenUtilInit(
@@ -28,12 +34,23 @@ class MyApp extends StatelessWidget {
28 34
       splitScreenMode: true,
29 35
       builder: (_) {
30 36
         return GetMaterialApp(
37
+          localizationsDelegates: const [
38
+            GlobalMaterialLocalizations.delegate,
39
+            GlobalWidgetsLocalizations.delegate,
40
+            GlobalCupertinoLocalizations.delegate,
41
+          ],
42
+          supportedLocales: [
43
+            Locale('zh', ''),
44
+            Locale('en', ''),
45
+          ],
46
+
31 47
           theme: getTheme(),
32 48
           initialRoute: '/splash',
33 49
           defaultTransition: Transition.native,
34 50
           routingCallback: routingCallback,
35 51
           initialBinding: AppBindings(),
36 52
           getPages: pages,
53
+
37 54
         );
38 55
       },
39 56
     );

+ 14
- 0
lib/models/entities/Address.dart Просмотреть файл

@@ -0,0 +1,14 @@
1
+class Address {
2
+  String? address;
3
+  bool? isDefault;
4
+  Address();
5
+
6
+  Address.fromJson(Map<String, dynamic> json)
7
+      : address = json["address"],
8
+        isDefault = json["isDefault"];
9
+
10
+  Map<String, dynamic> toJson() => {
11
+        'address': address,
12
+        'isDefault': isDefault,
13
+      };
14
+}

+ 59
- 0
lib/pages/ArticleInfo/ArticleInfo.dart Просмотреть файл

@@ -0,0 +1,59 @@
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
+}

+ 267
- 0
lib/pages/OrderConfirmation/index.dart Просмотреть файл

@@ -0,0 +1,267 @@
1
+import 'package:farmer_client/pages/OrderConfirmation/widgets/timeDatePicker.dart';
2
+import 'package:flutter/cupertino.dart';
3
+import 'package:flutter/material.dart';
4
+import 'package:flutter/services.dart';
5
+import 'package:flutter_screenutil/flutter_screenutil.dart';
6
+import 'package:get/get.dart';
7
+import 'package:intl/intl.dart';
8
+
9
+class OrderConfirmation extends StatefulWidget {
10
+  const OrderConfirmation({Key? key}) : super(key: key);
11
+
12
+  @override
13
+  State<OrderConfirmation> createState() => _OrderConfirmationState();
14
+}
15
+
16
+class _OrderConfirmationState extends State<OrderConfirmation> {
17
+  TextEditingController _unameController = TextEditingController();
18
+  TextEditingController _pwdController = TextEditingController();
19
+  GlobalKey _formKey = GlobalKey<FormState>();
20
+
21
+  var selectDate; //选择的时间
22
+  var workingArea;
23
+
24
+
25
+//  20:59:59
26
+
27
+  @override
28
+  Widget build(BuildContext context) {
29
+    return Scaffold(
30
+      resizeToAvoidBottomInset: false,
31
+      appBar: AppBar(
32
+        elevation: 0,
33
+        centerTitle: true,
34
+        backgroundColor: Colors.white,
35
+        title: Text(
36
+          '预约',
37
+          style: TextStyle(
38
+              color: Colors.black,
39
+              fontSize: 17.sp,
40
+              letterSpacing: 2,
41
+              fontWeight: FontWeight.bold),
42
+        ),
43
+      ),
44
+      body: Form(
45
+        key: _formKey, //设置globalKey,用于后面获取FormState
46
+        autovalidateMode: AutovalidateMode.onUserInteraction,
47
+        child: Column(
48
+          children: <Widget>[
49
+            Container(
50
+              margin: EdgeInsets.fromLTRB(15, 20, 0, 0),
51
+              alignment: Alignment.topLeft,
52
+              child: Text(
53
+                '作业面积/公顷',
54
+                style: TextStyle(
55
+                    color: Color(0xff222222),
56
+                    fontSize: 17.sp,
57
+                    fontWeight: FontWeight.bold),
58
+              ),
59
+            ),
60
+            TextFormField(
61
+              // autofocus: true,
62
+              keyboardType: TextInputType.number,
63
+              controller: _unameController,
64
+              decoration: const InputDecoration(
65
+                isCollapsed: true,
66
+                contentPadding:
67
+                    EdgeInsets.symmetric(vertical: 8, horizontal: 16),
68
+                counterText: '', //去掉计数
69
+                ///   UnderlineInputBorder 只有下边框  默认使用的就是下边框
70
+                border: UnderlineInputBorder(
71
+                  borderRadius: BorderRadius.all(Radius.circular(10)),
72
+                  borderSide: BorderSide(
73
+                    color: Color(0x30000000),
74
+                    width: 2.0,
75
+                  ),
76
+                ),
77
+                floatingLabelBehavior: FloatingLabelBehavior.never,
78
+                hintText: "请输入具体面积(公顷)",
79
+              ),
80
+              onChanged: (e){
81
+                setState(() {
82
+                  workingArea=e;
83
+                });
84
+              },
85
+              // 校验用户名
86
+              validator: (v) {
87
+                return v!.trim().isNotEmpty ? null : "作业面积/公顷不能为空";
88
+              },
89
+            ),
90
+            Container(
91
+              margin: EdgeInsets.fromLTRB(15, 20, 0, 0),
92
+              alignment: Alignment.topLeft,
93
+              child: Text(
94
+                '作业时间:',
95
+                style: TextStyle(
96
+                    color: Color(0xff222222),
97
+                    fontSize: 17.sp,
98
+                    fontWeight: FontWeight.bold),
99
+              ),
100
+            ),
101
+            Container(
102
+                width: 345.w,
103
+                padding: EdgeInsets.fromLTRB(0, 15, 0, 15),
104
+                decoration: const BoxDecoration(
105
+                  border: Border(
106
+                      bottom: BorderSide(width: 1, color: Color(0x20000000)
107
+                          // 0x17000000
108
+                          )),
109
+                ),
110
+                child: Row(
111
+                  children: [
112
+                    Image(
113
+                      image: AssetImage('images/icons/timeImage.png'),
114
+                      fit: BoxFit.cover,
115
+                      width: 18.w,
116
+                      height: 18.w,
117
+                    ),
118
+                    Padding(
119
+                      padding: EdgeInsets.fromLTRB(10, 0, 0, 0),
120
+                      child: GestureDetector(
121
+                        onTap: () async {
122
+                          var handleChnage = await showDatePicker(
123
+                            context: context,
124
+                            helpText: '请选择作业开始时间',
125
+                            cancelText: '取消',
126
+                            confirmText: '确定',
127
+                            initialDate: selectDate == null
128
+                                ? DateTime.now()
129
+                                : selectDate,
130
+                            firstDate: DateTime.now(),
131
+                            lastDate: DateTime(2030),
132
+                          );
133
+                          setState(() {
134
+                            selectDate = handleChnage;
135
+                            print('${selectDate}+');
136
+                          });
137
+                        },
138
+                        child: Text(selectDate == null
139
+                            ? '请选择日期'
140
+                            : '${DateFormat("yyyy-MM-dd").format(selectDate)}'),
141
+                      ),
142
+                    )
143
+                  ],
144
+                )),
145
+            Container(
146
+              margin: EdgeInsets.fromLTRB(15, 20, 0, 0),
147
+              alignment: Alignment.topLeft,
148
+              child: Text(
149
+                '作业位置:',
150
+                style: TextStyle(
151
+                    color: Color(0xff222222),
152
+                    fontSize: 17.sp,
153
+                    fontWeight: FontWeight.bold),
154
+              ),
155
+            ),
156
+            Container(
157
+              width: 345.w,
158
+              padding: EdgeInsets.fromLTRB(0, 15, 0, 15),
159
+              decoration: BoxDecoration(
160
+                border: Border(
161
+                    bottom: BorderSide(width: 1, color: Color(0x20000000)
162
+                        // 0x17000000
163
+                        )),
164
+              ),
165
+              child: Row(
166
+                mainAxisAlignment: MainAxisAlignment.start,
167
+                children: [
168
+                  Image(
169
+                    image: AssetImage('images/gpsImgae.png'),
170
+                    fit: BoxFit.cover,
171
+                    width: 14.w,
172
+                    height: 17.h,
173
+                  ),
174
+                  Padding(
175
+                      padding: EdgeInsets.fromLTRB(10, 0, 0, 0),
176
+                      child: GestureDetector(
177
+                        onTap: () {},
178
+                        child: Container(
179
+                          width: 290.w,
180
+                          child: Text(
181
+                            '请选择详细地址',
182
+                            softWrap: true,
183
+                            maxLines: 1,
184
+                            textAlign: TextAlign.left,
185
+                            overflow: TextOverflow.ellipsis,
186
+                          ),
187
+                        ),
188
+                      ))
189
+                ],
190
+              ),
191
+            ),
192
+
193
+            // 登录按钮
194
+            Spacer(),
195
+            Container(
196
+              alignment: Alignment.bottomCenter,
197
+              child: SizedBox(
198
+                width: 315.w,
199
+                height: 49.h,
200
+                child: ElevatedButton(
201
+                  onPressed: () {
202
+                    if ((_formKey.currentState as FormState).validate()) {
203
+                      var a={selectDate,workingArea};
204
+                      print('我确定了$a');
205
+                      //验证通过提交数据
206
+                    }
207
+                  },
208
+                  child: const Text(
209
+                    "确定",
210
+                    style: TextStyle(
211
+                        fontSize: 18,
212
+                        color: Colors.white,
213
+                        fontWeight: FontWeight.bold),
214
+                  ),
215
+                  style: ButtonStyle(
216
+                    elevation: MaterialStateProperty.all(0),
217
+                    backgroundColor:
218
+                        MaterialStateProperty.all(const Color(0xFFFF703B)),
219
+                    shape: MaterialStateProperty.all(
220
+                        const RoundedRectangleBorder(
221
+                            borderRadius:
222
+                                BorderRadius.all(Radius.circular(24.4)))),
223
+                  ),
224
+                ),
225
+              ),
226
+            ),
227
+            Container(
228
+              margin: EdgeInsets.fromLTRB(0, 30.w, 0, 30.w),
229
+              alignment: Alignment.bottomCenter,
230
+              child: SizedBox(
231
+                width: 315.w,
232
+                height: 49.h,
233
+                child: ElevatedButton(
234
+                  onPressed: () {
235
+                    Get.back();
236
+                  },
237
+                  child: const Text(
238
+                    "取消",
239
+                    style: TextStyle(
240
+                        fontSize: 18,
241
+                        color: Color(0xFFFF703B),
242
+                        fontWeight: FontWeight.bold),
243
+                  ),
244
+                  style: ButtonStyle(
245
+                    side: MaterialStateProperty.all(
246
+                        BorderSide(width: 1, color: Color(0xFFFF703B))), //边框
247
+                    elevation: MaterialStateProperty.all(0),
248
+                    backgroundColor: MaterialStateProperty.all(Colors.white),
249
+                    shape: MaterialStateProperty.all(
250
+                      RoundedRectangleBorder(
251
+                          borderRadius:
252
+                              BorderRadius.all(Radius.circular(24.4))),
253
+                    ),
254
+                  ),
255
+                ),
256
+              ),
257
+            ),
258
+          ],
259
+        ),
260
+      ),
261
+    );
262
+  }
263
+}
264
+
265
+
266
+
267
+

+ 0
- 0
lib/pages/OrderConfirmation/widgets/timeDatePicker.dart Просмотреть файл


+ 131
- 0
lib/pages/TabBar/index.dart Просмотреть файл

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

+ 123
- 0
lib/pages/TabBar/widgets/Information/index.dart Просмотреть файл

@@ -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/TabBar/widgets/main/index.dart Просмотреть файл

@@ -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
+}

+ 155
- 0
lib/pages/TabBar/widgets/main/widgets/OtherColumn.dart Просмотреть файл

@@ -0,0 +1,155 @@
1
+import 'package:flutter/material.dart';
2
+import 'package:flutter_screenutil/flutter_screenutil.dart';
3
+
4
+class OtherColumn extends StatelessWidget {
5
+  const OtherColumn({Key? key}) : super(key: key);
6
+
7
+  @override
8
+  Widget build(BuildContext context) {
9
+    return  Container(
10
+        alignment: Alignment.center,
11
+        width: 345.w,
12
+        margin: EdgeInsets.fromLTRB(0, 15.w, 0, 15.w),
13
+        decoration: BoxDecoration(
14
+          borderRadius: BorderRadius.circular(30),
15
+          color: Colors.white,
16
+          boxShadow: [
17
+            BoxShadow(
18
+              blurRadius: 10, //阴影范围
19
+              spreadRadius: 0.1, //阴影浓度
20
+              color: Colors.grey.withOpacity(0.2), //阴影颜色
21
+            ),
22
+          ],
23
+        ),
24
+        child: Column(
25
+          children: [
26
+            Container(
27
+                margin: EdgeInsets.fromLTRB(0, 30.w, 0, 20.w),
28
+                alignment: Alignment.topLeft,
29
+                decoration: const BoxDecoration(
30
+                    border: Border(
31
+                        left: BorderSide(width: 5, color: Color(0xff000000)
32
+                            // 0x17000000
33
+                            ))),
34
+                child: Padding(
35
+                  padding: EdgeInsets.fromLTRB(12.w, 0, 0, 0),
36
+                  child: Text(
37
+                    '设置',
38
+                    style: TextStyle(
39
+                      color: Color(0xff333333),
40
+                      fontWeight: FontWeight.bold,
41
+                      fontSize: 17.sp,
42
+                    ),
43
+                  ),
44
+                )),
45
+            Container(
46
+              child: Column(
47
+                children: [
48
+                  Container(
49
+                    height: 45.w,
50
+                    width: 310.w,
51
+                    margin: EdgeInsets.fromLTRB(0, 10.w, 0, 0),
52
+
53
+                    decoration: const BoxDecoration(
54
+                        border:Border(
55
+                            bottom:
56
+                            BorderSide(width: 0.5, color: Color(0x20000000)
57
+                              // 0x17000000
58
+                            ))
59
+                    ),
60
+
61
+                    child: ListTile(
62
+                      contentPadding: EdgeInsets.symmetric(horizontal: 0.0),
63
+                      // 这边使用了contentPadding
64
+                      leading: Image(
65
+                        image: AssetImage('images/aboutUs.png'),
66
+                        width: 18.w,
67
+                        height: 21.w,
68
+                      ),
69
+                      title: Transform(
70
+                        transform: Matrix4.translationValues(-20, 0.0, 0.0),
71
+                        child: Text("版本更新",
72
+                            style: TextStyle(
73
+                                fontSize: 17.sp, color: Color(0xff333333))),
74
+                      ),
75
+                      trailing: Image(
76
+                        image: AssetImage('images/userRight.png'),
77
+                        width: 10.w,
78
+                        height: 18.w,
79
+                      ),
80
+                    ),
81
+                  ),
82
+                  Container(
83
+                    margin: EdgeInsets.fromLTRB(0, 10.w, 0, 0),
84
+                    width: 310.w,
85
+                    height: 45.w,
86
+                    decoration: const BoxDecoration(
87
+                        border:Border(
88
+                            bottom:
89
+                            BorderSide(width: 0.5, color: Color(0x20000000)
90
+                              // 0x17000000
91
+                            ))
92
+                    ),
93
+
94
+                    child: ListTile(
95
+                      contentPadding: EdgeInsets.symmetric(horizontal: 0.0),
96
+
97
+                      leading: Image(
98
+                        image: AssetImage('images/versionUpdate.png'),
99
+                        width: 18.w,
100
+                        height: 21.w,
101
+                      ),
102
+                      title: Transform(
103
+                        transform: Matrix4.translationValues(-20, 0.0, 0.0),
104
+                        child: Text("用户协议及隐私政策",
105
+                            style: TextStyle(
106
+                                fontSize: 17.sp, color: Color(0xff333333))),
107
+                      ),
108
+                      trailing: Image(
109
+                        image: AssetImage('images/userRight.png'),
110
+                        width: 10.w,
111
+                        height: 18.w,
112
+                      ),
113
+                    ),
114
+                  ),
115
+                  Container(
116
+                    margin: EdgeInsets.fromLTRB(0, 10.w, 0, 20.w),
117
+                    width: 310.w,
118
+                    height: 45.w,
119
+                    decoration: const BoxDecoration(
120
+                        border:Border(
121
+                            bottom:
122
+                            BorderSide(width: 0.5, color: Color(0x20000000)
123
+                              // 0x17000000
124
+                            ))
125
+                    ),
126
+
127
+                    child: ListTile(
128
+                      contentPadding: EdgeInsets.symmetric(horizontal: 0.0),
129
+
130
+                      leading: Image(
131
+                        image: AssetImage('images/feedbacks.png'),
132
+                        width: 18.w,
133
+                        height: 21.w,
134
+                      ),
135
+                      title: Transform(
136
+                        transform: Matrix4.translationValues(-20, 0.0, 0.0),
137
+                        child: Text("意见反馈",
138
+                            style: TextStyle(
139
+                                fontSize: 17.sp, color: Color(0xff333333))),
140
+                      ),
141
+                      trailing: Image(
142
+                        image: AssetImage('images/userRight.png'),
143
+                        width: 10.w,
144
+                        height: 18.w,
145
+                      ),
146
+                    ),
147
+                  ),
148
+
149
+                ],
150
+              ),
151
+            )
152
+          ],
153
+        ));
154
+  }
155
+}

lib/pages/main/widgets/UserAddress.dart → lib/pages/TabBar/widgets/main/widgets/UserAddress.dart Просмотреть файл

@@ -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/TabBar/widgets/main/widgets/UserInfo.dart Просмотреть файл

@@ -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 UserInfo extends StatelessWidget {
5 6
   const UserInfo({Key? key}) : super(key: key);
@@ -7,6 +8,8 @@ class UserInfo extends StatelessWidget {
7 8
   @override
8 9
   Widget build(BuildContext context) {
9 10
     return Container(
11
+      margin: EdgeInsets.only(top: 20.0, bottom: 0.0),
12
+
10 13
       alignment: Alignment.center,
11 14
       height: 173.w,
12 15
       width: 345.w,
@@ -39,7 +42,7 @@ class UserInfo extends StatelessWidget {
39 42
                     style: TextStyle(color: Colors.white),
40 43
                   ),
41 44
                   onTap: () {
42
-                    print('修改个人信息');
45
+                    Get.toNamed('/userInfo');
43 46
                   },
44 47
                 )),
45 48
           ),

+ 62
- 0
lib/pages/TabBar/widgets/order/index.dart Просмотреть файл

@@ -0,0 +1,62 @@
1
+import 'package:flutter/material.dart';
2
+import 'package:flutter_screenutil/flutter_screenutil.dart';
3
+
4
+import '../../../../widgets/OrderListCard.dart';
5
+import '../../../orderInfo/index.dart';
6
+
7
+class OrderPage extends StatefulWidget {
8
+  const OrderPage({Key? key}) : super(key: key);
9
+
10
+  @override
11
+  State<OrderPage> createState() => _OrderPageState();
12
+}
13
+
14
+class _OrderPageState extends State<OrderPage> {
15
+  @override
16
+  Widget build(BuildContext context) {
17
+    return ListView(
18
+      children: [
19
+        Container(
20
+          padding: EdgeInsets.fromLTRB(15, 0, 15, 0),
21
+          height: 55.w,
22
+          decoration: BoxDecoration(
23
+            color: Colors.white
24
+          ),
25
+          child: Row(
26
+            mainAxisAlignment: MainAxisAlignment.spaceBetween,
27
+
28
+            children: [
29
+              Row(
30
+                children: [
31
+                  Padding(padding: EdgeInsets.fromLTRB(0, 0, 8, 0),
32
+                  child:Image(image: AssetImage('images/ordersListImga.png'),fit: BoxFit.cover,width: 18.w,),
33
+                  ),
34
+
35
+                  Text('订单列表',
36
+                    style: TextStyle(
37
+                      color: Color(0xff222222),
38
+                      fontSize: 20.sp,
39
+                      fontWeight: FontWeight.bold
40
+                    ),
41
+                  )
42
+                ],
43
+              ),
44
+            ],
45
+          ),
46
+        ),
47
+ Column(
48
+        mainAxisSize: MainAxisSize.min,
49
+        children: [
50
+          OrderListCard(),
51
+          OrderListCard(),
52
+          OrderListCard(),
53
+          OrderListCard(),
54
+
55
+
56
+        ],
57
+      ),
58
+
59
+    ],
60
+    );
61
+  }
62
+}

+ 110
- 0
lib/pages/addAddress/index.dart Просмотреть файл

@@ -0,0 +1,110 @@
1
+import 'package:farmer_client/models/entities/Address.dart';
2
+import 'package:farmer_client/widgets/DefaultButton.dart';
3
+import 'package:flutter/material.dart';
4
+import 'package:flutter_screenutil/flutter_screenutil.dart';
5
+import 'package:fluttertoast/fluttertoast.dart';
6
+import 'package:get/get.dart';
7
+
8
+class AddAddress extends StatefulWidget {
9
+  const AddAddress({Key? key}) : super(key: key);
10
+
11
+  @override
12
+  _AddAddress createState() => _AddAddress();
13
+}
14
+
15
+class _AddAddress extends State<AddAddress> {
16
+  late Address address=Address();
17
+  late String text = '';
18
+
19
+  @override
20
+  void initState() {
21
+    super.initState();
22
+    if (Get.arguments != null) {
23
+      address = Get.arguments['item'];
24
+      text = address.address.toString();
25
+    }
26
+  }
27
+
28
+  @override
29
+  Widget build(BuildContext context) {
30
+    return Scaffold(
31
+      appBar: AppBar(
32
+        elevation: 0,
33
+        centerTitle: true,
34
+        backgroundColor: Colors.white,
35
+        title: Text(
36
+          '添加地址',
37
+          style: TextStyle(
38
+              color: Colors.black,
39
+              fontSize: 17.sp,
40
+              letterSpacing: 2,
41
+              fontWeight: FontWeight.bold),
42
+        ),
43
+      ),
44
+      body: Container(
45
+        padding: EdgeInsets.all(15.w),
46
+        child: Column(
47
+          crossAxisAlignment: CrossAxisAlignment.start,
48
+          children: [
49
+            Text(
50
+              '详细地址:',
51
+              style: TextStyle(
52
+                  fontWeight: FontWeight.bold,
53
+                  fontSize: 17.sp,
54
+                  color: const Color(0xFF333333)),
55
+            ),
56
+            Container(
57
+              margin: EdgeInsets.fromLTRB(0, 0, 0, 50.h),
58
+              padding: EdgeInsets.symmetric(vertical: 5.w, horizontal: 18.5.w),
59
+              decoration: BoxDecoration(
60
+                  color: const Color(0xFFfefefe),
61
+                  borderRadius: BorderRadius.all(Radius.circular(10.w)),
62
+                  border: Border.all(
63
+                      color: const Color(0xcc000000),
64
+                      width: 1.h,
65
+                      style: BorderStyle.solid)),
66
+              child: TextFormField(
67
+                initialValue: text,
68
+                minLines: 6,
69
+                maxLines: 6,
70
+                style: TextStyle(fontSize: 17.sp, height: 1.5),
71
+                decoration: const InputDecoration(
72
+                  isCollapsed: true,
73
+                  hintText: '请输入地址信息',
74
+                  border: InputBorder.none,
75
+                  counterText: '', //去掉计数
76
+                  floatingLabelBehavior: FloatingLabelBehavior.never,
77
+                ),
78
+                onChanged: (e) {
79
+                  setState(() {
80
+                    address.address = e;
81
+                  });
82
+                },
83
+              ),
84
+            ),
85
+            DefaultButton(
86
+              color: const Color(0xffffffff),
87
+              backColor: const Color(0xFFFF703B),
88
+              width: 345.w,
89
+              height: 49.h,
90
+              text: '保存',
91
+              onPressed: () {
92
+                if(address.address==null){
93
+                  Fluttertoast.showToast(
94
+                      msg: '请输入地址!');
95
+                } else{
96
+                  Fluttertoast.showToast(
97
+                      msg: '保存成功!');
98
+                  Get.back();
99
+                }
100
+              },
101
+              margin: const EdgeInsets.all(0),
102
+              fontSize: 20.sp,
103
+              radius: 24.5.w,
104
+            ),
105
+          ],
106
+        ),
107
+      ),
108
+    );
109
+  }
110
+}

+ 127
- 0
lib/pages/addressList/index.dart Просмотреть файл

@@ -0,0 +1,127 @@
1
+import 'package:farmer_client/models/entities/Address.dart';
2
+import 'package:farmer_client/pages/addressList/widget/AddressCard.dart';
3
+import 'package:farmer_client/widgets/DefaultButton.dart';
4
+import 'package:flutter/material.dart';
5
+import 'package:flutter_screenutil/flutter_screenutil.dart';
6
+import 'package:fluttertoast/fluttertoast.dart';
7
+import 'package:get/get.dart';
8
+
9
+
10
+class AddressList extends StatefulWidget {
11
+  const AddressList({Key? key}) : super(key: key);
12
+
13
+  @override
14
+  _AddressList createState() => _AddressList();
15
+}
16
+
17
+class _AddressList extends State<AddressList> {
18
+
19
+  List<Address> addressList = [
20
+    Address.fromJson({'address': '777', 'isDefault': false}),
21
+    Address.fromJson({'address': '999', 'isDefault': false}),
22
+    Address.fromJson({'address': '这是一个正经的地址', 'isDefault': false}),
23
+  ];
24
+  void onChange(index) {
25
+    setState(() {
26
+      addressList.forEach((element) {
27
+        if (element.isDefault == true) {
28
+          element.isDefault = false;
29
+        }
30
+      });
31
+      addressList[index].isDefault = true;
32
+    });
33
+  }
34
+  void onDelete(index){
35
+    showDialog(
36
+        context: context,
37
+        builder: (context) {
38
+          return AlertDialog(
39
+              title: Text("提示信息"),
40
+              content: Text("您确定要删除此地址吗?"),
41
+              actions: <Widget>[
42
+                TextButton(
43
+                  child: Text("取消"),
44
+                  onPressed: () {
45
+                    print("取消");
46
+                    Navigator.pop(context, 'Cancle');
47
+                  },
48
+                ),
49
+                TextButton(
50
+                    child: Text("确定"),
51
+                    onPressed: () {
52
+                      // setState(() {
53
+                      //   addressList.remove(addressList[e]);
54
+                      // });
55
+                      Navigator.pop(context, "Ok");
56
+                      Fluttertoast.showToast(
57
+                          msg: '删除成功!');
58
+                    })
59
+              ]);
60
+        });
61
+  }
62
+
63
+  @override
64
+  Widget build(BuildContext context) {
65
+    return Scaffold(
66
+      appBar: AppBar(
67
+        elevation: 0,
68
+        centerTitle: true,
69
+        backgroundColor: Colors.white,
70
+        title: Text(
71
+          '地址管理',
72
+          style: TextStyle(
73
+              color: Colors.black,
74
+              fontSize: 17.sp,
75
+              letterSpacing: 2,
76
+              fontWeight: FontWeight.bold),
77
+        ),
78
+      ),
79
+      body: ListView(
80
+        children: [
81
+          Container(
82
+            padding: EdgeInsets.all(15.w),
83
+            child: Column(
84
+              //左对齐
85
+              crossAxisAlignment: CrossAxisAlignment.start,
86
+              children: [
87
+                Column(
88
+                    children: addressList
89
+                        .asMap()
90
+                        .keys
91
+                        .map(
92
+                          (e) => AddressCard(
93
+                            No: e + 1,
94
+                            item: addressList[e],
95
+                            onChange: () {
96
+                              onChange(e);
97
+                            },
98
+                            onEdit: () {
99
+                              Get.toNamed('/addAddress',arguments: {'item':addressList[e]});
100
+                            },
101
+                            onDelete: () {
102
+                              onDelete(e);
103
+                            },
104
+                          ),
105
+                        )
106
+                        .toList()),
107
+                DefaultButton(
108
+                  color: const Color(0xffffffff),
109
+                  backColor: const Color(0xFFFF703B),
110
+                  width: 345.w,
111
+                  height: 49.h,
112
+                  text: '+新增收货地址',
113
+                  onPressed: () {
114
+                    Get.toNamed('/addAddress');
115
+                  },
116
+                  margin: const EdgeInsets.all(0),
117
+                  fontSize: 20.sp,
118
+                  radius: 24.5.w,
119
+                ),
120
+              ],
121
+            ),
122
+          ),
123
+        ],
124
+      ),
125
+    );
126
+  }
127
+}

+ 153
- 0
lib/pages/addressList/widget/AddressCard.dart Просмотреть файл

@@ -0,0 +1,153 @@
1
+import 'package:farmer_client/models/entities/Address.dart';
2
+import 'package:flutter/material.dart';
3
+import 'package:flutter_screenutil/flutter_screenutil.dart';
4
+import 'package:get/get_rx/src/rx_typedefs/rx_typedefs.dart';
5
+
6
+class AddressCard extends StatefulWidget {
7
+  final Address item;
8
+  final int No;
9
+  final GestureTapCallback onChange;
10
+  final GestureTapCallback onDelete;
11
+  final GestureTapCallback onEdit;
12
+  AddressCard(
13
+      {Key? key,
14
+      required this.item,
15
+      required this.No,
16
+      required this.onChange,
17
+      required this.onDelete,
18
+      required this.onEdit})
19
+      : super(key: key);
20
+
21
+  @override
22
+  _AddressCard createState() =>
23
+      _AddressCard(item, No, onChange, onDelete, onEdit);
24
+}
25
+
26
+class _AddressCard extends State<AddressCard> {
27
+  final Address item;
28
+  final int No;
29
+  final GestureTapCallback onChange;
30
+  final GestureTapCallback onDelete;
31
+  final GestureTapCallback onEdit;
32
+  _AddressCard(this.item, this.No, this.onChange, this.onDelete, this.onEdit);
33
+  @override
34
+  Widget build(BuildContext context) {
35
+    return Container(
36
+      width: 345.w,
37
+      padding: EdgeInsets.all(15.w),
38
+      margin: EdgeInsets.fromLTRB(0, 0, 0, 15.w),
39
+      decoration: BoxDecoration(
40
+        color: const Color(0xFFFFFFFF),
41
+        borderRadius: BorderRadius.all(Radius.circular(10.w)),
42
+        boxShadow: [
43
+          BoxShadow(
44
+              color: const Color(0x19000000),
45
+              offset: Offset(0, 5.w),
46
+              blurRadius: 12.w),
47
+        ],
48
+      ),
49
+      child: Column(
50
+        crossAxisAlignment: CrossAxisAlignment.start,
51
+        children: [
52
+          Row(
53
+            children: [
54
+              if (item.isDefault == true)
55
+                Container(
56
+                  margin: EdgeInsets.fromLTRB(0, 0, 5.w, 0),
57
+                  padding: EdgeInsets.symmetric(vertical: 1.w, horizontal: 5.w),
58
+                  decoration: BoxDecoration(
59
+                    color: const Color(0xffff0000),
60
+                    borderRadius: BorderRadius.all(Radius.circular(5.w)),
61
+                  ),
62
+                  child: Text(
63
+                    '默认地址',
64
+                    style: TextStyle(
65
+                      fontSize: 15.sp,
66
+                      fontWeight: FontWeight.bold,
67
+                      color: const Color(0xffffffff),
68
+                    ),
69
+                  ),
70
+                ),
71
+              Text(
72
+                '我的地址' + No.toString(),
73
+                style: TextStyle(fontSize: 15.sp, fontWeight: FontWeight.w700),
74
+              ),
75
+            ],
76
+          ),
77
+          GestureDetector(
78
+            onTap: onEdit,
79
+            child: Container(
80
+              padding: EdgeInsets.symmetric(vertical: 5.h, horizontal: 0),
81
+              decoration: BoxDecoration(
82
+                border: Border(
83
+                  bottom: BorderSide(
84
+                      width: 0.5.h,
85
+                      color: const Color(0xcc000000),
86
+                      style: BorderStyle.solid),
87
+                ),
88
+              ),
89
+              child: Row(
90
+                mainAxisAlignment: MainAxisAlignment.spaceBetween,
91
+                children: [
92
+                  Container(
93
+                    padding: EdgeInsets.symmetric(vertical: 5.w, horizontal: 0),
94
+                    width: 282.w,
95
+                    child: Text(
96
+                      item.address.toString(),
97
+                      //最多显示两行
98
+                      maxLines: 2,
99
+                      //多余文本用点点点表示
100
+                      overflow: TextOverflow.ellipsis,
101
+                      style: TextStyle(
102
+                        fontSize: 15.sp,
103
+                        color: const Color(0xff666666),
104
+                      ),
105
+                    ),
106
+                  ),
107
+                  Image.asset(
108
+                    'images/icons/edit.png',
109
+                    width: 33.w,
110
+                    height: 33.w,
111
+                  ),
112
+                ],
113
+              ),
114
+            ),
115
+          ),
116
+          Row(
117
+            mainAxisAlignment: MainAxisAlignment.spaceBetween,
118
+            children: [
119
+              GestureDetector(
120
+                onTap: onChange,
121
+                child: Row(
122
+                  children: [
123
+                    const Text('设为默认地址'),
124
+                    Radio<bool>(
125
+                        value: true,
126
+                        activeColor: const Color(0xFFFF703B),
127
+                        groupValue: item.isDefault,
128
+                        onChanged: (value){
129
+                          onChange();
130
+                        }),
131
+                  ],
132
+                ),
133
+              ),
134
+              GestureDetector(
135
+                onTap: onDelete,
136
+                child: Row(
137
+                  children: [
138
+                    const Text('删除'),
139
+                    Image.asset(
140
+                      'images/icons/delete.png',
141
+                      width: 25.w,
142
+                      height: 25.w,
143
+                    ),
144
+                  ],
145
+                ),
146
+              ),
147
+            ],
148
+          ),
149
+        ],
150
+      ),
151
+    );
152
+  }
153
+}

+ 0
- 11
lib/pages/home/index.dart Просмотреть файл

@@ -1,11 +0,0 @@
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
-
11
-}

+ 0
- 109
lib/pages/home2.dart Просмотреть файл

@@ -1,109 +0,0 @@
1
-import 'package:flutter/cupertino.dart';
2
-import 'package:flutter/material.dart';
3
-import 'package:get/get.dart';
4
-import 'package:flutter_screenutil/flutter_screenutil.dart';
5
-
6
-class Home extends StatefulWidget {
7
-  const Home({Key? key}) : super(key: key);
8
-
9
-  @override
10
-  _Home createState() => _Home();
11
-}
12
-
13
-class _Home extends State<Home> {
14
-  List images = [
15
-    ['images/index/index.png', 'images/index/indexActive.png'],
16
-    ['images/index/job.png', 'images/index/jobActive.png'],
17
-    ['images/index/user.png', 'images/index/userActive.png'],
18
-  ];
19
-
20
-  final List _titles = ['首页', '订单列表', '个人中心'];
21
-  int _currentIndex = 0;
22
-  final tabTextStyleSelected =
23
-  TextStyle(color: const Color(0xFF06B03B),fontSize: 15.sp,fontWeight: FontWeight.bold); //选线卡选中字体颜色
24
-  final tabTextStyleNormal =
25
-  TextStyle(color: const Color(0xFF323232),fontSize: 15.sp,fontWeight: FontWeight.bold); //选项卡未选中字体颜色
26
-  int _tabIndex = 0; //选项卡下标
27
-
28
-  var _body = [Text('我是首页'), Text('我是订单列表'), Text('我是个人中心')];
29
-  TextStyle getTabTextStyle(int curIndex) {
30
-    //设置tabbar 选中和未选中的状态文本
31
-    if (curIndex == _tabIndex) {
32
-      return tabTextStyleSelected;
33
-    }
34
-    return tabTextStyleNormal;
35
-  }
36
-
37
-  Image getTabIcon(int curIndex) {
38
-    //设置tabbar选中和未选中的状态图标
39
-    if (curIndex == _tabIndex) {
40
-      return Image.asset(
41
-        images[curIndex][1],
42
-        width: 20.w,
43
-        height: 20.w,
44
-      );
45
-    }
46
-    return Image.asset(
47
-      images[curIndex][0],
48
-      width: 20.w,
49
-      height: 20.w,
50
-    );
51
-  }
52
-
53
-  Image getTabImage(path) {
54
-    return Image.asset(path, width: 26.w, height: 26.w);
55
-  }
56
-
57
-  // 切换底部选项卡,标题的变化设置
58
-  Text getTabTitle(int curIndex) {
59
-    return Text(_titles[curIndex], style: getTabTextStyle(curIndex));
60
-  }
61
-
62
-  @override
63
-  Widget build(BuildContext context) {
64
-    return Scaffold(
65
-      appBar: AppBar(
66
-        elevation: 0,
67
-        centerTitle: true,
68
-        backgroundColor: Colors.white,
69
-        title: Text(
70
-          '首页',
71
-          style: TextStyle(
72
-              color: Colors.black,
73
-              fontSize: 17.sp,
74
-              letterSpacing: 2,
75
-              fontWeight: FontWeight.bold
76
-          ),
77
-        ),
78
-      ),
79
-      body: _body[_tabIndex],
80
-      bottomNavigationBar: Container(
81
-        height: 65.h,
82
-
83
-        child: Row(
84
-          mainAxisAlignment: MainAxisAlignment.spaceAround,
85
-          children: [
86
-            Column(
87
-              children: [
88
-                getTabIcon(0),
89
-                getTabTitle(0)
90
-              ],
91
-            ),
92
-            Column(
93
-              children: [
94
-                getTabIcon(1),
95
-                getTabTitle(1)
96
-              ],
97
-            ),
98
-            Column(
99
-              children: [
100
-                getTabIcon(2),
101
-                getTabTitle(2)
102
-              ],
103
-            ),
104
-          ],
105
-        ),
106
-      ),
107
-    );
108
-  }
109
-}

+ 2
- 2
lib/pages/index.dart Просмотреть файл

@@ -1,6 +1,6 @@
1 1
 
2
-export 'home/index.dart';
2
+export 'TabBar/index.dart';
3 3
 export 'splash/splash.dart';
4 4
 export 'login/login.dart';
5 5
 export 'machinery/map/index.dart';
6
-export 'main/index.dart';
6
+// export 'main/index.dart';

+ 45
- 44
lib/pages/login/login.dart Просмотреть файл

@@ -10,6 +10,7 @@ import 'package:get/get.dart';
10 10
 import '../../models/entities/person.dart';
11 11
 import '../../services/user.dart';
12 12
 import '../../widgets/Cell.dart';
13
+import '../TabBar/index.dart';
13 14
 
14 15
 
15 16
 class MyRouteLogin extends StatefulWidget {
@@ -19,30 +20,30 @@ class MyRouteLogin extends StatefulWidget {
19 20
 
20 21
 class _RouteLogin extends State<MyRouteLogin> {
21 22
 
22
-var  userInfo= AppController.t.user;
23
+  var  userInfo= AppController.t.user;
23 24
 
24
-bool isButtonEnable = true; //按钮状态  是否可点击
25
-String buttonText = '发送验证码'; //初始文本
26
-int count = 60; //初始倒计时时间
27
-var timer; //倒计时的计时器
28
-TextEditingController mController = TextEditingController();
25
+  bool isButtonEnable = true; //按钮状态  是否可点击
26
+  String buttonText = '发送验证码'; //初始文本
27
+  int count = 60; //初始倒计时时间
28
+  var timer; //倒计时的计时器
29
+  TextEditingController mController = TextEditingController();
29 30
 
30 31
 //获取验证码
31
-void _initTimer() {
32
-  timer = Timer.periodic(Duration(seconds: 1), (Timer timer) {
33
-    count--;
34
-    setState(() {
35
-      if (count == 0) {
36
-        timer.cancel(); //倒计时结束取消定时器
37
-        isButtonEnable = true; //按钮可点击
38
-        count = 60; //重置时间
39
-        buttonText = '发送验证码'; //重置按钮文本
40
-      } else {
41
-        buttonText = '重新发送($count)'; //更新文本内容
42
-      }
32
+  void _initTimer() {
33
+    timer = Timer.periodic(Duration(seconds: 1), (Timer timer) {
34
+      count--;
35
+      setState(() {
36
+        if (count == 0) {
37
+          timer.cancel(); //倒计时结束取消定时器
38
+          isButtonEnable = true; //按钮可点击
39
+          count = 60; //重置时间
40
+          buttonText = '发送验证码'; //重置按钮文本
41
+        } else {
42
+          buttonText = '重新发送($count)'; //更新文本内容
43
+        }
44
+      });
43 45
     });
44
-  });
45
-}
46
+  }
46 47
 
47 48
 
48 49
 
@@ -75,12 +76,12 @@ void _initTimer() {
75 76
 
76 77
 
77 78
   void _handlePhone(e) => {
78
-        setState(() => {handlePhones = e})
79
-      };
79
+    setState(() => {handlePhones = e})
80
+  };
80 81
 
81 82
   void _handleCode(e) => {
82
-        setState(() => {handleCodes = e})
83
-      };
83
+    setState(() => {handleCodes = e})
84
+  };
84 85
 
85 86
 
86 87
 
@@ -104,11 +105,11 @@ void _initTimer() {
104 105
       Fluttertoast.showToast(msg: '请输入验证码或手机号!');
105 106
     }else{
106 107
       if(_newValue){
107
-        print('已同意协议');
108 108
         userLogin(handlePhones,handleCodes).then((value) {
109
-          userInfo(Person.fromJson(value.date.person));
110
-          Get.back();
109
+          userInfo(Person.fromJson(value['person']));
110
+          print('已同意协议');
111 111
 
112
+          Get.off(Home());
112 113
         });
113 114
       }else{
114 115
         Fluttertoast.showToast(msg: '请阅读并同意相关隐私政策!');
@@ -122,14 +123,14 @@ void _initTimer() {
122 123
       backgroundColor: Colors.transparent,
123 124
       resizeToAvoidBottomInset: false,
124 125
       body: Container(
125
-      decoration: const BoxDecoration(
126
-        image: DecorationImage(
127
-          image: AssetImage("images/icon_login.png"),
128
-          fit: BoxFit.cover,
126
+        decoration: const BoxDecoration(
127
+          image: DecorationImage(
128
+            image: AssetImage("images/icon_login.png"),
129
+            fit: BoxFit.cover,
130
+          ),
129 131
         ),
130
-      ),
131 132
 
132
-      child:  Container(
133
+        child:  Container(
133 134
           child: Column(
134 135
             mainAxisAlignment: MainAxisAlignment.end,
135 136
             crossAxisAlignment: CrossAxisAlignment.start,
@@ -149,7 +150,7 @@ void _initTimer() {
149 150
                 ),
150 151
               ),
151 152
               Cell(
152
-                  // margin: EdgeInsets.symmetric(horizontal: 13.w),
153
+                // margin: EdgeInsets.symmetric(horizontal: 13.w),
153 154
                   margin: const EdgeInsets.fromLTRB(13, 43, 10, 0),
154 155
                   header: Text(
155 156
                     "+86",
@@ -166,7 +167,7 @@ void _initTimer() {
166 167
                     decoration: const InputDecoration(
167 168
                       isCollapsed: true,
168 169
                       contentPadding:
169
-                          EdgeInsets.symmetric(vertical: 8, horizontal: 16),
170
+                      EdgeInsets.symmetric(vertical: 8, horizontal: 16),
170 171
                       labelText: "请输入手机号码",
171 172
                       counterText: '', //去掉计数
172 173
                       border: InputBorder.none,
@@ -194,11 +195,11 @@ void _initTimer() {
194 195
                         backgroundColor: isButtonEnable
195 196
                             ? MaterialStateProperty.all(const Color(0xFFFF703B))
196 197
                             : MaterialStateProperty.all(
197
-                                const Color(0xFFCBCBCB)),
198
+                            const Color(0xFFCBCBCB)),
198 199
                         shape: MaterialStateProperty.all(
199 200
                             const RoundedRectangleBorder(
200 201
                                 borderRadius:
201
-                                    BorderRadius.all(Radius.circular(10)))),
202
+                                BorderRadius.all(Radius.circular(10)))),
202 203
                       ),
203 204
                     ),
204 205
                   )),
@@ -223,7 +224,7 @@ void _initTimer() {
223 224
                   decoration: const InputDecoration(
224 225
                     isCollapsed: true,
225 226
                     contentPadding:
226
-                        EdgeInsets.symmetric(vertical: 8, horizontal: 16),
227
+                    EdgeInsets.symmetric(vertical: 8, horizontal: 16),
227 228
                     labelText: "请输入验证码",
228 229
                     border: InputBorder.none,
229 230
                     floatingLabelBehavior: FloatingLabelBehavior.never,
@@ -254,11 +255,11 @@ void _initTimer() {
254 255
                     style: ButtonStyle(
255 256
                       elevation: MaterialStateProperty.all(0),
256 257
                       backgroundColor:
257
-                          MaterialStateProperty.all(const Color(0xFFFF703B)),
258
+                      MaterialStateProperty.all(const Color(0xFFFF703B)),
258 259
                       shape: MaterialStateProperty.all(
259 260
                           const RoundedRectangleBorder(
260 261
                               borderRadius:
261
-                                  BorderRadius.all(Radius.circular(24.4)))),
262
+                              BorderRadius.all(Radius.circular(24.4)))),
262 263
                     ),
263 264
                   ),
264 265
                 ),
@@ -286,10 +287,10 @@ void _initTimer() {
286 287
                             text: '文本协议/隐私政策,',
287 288
                             style: TextStyle(color: Color(0xffce3800)),
288 289
                             recognizer:
289
-                                TapGestureRecognizer() //踩坑。。。recognizer 是手势交互 除了我现在些的是 点击交互,其他一般都是抽象类。
290
-                                  ..onTap = () {
291
-                                    print('阅读已同意!!!');
292
-                                  },
290
+                            TapGestureRecognizer() //踩坑。。。recognizer 是手势交互 除了我现在些的是 点击交互,其他一般都是抽象类。
291
+                              ..onTap = () {
292
+                                print('阅读已同意!!!');
293
+                              },
293 294
                           ),
294 295
                           const TextSpan(
295 296
                               text: '确认之后选择此项',

+ 0
- 40
lib/pages/main/index.dart Просмотреть файл

@@ -1,40 +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
-
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 Scaffold(
18
-      resizeToAvoidBottomInset: false,
19
-      appBar:  AppBar(
20
-        title:  Text('我的'),
21
-        leading:  Icon(Icons.arrow_back_ios),
22
-        // backgroundColor: Colors.transparent,
23
-        centerTitle: true,
24
-
25
-      ),
26
-      body:Container(
27
-        alignment: Alignment.center,
28
-        child:   Column(
29
-          children: [
30
-            UserInfo(),
31
-            UserAddress(),
32
-            OtherColumn()
33
-          ],
34
-        ),
35
-      )
36
-
37
-
38
-    );
39
-  }
40
-}

+ 0
- 97
lib/pages/main/widgets/OtherColumn.dart Просмотреть файл

@@ -1,97 +0,0 @@
1
-import 'package:flutter/material.dart';
2
-import 'package:flutter_screenutil/flutter_screenutil.dart';
3
-
4
-class OtherColumn extends StatelessWidget {
5
-  const OtherColumn({Key? key}) : super(key: key);
6
-
7
-  @override
8
-  Widget build(BuildContext context) {
9
-    return Container(
10
-        alignment: Alignment.center,
11
-        height: 123.w,
12
-        width: 345.w,
13
-        margin: EdgeInsets.fromLTRB(0, 15.w, 0, 15.w),
14
-        decoration: BoxDecoration(
15
-          borderRadius: BorderRadius.circular(30),
16
-          color: Colors.white,
17
-          boxShadow: [
18
-            BoxShadow(
19
-              blurRadius: 10, //阴影范围
20
-              spreadRadius: 0.1, //阴影浓度
21
-              color: Colors.grey.withOpacity(0.2), //阴影颜色
22
-            ),
23
-          ],
24
-        ),
25
-        child: Column(
26
-          children: [
27
-            Container(
28
-                margin: EdgeInsets.fromLTRB(0, 30.w, 0, 20.w),
29
-                alignment: Alignment.topLeft,
30
-                decoration: const BoxDecoration(
31
-                    border: Border(
32
-                        left: BorderSide(width: 5, color: Color(0xff000000)
33
-                          // 0x17000000
34
-                        ))),
35
-                child: Padding(
36
-                  padding: EdgeInsets.fromLTRB(12.w, 0, 0, 0),
37
-                  child: Text(
38
-                    '地址信息',
39
-                    style: TextStyle(
40
-                      color: Color(0xff333333),
41
-                      fontWeight: FontWeight.bold,
42
-                      fontSize: 17.sp,
43
-                    ),
44
-                  ),
45
-                )),
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/aboutUs.png'),
57
-                          width: 17.w,
58
-                          height: 21.w,
59
-                        ),
60
-                      ),
61
-                      Container(
62
-                        width: 260,
63
-                        child: GestureDetector(
64
-                          child: Text(
65
-                            '请填写详细地址请填写详细地址请填写详细地址',
66
-                            softWrap: true,
67
-                            maxLines: 1,
68
-                            textAlign: TextAlign.left,
69
-                            overflow: TextOverflow.ellipsis,
70
-                            style: TextStyle(
71
-                              fontWeight: FontWeight.bold,
72
-                              fontSize: 17,
73
-                            ),
74
-                          ),
75
-                          onTap: () {
76
-                            print('修改地址');
77
-                          },
78
-                        ),
79
-                      )
80
-                    ],
81
-                  ),
82
-                ),
83
-                Container(
84
-                  alignment: Alignment.center,
85
-                  padding: EdgeInsets.fromLTRB(0, 0, 30.w, 0),
86
-                  child: Image(
87
-                    image: AssetImage('images/userRight.png'),
88
-                    width: 10.w,
89
-                    height: 18.w,
90
-                  ),
91
-                ),
92
-              ],
93
-            ),
94
-          ],
95
-        ));
96
-  }
97
-}

lib/pages/order/index.dart → lib/pages/orderInfo/index.dart Просмотреть файл

@@ -7,14 +7,14 @@ import '../../widgets/OrderInfoCard.dart';
7 7
 
8 8
 
9 9
 
10
-class OrderPage extends StatefulWidget {
11
-  const OrderPage({Key? key}) : super(key: key);
10
+class OrderPageInfo extends StatefulWidget {
11
+  const OrderPageInfo({Key? key}) : super(key: key);
12 12
 
13 13
   @override
14
-  State<OrderPage> createState() => _OrderPageState();
14
+  State<OrderPageInfo> createState() => _OrderPageInfoState();
15 15
 }
16 16
 
17
-class _OrderPageState extends State<OrderPage> {
17
+class _OrderPageInfoState extends State<OrderPageInfo> {
18 18
   @override
19 19
   Widget build(BuildContext context) {
20 20
     return Scaffold(

+ 57
- 16
lib/pages/splash/splash.dart Просмотреть файл

@@ -1,16 +1,57 @@
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
+
7
+import '../TabBar/index.dart';
8
+
9
+class SplashScreen extends StatefulWidget {
10
+  const SplashScreen({Key? key}) : super(key: key);
11
+
12
+  @override
13
+  State<SplashScreen> createState() => _SplashScreen();
14
+}
15
+
16
+class _SplashScreen extends State<SplashScreen> {
17
+  handleOnFinish() {
18
+    Get.off(Home());
19
+    // Get.toNamed("/addressList");
20
+  }
21
+
22
+  @override
23
+  Widget build(BuildContext context) {
24
+    return Scaffold(
25
+        body: Container(
26
+          decoration: const BoxDecoration(
27
+            image: DecorationImage(
28
+                image: AssetImage("images/splash.png"),
29
+                fit: BoxFit.cover,
30
+                alignment: Alignment.topCenter),
31
+          ),
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
+                  ),
51
+                ),
52
+              ),
53
+            ],
54
+          ),
55
+        ));
56
+  }
57
+}

+ 39
- 45
lib/pages/splash/widgets/countdown.dart Просмотреть файл

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

+ 127
- 0
lib/pages/userInfo/index.dart Просмотреть файл

@@ -0,0 +1,127 @@
1
+import 'package:flutter/material.dart';
2
+import 'package:flutter_screenutil/flutter_screenutil.dart';
3
+import 'package:fluttertoast/fluttertoast.dart';
4
+import 'package:get/get.dart';
5
+
6
+class UserInfo extends StatefulWidget {
7
+  const UserInfo({Key? key}) : super(key: key);
8
+
9
+  @override
10
+  _UserInfo createState() => _UserInfo();
11
+}
12
+
13
+class _UserInfo extends State<UserInfo> {
14
+  String name = '';
15
+  @override
16
+  Widget build(BuildContext context) {
17
+    return Scaffold(
18
+      appBar: AppBar(
19
+        elevation: 0,
20
+        centerTitle: true,
21
+        backgroundColor: Colors.white,
22
+        title: Text(
23
+          '个人信息',
24
+          style: TextStyle(
25
+              color: Colors.black,
26
+              fontSize: 17.sp,
27
+              letterSpacing: 2,
28
+              fontWeight: FontWeight.bold),
29
+        ),
30
+      ),
31
+      body: Container(
32
+        color: Color(0xFFffffff),
33
+        padding: EdgeInsets.all(15.w),
34
+        child: Column(
35
+          crossAxisAlignment: CrossAxisAlignment.start,
36
+          children: [
37
+            Container(
38
+              margin: EdgeInsets.fromLTRB(0, 0, 0, 40.h),
39
+              padding: EdgeInsets.symmetric(vertical: 15.h, horizontal: 0),
40
+              decoration: BoxDecoration(
41
+                color: const Color(0xFFFFFFFF),
42
+                boxShadow: [
43
+                  BoxShadow(
44
+                    color: const Color(0x1F000000),
45
+                    offset: Offset(0, 1.w),
46
+                    blurRadius: 0,
47
+                  ),
48
+                ],
49
+              ),
50
+              child: Row(
51
+                  mainAxisAlignment: MainAxisAlignment.spaceBetween,
52
+                  children: [
53
+                    Image.asset(
54
+                      'images/userMoren.png',
55
+                      width: 62.w,
56
+                      height: 62.w,
57
+                    ),
58
+                    Text(
59
+                      '更换头像',
60
+                      style: TextStyle(
61
+                          fontSize: 17.sp,
62
+                          color: Color(0xFF333333),
63
+                          letterSpacing: 2,
64
+                          fontWeight: FontWeight.w500),
65
+                    ),
66
+                  ]),
67
+            ),
68
+            Text(
69
+              '姓名:',
70
+              style: TextStyle(
71
+                  color: const Color(0xFF333333),
72
+                  fontSize: 17.sp,
73
+                  letterSpacing: 2,
74
+                  fontWeight: FontWeight.bold),
75
+            ),
76
+            Container(
77
+                margin: EdgeInsets.fromLTRB(0, 20.h, 0, 40.h),
78
+                padding: EdgeInsets.symmetric(vertical: 19.h, horizontal: 0),
79
+                decoration: BoxDecoration(
80
+                  color: const Color(0xFFFFFFFF),
81
+                  boxShadow: [
82
+                    BoxShadow(
83
+                      color: const Color(0x1F000000),
84
+                      offset: Offset(0, 1.w),
85
+                      blurRadius: 0,
86
+                    ),
87
+                  ],
88
+                ),
89
+                child: Column(
90
+                  children: [
91
+                    Row(
92
+                        mainAxisAlignment: MainAxisAlignment.spaceBetween,
93
+                        children: [
94
+                          Container(
95
+                            width: 200.w,
96
+                            child: TextFormField(
97
+                              initialValue: name,
98
+                              style: TextStyle(
99
+                                  color: Color(0xFF333333),
100
+                                  fontSize: 17.sp,
101
+                                  letterSpacing: 2,
102
+                                  fontWeight: FontWeight.bold),
103
+                              decoration: const InputDecoration(
104
+                                isCollapsed: true,
105
+                                hintText: '请输入您的姓名',
106
+                                border: InputBorder.none,
107
+                                counterText: '', //去掉计数
108
+                                floatingLabelBehavior:
109
+                                    FloatingLabelBehavior.never,
110
+                              ),
111
+                              onChanged: (e) {},
112
+                            ),
113
+                          ),
114
+                          Image.asset(
115
+                            'images/icons/cancel.png',
116
+                            width: 18.w,
117
+                            height: 18.w,
118
+                          )
119
+                        ]),
120
+                  ],
121
+                )),
122
+          ],
123
+        ),
124
+      ),
125
+    );
126
+  }
127
+}

+ 14
- 4
lib/routes/pages.dart Просмотреть файл

@@ -1,9 +1,19 @@
1 1
 
2
+import 'package:farmer_client/pages/ArticleInfo/ArticleInfo.dart';
3
+import 'package:farmer_client/pages/addAddress/index.dart';
4
+import 'package:farmer_client/pages/addressList/index.dart';
5
+import 'package:farmer_client/pages/userInfo/index.dart';
2 6
 import 'package:get/get.dart';
3
-import '../pages/index.dart';//Home
7
+import '../pages/index.dart';
8
+
4 9
 
5 10
 List<GetPage> pages = [
6
-  // GetPage(name: '/', page: () =>  MachineryMapPage()),
7
-  GetPage(name: '/splash', page: () => MachineryMapPage()),
8
-  // GetPage(name: '/login', page: () =>  MyRouteLogin()),
11
+  GetPage(name: '/', page: () =>  Home()),
12
+  GetPage(name: '/ArticleInfo', page: () =>  ArticleInfo()),//资讯详情
13
+  GetPage(name: '/splash', page: () => SplashScreen()),//SplashScreen
14
+  GetPage(name: '/login', page: () =>  MyRouteLogin()),
15
+  GetPage(name: '/addressList', page: () =>  AddressList()),
16
+  GetPage(name: '/addAddress', page: () =>  AddAddress()),
17
+  GetPage(name: '/userInfo', page: () =>  UserInfo()),
18
+  GetPage(name: '/machineryMap', page: () =>  MachineryMapPage()),
9 19
 ];

+ 5
- 0
lib/widgets/CarsCard.dart Просмотреть файл

@@ -1,6 +1,10 @@
1 1
 import 'package:flutter/foundation.dart';
2 2
 import 'package:flutter/material.dart';
3 3
 import 'package:flutter_screenutil/flutter_screenutil.dart';
4
+import 'package:get/get.dart';
5
+import 'package:get/get_core/src/get_main.dart';
6
+
7
+import '../pages/OrderConfirmation/index.dart';
4 8
 
5 9
 // class CarItem {
6 10
 //   late String name;
@@ -83,6 +87,7 @@ class CarsCard extends StatelessWidget {
83 87
                     height: 44.h, //+10
84 88
                     child: ElevatedButton(
85 89
                       onPressed: () {
90
+                        Get.to(OrderConfirmation());
86 91
                         print('点我去预约');
87 92
                       },
88 93
                       child: const Text(

+ 9
- 4
lib/widgets/DefaultButton.dart Просмотреть файл

@@ -12,6 +12,7 @@ class DefaultButton extends StatefulWidget {
12 12
   final double? fontSize;
13 13
   final Color backColor;
14 14
   final Color color;
15
+  final double? radius;
15 16
 
16 17
   EdgeInsetsGeometry marginDefault =
17 18
   const EdgeInsets.fromLTRB(0, 90.0, 0, 30); //按钮默认的margin值
@@ -24,6 +25,7 @@ class DefaultButton extends StatefulWidget {
24 25
     required this.width,
25 26
     required this.height,
26 27
     this.fontSize,
28
+    this.radius,
27 29
     required this.backColor,
28 30
     required this.color,
29 31
   }) : super(key: key);
@@ -31,9 +33,9 @@ class DefaultButton extends StatefulWidget {
31 33
   @override
32 34
   State createState() {
33 35
     if (margin == null) {
34
-      return _DefaultButtonState(onPressed, text, marginDefault,width,height,fontSize,backColor,color);
36
+      return _DefaultButtonState(onPressed, text, marginDefault,width,height,fontSize,backColor,color,radius);
35 37
     }
36
-    return _DefaultButtonState(onPressed, text, margin,width,height,fontSize,backColor,color);
38
+    return _DefaultButtonState(onPressed, text, margin,width,height,fontSize,backColor,color,radius);
37 39
   }
38 40
 }
39 41
 
@@ -47,6 +49,7 @@ class _DefaultButtonState extends State<DefaultButton> {
47 49
   final double? fontSize;
48 50
   final Color backColor;
49 51
   final Color color;
52
+  final double? radius;
50 53
   _DefaultButtonState(
51 54
       this.onPressed,
52 55
       this.text,
@@ -55,7 +58,8 @@ class _DefaultButtonState extends State<DefaultButton> {
55 58
       this.height,
56 59
       this.fontSize,
57 60
       this.backColor,
58
-      this.color
61
+      this.color,
62
+      this.radius
59 63
       );
60 64
 
61 65
   @override
@@ -71,9 +75,10 @@ class _DefaultButtonState extends State<DefaultButton> {
71 75
           disabledTextColor: const Color(0xF5F6F7ff),
72 76
           colorBrightness: Brightness.dark,
73 77
           shape:
74
-          RoundedRectangleBorder(borderRadius: BorderRadius.circular(5.0)),
78
+          RoundedRectangleBorder(borderRadius: BorderRadius.circular(radius??5)),
75 79
           child: Text(text,style:  TextStyle(
76 80
               fontSize: fontSize,
81
+              fontWeight: FontWeight.bold,
77 82
               color: color,
78 83
           ),),
79 84
           textColor: Colors.white,

+ 1
- 0
lib/widgets/OrderListCard.dart Просмотреть файл

@@ -9,6 +9,7 @@ class OrderListCard extends StatelessWidget {
9 9
     return Container(
10 10
       width: 375.w,
11 11
       height: 345.h,
12
+      margin: EdgeInsets.fromLTRB(0, 0, 0, 20),
12 13
       decoration: const BoxDecoration(color: Colors.white, boxShadow: [
13 14
         BoxShadow(
14 15
             color: Colors.black12,

+ 12
- 0
pubspec.lock Просмотреть файл

@@ -167,6 +167,11 @@ packages:
167 167
       url: "https://pub.flutter-io.cn"
168 168
     source: hosted
169 169
     version: "1.0.4"
170
+  flutter_localizations:
171
+    dependency: "direct main"
172
+    description: flutter
173
+    source: sdk
174
+    version: "0.0.0"
170 175
   flutter_plugin_android_lifecycle:
171 176
     dependency: transitive
172 177
     description:
@@ -226,6 +231,13 @@ packages:
226 231
       url: "https://pub.flutter-io.cn"
227 232
     source: hosted
228 233
     version: "4.0.0"
234
+  intl:
235
+    dependency: transitive
236
+    description:
237
+      name: intl
238
+      url: "https://pub.flutter-io.cn"
239
+    source: hosted
240
+    version: "0.17.0"
229 241
   js:
230 242
     dependency: transitive
231 243
     description:

+ 22
- 9
pubspec.yaml Просмотреть файл

@@ -20,17 +20,21 @@ version: 1.0.0+1
20 20
 environment:
21 21
   sdk: ">=2.16.1 <3.0.0"
22 22
 
23
-# Dependencies specify other packages that your package needs in order to work.
23
+# Dependencies specify other packages that your package needs in orderInfo to work.
24 24
 # To automatically upgrade your package dependencies to the latest versions
25 25
 # consider running `flutter pub upgrade --major-versions`. Alternatively,
26 26
 # dependencies can be manually updated by changing the version numbers below to
27 27
 # the latest version available on pub.dev. To see which dependencies have newer
28 28
 # versions available, run `flutter pub outdated`.
29 29
 dependencies:
30
+  # 添加国际化
31
+  flutter_localizations:
32
+    sdk: flutter
30 33
   flutter:
31 34
     sdk: flutter
32 35
 
33 36
 
37
+
34 38
   # The following adds the Cupertino Icons font to your application.
35 39
   # Use with the CupertinoIcons class for iOS style icons.
36 40
   cupertino_icons: ^1.0.2
@@ -43,6 +47,8 @@ dependencies:
43 47
   location: ^4.3.0
44 48
   amap_flutter_map: ^3.0.0
45 49
 
50
+
51
+
46 52
 dev_dependencies:
47 53
   flutter_test:
48 54
     sdk: flutter
@@ -70,14 +76,14 @@ flutter:
70 76
   assets:
71 77
     - images/icon_login.png
72 78
     - images/phoneCode.png
73
-    - images/HomesNOImgaes.png
74
-    - images/HomesOFFImgaes.png
75
-    - images/MineNOImgaes.png
76
-    - images/MineOFFImgaes.png
77
-    - images/newsOFFImages.png
78
-    - images/newsONImages.png
79
-    - images/OrdersNOImgaes.png
80
-    - images/OrdersOFFImgaes.png
79
+    - images/index/HomesNOImgaes.png
80
+    - images/index/HomesOFFImgaes.png
81
+    - images/index/MineNOImgaes.png
82
+    - images/index/MineOFFImgaes.png
83
+    - images/index/newsOFFImages.png
84
+    - images/index/newsONImages.png
85
+    - images/index/OrdersNOImgaes.png
86
+    - images/index/OrdersOFFImgaes.png
81 87
     - images/cars.png
82 88
     - images/gpsImgae.png
83 89
     - images/ordersLeft.png
@@ -88,6 +94,13 @@ flutter:
88 94
     - images/userRight.png
89 95
     - images/versionUpdate.png
90 96
     - images/locationImage.png
97
+    - images/logo.png
98
+    - images/splash.png
99
+    - images/icons/decorate.png
100
+    - images/icons/edit.png
101
+    - images/icons/delete.png
102
+    - images/icons/cancel.png
103
+    - images/ordersListImga.png
91 104
 
92 105
   # An image asset can refer to one or more resolution-specific "variants", see
93 106
   # https://flutter.dev/assets-and-images/#resolution-aware.