Преглед изворни кода

Merge branch 'master' of http://git.ycjcjy.com/nanyang/farmer_client

Yansen пре 2 година
родитељ
комит
4dc6e57f3d

BIN
images/userMoren.png Прегледај датотеку


+ 1
- 2
ios/Runner.xcodeproj/project.pbxproj Прегледај датотеку

@@ -3,7 +3,7 @@
3 3
 	archiveVersion = 1;
4 4
 	classes = {
5 5
 	};
6
-	objectVersion = 50;
6
+	objectVersion = 51;
7 7
 	objects = {
8 8
 
9 9
 /* Begin PBXBuildFile section */
@@ -76,7 +76,6 @@
76 76
 				805A6DB5EC13EB9FC8C0F263 /* Pods-Runner.release.xcconfig */,
77 77
 				E4D5DB9E3D4475D04602FE2B /* Pods-Runner.profile.xcconfig */,
78 78
 			);
79
-			name = Pods;
80 79
 			path = Pods;
81 80
 			sourceTree = "<group>";
82 81
 		};

+ 10
- 0
ios/Runner/Info.plist Прегледај датотеку

@@ -28,6 +28,8 @@
28 28
 	<string>LaunchScreen</string>
29 29
 	<key>UIMainStoryboardFile</key>
30 30
 	<string>Main</string>
31
+	<key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
32
+	<string>需要您提供定位信息,才能使用获取您附近的农机</string>
31 33
 	<key>UISupportedInterfaceOrientations</key>
32 34
 	<array>
33 35
 		<string>UIInterfaceOrientationPortrait</string>
@@ -45,5 +47,13 @@
45 47
 	<false/>
46 48
 	<key>CADisableMinimumFrameDurationOnPhone</key>
47 49
 	<true/>
50
+	<key>io.flutter.embedded_views_preview</key>
51
+	<string>YES</string>	
52
+	<key>NSLocationAlwaysUsageDescription</key>
53
+	<string>需要您提供后台定位信息,才能使用获取您附近的农机</string>
54
+	<key>NSLocationUsageDescription</key>
55
+	<string>需要您提供定位信息,才能使用获取您附近的农机</string>
56
+	<key>NSLocationWhenInUseUsageDescription</key>
57
+	<string>需要您提供定位信息,才能使用获取您附近的农机</string>
48 58
 </dict>
49 59
 </plist>

+ 0
- 1
lib/main.dart Прегледај датотеку

@@ -1,5 +1,4 @@
1 1
 import 'package:farmer_client/theme.dart';
2
-import 'package:farmer_client/utils/location.dart';
3 2
 import 'package:flutter/material.dart';
4 3
 import 'package:flutter_easyloading/flutter_easyloading.dart';
5 4
 import 'package:fluwx/fluwx.dart';

+ 16
- 16
lib/pages/OrderConfirmation/index.dart Прегледај датотеку

@@ -3,14 +3,12 @@ import 'package:farmer_client/models/app.dart';
3 3
 import 'package:farmer_client/models/entities/CardInfo.dart';
4 4
 import 'package:farmer_client/widgets/layout/BasicPage.dart';
5 5
 import 'package:flutter/material.dart';
6
-import 'package:flutter/services.dart';
7 6
 import 'package:flutter_easyloading/flutter_easyloading.dart';
8 7
 import 'package:flutter_screenutil/flutter_screenutil.dart';
9 8
 import 'package:fluttertoast/fluttertoast.dart';
10 9
 import 'package:get/get.dart';
11 10
 import 'package:intl/intl.dart';
12 11
 
13
-import '../../models/entities/CardListModel.dart';
14 12
 import '../../models/entities/OrderInfoModel.dart';
15 13
 import '../../services/homeAPI.dart';
16 14
 import '../../services/orderAPI.dart';
@@ -32,19 +30,19 @@ class OrderConfirmation extends BasicPage {
32 30
     super.beforeShow();
33 31
     if (Get.arguments['item'] != null) {
34 32
       item(Get.arguments['item']);
35
-    } else {
33
+    } else if (Get.arguments['id'] != null) {
36 34
       markId = Get.arguments['id'];
37 35
       EasyLoading.show(status: '数据加载中...');
38
-
39
-      getMachineryInfo(markId, appController.locationStr, true)
36
+      //苹果模拟器看不到定位所以加一个默认定位是邓州市中心位置
37
+      getMachineryInfo(Get.arguments['id'],
38
+              appController.locationStr ?? '112.091892,32.690712', true)
40 39
           .then((value) {
41 40
         item(CardInfo.fromJson(value));
42 41
         EasyLoading.dismiss();
42
+      }).catchError((error) {
43
+        EasyLoading.dismiss();
44
+        Fluttertoast.showToast(msg: error.error['message']);
43 45
       });
44
-
45
-      // item(CardInfo.fromJson(Get.arguments['item']));
46
-
47
-      return;
48 46
     }
49 47
   }
50 48
 
@@ -69,7 +67,7 @@ class OrderConfirmation extends BasicPage {
69 67
         orderInfo(OrderInfoModel.fromJson(value));
70 68
         Fluttertoast.showToast(msg: '预约成功');
71 69
         Get.offNamed('/orderPageInfo', arguments: {
72
-          'id': orderInfo().orderId,
70
+          'orderId': value['orderId'],
73 71
           'title': '待付款',
74 72
           'styleColor': Color(0xFF51D4FF)
75 73
         });
@@ -81,7 +79,7 @@ class OrderConfirmation extends BasicPage {
81 79
   @override
82 80
   Widget builder(BuildContext context) {
83 81
     naviTitle = '预约';
84
-    return Container(
82
+    return SizedBox(
85 83
       height: 700.h,
86 84
       child: Form(
87 85
         key: _formKey, //设置globalKey,用于后面获取FormState
@@ -174,7 +172,8 @@ class OrderConfirmation extends BasicPage {
174 172
                           child: Obx(
175 173
                             () => Text(selectDate == null
176 174
                                 ? '请选择日期'
177
-                                : DateFormat("yyyy-MM-dd").format(selectDate())),
175
+                                : DateFormat("yyyy-MM-dd")
176
+                                    .format(selectDate())),
178 177
                           )),
179 178
                     )
180 179
                   ],
@@ -212,8 +211,9 @@ class OrderConfirmation extends BasicPage {
212 211
                       padding: const EdgeInsets.fromLTRB(10, 0, 0, 0),
213 212
                       child: GestureDetector(
214 213
                         onTap: () {
215
-                          Get.toNamed('/addressList',
216
-                              arguments: {'isBack': true});
214
+                          Get.toNamed('/addressList', arguments: {
215
+                            'isBack': true,
216
+                          });
217 217
                         },
218 218
                         child: SizedBox(
219 219
                           width: 290.w,
@@ -277,8 +277,8 @@ class OrderConfirmation extends BasicPage {
277 277
                         fontWeight: FontWeight.bold),
278 278
                   ),
279 279
                   style: ButtonStyle(
280
-                    side: MaterialStateProperty.all(
281
-                        const BorderSide(width: 1, color: Color(0xFFFF703B))), //边框
280
+                    side: MaterialStateProperty.all(const BorderSide(
281
+                        width: 1, color: Color(0xFFFF703B))), //边框
282 282
                     elevation: MaterialStateProperty.all(0),
283 283
                     backgroundColor: MaterialStateProperty.all(Colors.white),
284 284
                     shape: MaterialStateProperty.all(

+ 10
- 8
lib/pages/addressList/index.dart Прегледај датотеку

@@ -58,13 +58,13 @@ class AddressList extends BasicPage {
58 58
         ),
59 59
         onCancel: () => true,
60 60
         onConfirm: () {
61
-              addressDelete(id).then((value) {
62
-                List<Address> list = addressController.addressList.value.toList();
63
-                list.removeWhere((element) => element.addressId == id);
64
-                addressController.addressList(list);
65
-                Fluttertoast.showToast(msg: '删除成功!');
66
-              });
67
-            });
61
+          addressDelete(id).then((value) {
62
+            List<Address> list = addressController.addressList.value.toList();
63
+            list.removeWhere((element) => element.addressId == id);
64
+            addressController.addressList(list);
65
+            Fluttertoast.showToast(msg: '删除成功!');
66
+          });
67
+        });
68 68
   }
69 69
 
70 70
   Widget buildList() {
@@ -97,7 +97,9 @@ class AddressList extends BasicPage {
97 97
         );
98 98
       }).toList();
99 99
 
100
-      return Column(children: children,);
100
+      return Column(
101
+        children: children,
102
+      );
101 103
     });
102 104
   }
103 105
 

+ 164
- 157
lib/pages/login/login.dart Прегледај датотеку

@@ -1,9 +1,7 @@
1 1
 import 'dart:async';
2
-import 'dart:ffi';
3 2
 import 'package:farmer_client/models/app.dart';
4 3
 import 'package:farmer_client/pages/home/index.dart';
5 4
 import 'package:fluttertoast/fluttertoast.dart';
6
-import 'package:flutter/gestures.dart';
7 5
 import 'package:flutter/material.dart';
8 6
 import 'package:flutter_screenutil/flutter_screenutil.dart';
9 7
 import 'package:get/get.dart';
@@ -109,7 +107,7 @@ class _RouteLogin extends State<MyRouteLogin> {
109 107
     });
110 108
   }
111 109
 
112
-  //登按钮
110
+  //登按钮
113 111
   void _handelSubmit() {
114 112
     if (handleCodes == '' || handlePhones == '') {
115 113
       Fluttertoast.showToast(msg: '请输入验证码或手机号!');
@@ -147,99 +145,53 @@ class _RouteLogin extends State<MyRouteLogin> {
147 145
               fit: BoxFit.cover,
148 146
             ),
149 147
           ),
150
-          child: Container(
151
-            child: ListView(
152
-              // mainAxisAlignment: MainAxisAlignment.end,
153
-              // crossAxisAlignment: CrossAxisAlignment.start,
154
-              children: [
155
-                Padding(
156
-                  padding: EdgeInsets.fromLTRB(15, 0, 0, 5),
157
-                  child: const Text(
158
-                    '您好!',
148
+          child: ListView(
149
+            children: [
150
+              SizedBox(
151
+                height: 44.w,
152
+                child: Center(
153
+                  child: Text(
154
+                    '登录',
159 155
                     style: TextStyle(
156
+                      letterSpacing: 3,
160 157
                       fontWeight: FontWeight.bold,
161
-                      fontSize: 33,
158
+                      color: const Color(0xFF333333),
159
+                      fontSize: 17.sp,
162 160
                     ),
163 161
                   ),
164 162
                 ),
165
-                Padding(
166
-                  padding: EdgeInsets.fromLTRB(15, 0, 0, 0),
167
-                  child: const Text(
168
-                    '欢迎进入农户端应用!',
169
-                    style: TextStyle(
170
-                      fontWeight: FontWeight.bold,
171
-                      fontSize: 27,
172
-                    ),
163
+              ),
164
+              Padding(
165
+                padding: EdgeInsets.fromLTRB(15, 0, 0, 5),
166
+                child: const Text(
167
+                  '您好!',
168
+                  style: TextStyle(
169
+                    fontWeight: FontWeight.bold,
170
+                    fontSize: 33,
173 171
                   ),
174 172
                 ),
175
-                Cell(
176
-                    // margin: EdgeInsets.symmetric(horizontal: 13.w),
177
-                    margin: const EdgeInsets.fromLTRB(13, 43, 10, 0),
178
-                    header: Text(
179
-                      "+86",
180
-                      style: TextStyle(
181
-                        fontSize: 19.sp,
182
-                      ),
183
-                    ),
184
-                    child: TextField(
185
-                      maxLength: 11,
186
-                      keyboardType: TextInputType.number,
187
-                      style: TextStyle(
188
-                        fontSize: 17.sp,
189
-                      ),
190
-                      decoration: const InputDecoration(
191
-                        isCollapsed: true,
192
-                        contentPadding:
193
-                            EdgeInsets.symmetric(vertical: 8, horizontal: 16),
194
-                        labelText: "请输入手机号码",
195
-                        counterText: '', //去掉计数
196
-                        border: InputBorder.none,
197
-                        floatingLabelBehavior: FloatingLabelBehavior.never,
198
-                      ),
199
-                      onChanged: (e) {
200
-                        _handlePhone(e);
201
-                      },
202
-                    ),
203
-                    footer: SizedBox(
204
-                      child: ElevatedButton(
205
-                        onPressed: () => {
206
-                          setState(() {
207
-                            _buttonClickListen();
208
-                          })
209
-                        },
210
-                        child: Text(
211
-                          '$buttonText',
212
-                          style: TextStyle(
213
-                            fontSize: 15.sp,
214
-                          ),
215
-                        ),
216
-                        style: ButtonStyle(
217
-                          backgroundColor: isButtonEnable
218
-                              ? MaterialStateProperty.all(
219
-                                  const Color(0xFFFF703B))
220
-                              : MaterialStateProperty.all(
221
-                                  const Color(0xFFCBCBCB)),
222
-                          shape: MaterialStateProperty.all(
223
-                              const RoundedRectangleBorder(
224
-                                  borderRadius:
225
-                                      BorderRadius.all(Radius.circular(10)))),
226
-                        ),
227
-                      ),
228
-                    )),
229
-                Cell(
173
+              ),
174
+              Padding(
175
+                padding: EdgeInsets.fromLTRB(15, 0, 0, 0),
176
+                child: const Text(
177
+                  '欢迎进入农户端应用!',
178
+                  style: TextStyle(
179
+                    fontWeight: FontWeight.bold,
180
+                    fontSize: 27,
181
+                  ),
182
+                ),
183
+              ),
184
+              Cell(
230 185
                   // margin: EdgeInsets.symmetric(horizontal: 13.w),
231
-                  margin: const EdgeInsets.fromLTRB(13, 16, 10, 0),
232
-
233
-                  header: Align(
234
-                    alignment: FractionalOffset(0.1, 0.5),
235
-                    child: Image.asset(
236
-                      'images/phoneCode.png',
237
-                      width: 20,
238
-                      height: 20,
186
+                  margin: const EdgeInsets.fromLTRB(13, 43, 10, 0),
187
+                  header: Text(
188
+                    "+86",
189
+                    style: TextStyle(
190
+                      fontSize: 19.sp,
239 191
                     ),
240 192
                   ),
241
-
242 193
                   child: TextField(
194
+                    maxLength: 11,
243 195
                     keyboardType: TextInputType.number,
244 196
                     style: TextStyle(
245 197
                       fontSize: 17.sp,
@@ -248,97 +200,152 @@ class _RouteLogin extends State<MyRouteLogin> {
248 200
                       isCollapsed: true,
249 201
                       contentPadding:
250 202
                           EdgeInsets.symmetric(vertical: 8, horizontal: 16),
251
-                      labelText: "请输入验证码",
203
+                      labelText: "请输入手机号码",
204
+                      counterText: '', //去掉计数
252 205
                       border: InputBorder.none,
253 206
                       floatingLabelBehavior: FloatingLabelBehavior.never,
254 207
                     ),
255 208
                     onChanged: (e) {
256
-                      _handleCode(e);
209
+                      _handlePhone(e);
257 210
                     },
258 211
                   ),
259
-                ),
260
-                Container(
261
-                  height: 350.h,
262
-                  alignment: Alignment.bottomCenter,
263
-                  child: SizedBox(
264
-                    width: 315.w,
265
-                    height: 49.h,
212
+                  footer: SizedBox(
266 213
                     child: ElevatedButton(
267
-                      onPressed: () {
268
-                        _handelSubmit();
214
+                      onPressed: () => {
215
+                        setState(() {
216
+                          _buttonClickListen();
217
+                        })
269 218
                       },
270
-                      child: const Text(
271
-                        "登陆",
219
+                      child: Text(
220
+                        '$buttonText',
272 221
                         style: TextStyle(
273
-                            fontSize: 18,
274
-                            color: Colors.white,
275
-                            fontWeight: FontWeight.bold),
222
+                          fontSize: 15.sp,
223
+                        ),
276 224
                       ),
277 225
                       style: ButtonStyle(
278
-                        elevation: MaterialStateProperty.all(0),
279
-                        backgroundColor:
280
-                            MaterialStateProperty.all(const Color(0xFFFF703B)),
226
+                        backgroundColor: isButtonEnable
227
+                            ? MaterialStateProperty.all(const Color(0xFFFF703B))
228
+                            : MaterialStateProperty.all(
229
+                                const Color(0xFFCBCBCB)),
281 230
                         shape: MaterialStateProperty.all(
282 231
                             const RoundedRectangleBorder(
283 232
                                 borderRadius:
284
-                                    BorderRadius.all(Radius.circular(24.4)))),
233
+                                    BorderRadius.all(Radius.circular(10)))),
285 234
                       ),
286 235
                     ),
236
+                  )),
237
+              Cell(
238
+                // margin: EdgeInsets.symmetric(horizontal: 13.w),
239
+                margin: const EdgeInsets.fromLTRB(13, 16, 10, 0),
240
+
241
+                header: Align(
242
+                  alignment: FractionalOffset(0.1, 0.5),
243
+                  child: Image.asset(
244
+                    'images/phoneCode.png',
245
+                    width: 20,
246
+                    height: 20,
287 247
                   ),
288 248
                 ),
289
-                Container(
290
-                    padding: EdgeInsets.fromLTRB(10.0, 10, 0, 10),
291
-                    child: Row(
292
-                      children: <Widget>[
293
-                        Radio<bool>(
294
-                            value: true,
295
-                            activeColor: Color(0xFFFF703B),
296
-                            groupValue: _newValue,
297
-                            onChanged: (value) {
298
-                              setState(() {
299
-                                _newValue = value!;
300
-                              });
301
-                            }),
302
-                        // SizedBox(
303
-                        //   child:Text('文本协议/隐私政策',style: TextStyle(fontSize:15.sp,color: Color(0xffce3800))),
304
-                        // ),
305
-                        Text('请认真查看',
306
-                            style: TextStyle(
307
-                                fontSize: 14.sp, color: Color(0xff2a2a2a))),
308
-                        GestureDetector(
309
-                          onTap: () {
310
-                            Get.toNamed('/agreement');
311
-                          },
312
-                          child: Text('文本协议/隐私政策',
313
-                              style: TextStyle(
314
-                                  fontSize: 14.sp, color: Color(0xffce3800))),
315
-                        ),
316
-                        Text(',确认之后选择此项',
249
+
250
+                child: TextField(
251
+                  keyboardType: TextInputType.number,
252
+                  style: TextStyle(
253
+                    fontSize: 17.sp,
254
+                  ),
255
+                  decoration: const InputDecoration(
256
+                    isCollapsed: true,
257
+                    contentPadding:
258
+                        EdgeInsets.symmetric(vertical: 8, horizontal: 16),
259
+                    labelText: "请输入验证码",
260
+                    border: InputBorder.none,
261
+                    floatingLabelBehavior: FloatingLabelBehavior.never,
262
+                  ),
263
+                  onChanged: (e) {
264
+                    _handleCode(e);
265
+                  },
266
+                ),
267
+              ),
268
+              Container(
269
+                height: 350.h,
270
+                alignment: Alignment.bottomCenter,
271
+                child: SizedBox(
272
+                  width: 315.w,
273
+                  height: 49.h,
274
+                  child: ElevatedButton(
275
+                    onPressed: () {
276
+                      _handelSubmit();
277
+                    },
278
+                    child: const Text(
279
+                      "登录",
280
+                      style: TextStyle(
281
+                          fontSize: 18,
282
+                          color: Colors.white,
283
+                          fontWeight: FontWeight.bold),
284
+                    ),
285
+                    style: ButtonStyle(
286
+                      elevation: MaterialStateProperty.all(0),
287
+                      backgroundColor:
288
+                          MaterialStateProperty.all(const Color(0xFFFF703B)),
289
+                      shape: MaterialStateProperty.all(
290
+                          const RoundedRectangleBorder(
291
+                              borderRadius:
292
+                                  BorderRadius.all(Radius.circular(24.4)))),
293
+                    ),
294
+                  ),
295
+                ),
296
+              ),
297
+              Container(
298
+                  padding: EdgeInsets.fromLTRB(10.0, 10, 0, 10),
299
+                  child: Row(
300
+                    children: <Widget>[
301
+                      Radio<bool>(
302
+                          value: true,
303
+                          activeColor: Color(0xFFFF703B),
304
+                          groupValue: _newValue,
305
+                          onChanged: (value) {
306
+                            setState(() {
307
+                              _newValue = value!;
308
+                            });
309
+                          }),
310
+                      // SizedBox(
311
+                      //   child:Text('文本协议/隐私政策',style: TextStyle(fontSize:15.sp,color: Color(0xffce3800))),
312
+                      // ),
313
+                      Text('请认真查看',
314
+                          style: TextStyle(
315
+                              fontSize: 14.sp, color: Color(0xff2a2a2a))),
316
+                      GestureDetector(
317
+                        onTap: () {
318
+                          Get.toNamed('/agreement');
319
+                        },
320
+                        child: Text('文本协议/隐私政策',
317 321
                             style: TextStyle(
318
-                                fontSize: 14.sp, color: Color(0xff2a2a2a))),
319
-                        // RichText(
320
-                        //   text: TextSpan(children: <InlineSpan>[
321
-                        //     const TextSpan(
322
-                        //         text: '请认真查看',
323
-                        //         style: TextStyle(color: Color(0xff2a2a2a))),
324
-                        //     TextSpan(
325
-                        //       text: '文本协议/隐私政策,',
326
-                        //       style: TextStyle(color: Color(0xffce3800)),
327
-                        //       recognizer:
328
-                        //           TapGestureRecognizer() //踩坑。。。recognizer 是手势交互 除了我现在些的是 点击交互,其他一般都是抽象类。
329
-                        //             ..onTap = () {
330
-                        //               Get.toNamed('/agreement');
331
-                        //             },
332
-                        //     ),
333
-                        //     const TextSpan(
334
-                        //         text: '确认之后选择此项',
335
-                        //         style: TextStyle(color: Color(0xff2a2a2a))),
336
-                        //   ]),
337
-                        // ),
338
-                      ],
339
-                    )),
340
-              ],
341
-            ),
322
+                                fontSize: 14.sp, color: Color(0xffce3800))),
323
+                      ),
324
+                      Text(',确认之后选择此项',
325
+                          style: TextStyle(
326
+                              fontSize: 14.sp, color: Color(0xff2a2a2a))),
327
+                      // RichText(
328
+                      //   text: TextSpan(children: <InlineSpan>[
329
+                      //     const TextSpan(
330
+                      //         text: '请认真查看',
331
+                      //         style: TextStyle(color: Color(0xff2a2a2a))),
332
+                      //     TextSpan(
333
+                      //       text: '文本协议/隐私政策,',
334
+                      //       style: TextStyle(color: Color(0xffce3800)),
335
+                      //       recognizer:
336
+                      //           TapGestureRecognizer() //踩坑。。。recognizer 是手势交互 除了我现在些的是 点击交互,其他一般都是抽象类。
337
+                      //             ..onTap = () {
338
+                      //               Get.toNamed('/agreement');
339
+                      //             },
340
+                      //     ),
341
+                      //     const TextSpan(
342
+                      //         text: '确认之后选择此项',
343
+                      //         style: TextStyle(color: Color(0xff2a2a2a))),
344
+                      //   ]),
345
+                      // ),
346
+                    ],
347
+                  )),
348
+            ],
342 349
           ),
343 350
         ),
344 351
       ),

+ 6
- 2
lib/pages/machinery/detail/index.dart Прегледај датотеку

@@ -3,6 +3,7 @@ import 'package:farmer_client/models/entities/CardInfo.dart';
3 3
 import 'package:farmer_client/widgets/layout/BasicPage.dart';
4 4
 import 'package:flutter/material.dart';
5 5
 import 'package:flutter_easyloading/flutter_easyloading.dart';
6
+import 'package:fluttertoast/fluttertoast.dart';
6 7
 import 'package:get/get.dart';
7 8
 import '../../../services/homeAPI.dart';
8 9
 import 'widgets/detail.dart';
@@ -31,13 +32,16 @@ class MachineryDetailPage extends BasicPage {
31 32
       markId = Get.arguments['id'];
32 33
       marKm = Get.arguments['km'];
33 34
       print(marKm);
34
-      getMachineryInfo(markId, appController.locationStr, true)
35
+      getMachineryInfo(
36
+              markId, appController.locationStr ?? '112.091892,32.690712', true)
35 37
           .then((value) {
36 38
         machineryInfoContent(CardInfo.fromJson(value));
37 39
         machineryListBanner(machineryInfoContent().imagesList!);
38 40
         machineryListContent(machineryInfoContent().contentList!);
39 41
         EasyLoading.dismiss();
40
-
42
+      }).catchError((error) {
43
+        EasyLoading.dismiss();
44
+        Fluttertoast.showToast(msg: error.error['message']);
41 45
       });
42 46
     }
43 47
     print("----show----detail page--------------");

+ 3
- 7
lib/pages/machinery/detail/widgets/detail.dart Прегледај датотеку

@@ -5,8 +5,6 @@ import 'package:flutter/widgets.dart';
5 5
 import 'package:flutter/material.dart';
6 6
 import 'package:flutter_screenutil/flutter_screenutil.dart';
7 7
 import 'package:farmer_client/widgets/ExtendContentList.dart';
8
-import 'package:farmer_client/models/entities/ExtendContent.dart';
9
-import 'package:get/get.dart';
10 8
 import '../../../../models/entities/CardInfo.dart';
11 9
 import '../../widgets/summary.dart';
12 10
 
@@ -20,11 +18,9 @@ Widget page(
20 18
   return DefLayout(
21 19
       head: CarouselSlider(
22 20
         items: bnnerItem
23
-            .map((item) => Container(
24
-                  child: Center(
25
-                      child: Image.network(item.url.toString(),
26
-                          fit: BoxFit.fitWidth, width: 370.w)),
27
-                ))
21
+            .map((item) => Center(
22
+                child: Image.network(item.url.toString(),
23
+                    fit: BoxFit.fitWidth, width: 370.w)))
28 24
             .toList(),
29 25
         options: CarouselOptions(
30 26
           autoPlay: true,

+ 6
- 2
lib/pages/machinery/map/index.dart Прегледај датотеку

@@ -3,6 +3,7 @@ import 'package:farmer_client/pages/machinery/map/widgets/detail.dart';
3 3
 import 'package:farmer_client/widgets/layout/BasicPage.dart';
4 4
 import 'package:flutter/material.dart';
5 5
 import 'package:flutter_easyloading/flutter_easyloading.dart';
6
+import 'package:fluttertoast/fluttertoast.dart';
6 7
 import 'package:get/get.dart';
7 8
 
8 9
 import '../../../models/entities/CardInfo.dart';
@@ -31,11 +32,14 @@ class MachineryMapPage extends BasicPage {
31 32
       markId = Get.arguments['id'];
32 33
       marKm = Get.arguments['km'];
33 34
       print(marKm);
34
-      getMachineryInfo(markId, appController.locationStr, true)
35
+      getMachineryInfo(
36
+              markId, appController.locationStr ?? '112.091892,32.690712', true)
35 37
           .then((value) {
36 38
         machineryInfoContent(CardInfo.fromJson(value));
37 39
         EasyLoading.dismiss();
38
-
40
+      }).catchError((error) {
41
+        EasyLoading.dismiss();
42
+        Fluttertoast.showToast(msg: error.error['message']);
39 43
       });
40 44
     }
41 45
     print("----show----map page--------------");

+ 1
- 0
lib/pages/machinery/map/widgets/detail.dart Прегледај датотеку

@@ -27,6 +27,7 @@ Widget page(
27 27
       height: DefLayout.headHeight,
28 28
       child: Image.network(
29 29
         item.thumb.toString(),
30
+        width:375.w,
30 31
         fit: BoxFit.cover,
31 32
         errorBuilder: (ctx, exception, stackTrace) {
32 33
           return Container(); //THE WIDGET YOU WANT TO SHOW IF URL NOT RETURN IMAGE

+ 9
- 7
lib/pages/main/widgets/main/index.dart Прегледај датотеку

@@ -15,13 +15,12 @@ class MainPage extends StatelessWidget {
15 15
 
16 16
   GetStorage box = GetStorage();
17 17
 
18
-
19 18
   void _userOut() {
20 19
     modal.showDialog(
21 20
         title: '提示',
22 21
         content: Container(
23 22
           alignment: Alignment.center,
24
-          child: Text('确定要退出登吗?'),
23
+          child: Text('确定要退出登吗?'),
25 24
         ),
26 25
         onCancel: () => true,
27 26
         onConfirm: () => {
@@ -43,9 +42,10 @@ class MainPage extends StatelessWidget {
43 42
               OtherColumn(), //功能菜单栏
44 43
               Card(
45 44
                 //设置圆角
46
-                shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(20.0)),
45
+                shape: RoundedRectangleBorder(
46
+                    borderRadius: BorderRadius.circular(20.0)),
47 47
                 // 普通的边
48
-                elevation: 1,// 阴影大小
48
+                elevation: 1, // 阴影大小
49 49
                 // height: 70.h,
50 50
                 margin: EdgeInsets.only(top: 10, bottom: 40.0),
51 51
                 child: SizedBox(
@@ -56,7 +56,7 @@ class MainPage extends StatelessWidget {
56 56
                       _userOut();
57 57
                     },
58 58
                     child: const Text(
59
-                      "退出登",
59
+                      "退出登",
60 60
                       style: TextStyle(
61 61
                           fontSize: 18,
62 62
                           color: Colors.black,
@@ -76,8 +76,10 @@ class MainPage extends StatelessWidget {
76 76
               ),
77 77
               Container(
78 78
                 margin: EdgeInsets.fromLTRB(0, 5, 0, 15),
79
-                child: Text('南京市云致科技有限公司 提供技术支持',style: TextStyle(fontSize: 15.sp,color: Color(
80
-                    0xff999999)),),
79
+                child: Text(
80
+                  '南京市云致科技有限公司 提供技术支持',
81
+                  style: TextStyle(fontSize: 15.sp, color: Color(0xff999999)),
82
+                ),
81 83
               )
82 84
             ],
83 85
           ),

+ 1
- 1
lib/pages/main/widgets/main/widgets/UserInfo.dart Прегледај датотеку

@@ -108,7 +108,7 @@ class UserInfo extends StatelessWidget {
108 108
                       ),
109 109
                     ),
110 110
                     // const Text(
111
-                    //      '点击登',
111
+                    //      '点击登',
112 112
                     //      style: TextStyle(
113 113
                     //        color: Colors.white,
114 114
                     //        fontSize: 17,

+ 0
- 1
lib/pages/order/index.dart Прегледај датотеку

@@ -1,7 +1,6 @@
1 1
 import 'package:farmer_client/pages/order/widgets/index.dart';
2 2
 import 'package:flutter/material.dart';
3 3
 import 'package:get/get.dart';
4
-import 'package:get/get_rx/src/rx_types/rx_types.dart';
5 4
 import 'package:farmer_client/models/entities/OrderInfoModel.dart';
6 5
 import 'package:farmer_client/services/orderAPI.dart';
7 6
 import 'package:farmer_client/widgets/OrderListCard.dart';

+ 16
- 24
lib/pages/order/widgets/index.dart Прегледај датотеку

@@ -7,36 +7,28 @@ class OrderHead extends StatelessWidget {
7 7
   @override
8 8
   Widget build(BuildContext context) {
9 9
     return Container(
10
-      padding: EdgeInsets.fromLTRB(15, 0, 15, 0),
10
+      padding: const EdgeInsets.fromLTRB(15, 0, 15, 0),
11 11
       height: 55.w,
12
-      decoration: BoxDecoration(color: Colors.white),
12
+      decoration: const BoxDecoration(color: Colors.white),
13 13
       child: Row(
14
-        mainAxisAlignment: MainAxisAlignment.spaceBetween,
15 14
         children: [
16
-          Row(
17
-            children: [
18
-              Padding(
19
-                padding: EdgeInsets.fromLTRB(0, 0, 8, 0),
20
-                child: Image(
21
-                  image: AssetImage('images/ordersListImga.png'),
22
-                  fit: BoxFit.cover,
23
-                  width: 18.w,
24
-                ),
25
-              ),
26
-              Text(
27
-                '订单列表',
28
-                style: TextStyle(
29
-                    color: Color(0xff222222),
30
-                    fontSize: 20.sp,
31
-                    fontWeight: FontWeight.bold),
32
-              )
33
-            ],
15
+          Padding(
16
+            padding: const EdgeInsets.fromLTRB(0, 0, 8, 0),
17
+            child: Image(
18
+              image: const AssetImage('images/ordersListImga.png'),
19
+              fit: BoxFit.cover,
20
+              width: 18.w,
21
+            ),
34 22
           ),
23
+          Text(
24
+            '订单列表',
25
+            style: TextStyle(
26
+                color: const Color(0xff222222),
27
+                fontSize: 20.sp,
28
+                fontWeight: FontWeight.bold),
29
+          )
35 30
         ],
36 31
       ),
37 32
     );
38
-
39 33
   }
40 34
 }
41
-
42
-

+ 114
- 126
lib/pages/orderInfo/index.dart Прегледај датотеку

@@ -22,24 +22,24 @@ class OrderPageInfo extends BasicPage {
22 22
   final id = Rx<String>('');
23 23
   final orderStateText = Rx<String>('待支付');
24 24
   final orderStateColor = Rx<Color>(Colors.black);
25
-  final orderInfoContent = Rx<OrderInfoModel>(OrderInfoModel());
25
+  final orderInfoContent = Rx<OrderInfoModel>(OrderInfoModel.fromJson(
26
+      {'status': 6, 'dispatchStatus': 6, 'workStatus': 6}));
27
+
26 28
   final evalText = Rx<String>('');
27 29
   final evalStars = Rx<num>(-1);
28
-  var processStatus;
29 30
 
30 31
   // orderStates
31 32
   @override
32 33
   void beforeShow() {
33 34
     // TODO: implement beforeShow
34 35
     super.beforeShow();
35
-    if (Get.arguments['id'] != null) {
36
-      id(Get.arguments['id']);
36
+    if (Get.arguments != null && Get.arguments['orderId'] != null) {
37
+      id(Get.arguments['orderId']);
37 38
 
38
-      orderInfo(id()).then((value) {
39
+      orderInfo(Get.arguments['orderId']).then((value) {
39 40
         EasyLoading.show(status: '数据加载中...');
40 41
         OrderInfoModel orderInfo = OrderInfoModel.fromJson(value);
41
-        processStatus = getProcessStatus(orderInfo);
42
-        ProcessSign processSign = getProcessSign(processStatus);
42
+        ProcessSign processSign = getProcessSign(getProcessStatus(orderInfo));
43 43
         orderStateText(processSign.label);
44 44
         orderStateColor(processSign.color);
45 45
         orderInfoContent(orderInfo);
@@ -48,6 +48,57 @@ class OrderPageInfo extends BasicPage {
48 48
     }
49 49
   }
50 50
 
51
+  Widget _action(BuildContext context, String orderId) {
52
+    bool mustAction = false;
53
+    var btnLabel;
54
+    var btnFunction;
55
+
56
+    switch (getProcessStatus(orderInfoContent.value)) {
57
+      case 1:
58
+      case 2:
59
+        mustAction = true;
60
+        btnLabel = '取消';
61
+        btnFunction = () {
62
+          _cancelOrder(orderId);
63
+        };
64
+        break;
65
+      case 4:
66
+        mustAction = true;
67
+        btnLabel = '支付';
68
+        btnFunction = () {
69
+          _bottomSheet(context);
70
+        };
71
+        break;
72
+      case 5:
73
+        mustAction = true;
74
+        btnLabel = '评价';
75
+        btnFunction = () {
76
+          _fnEvaluate(orderId);
77
+        };
78
+        break;
79
+      case 3:
80
+      case 6:
81
+      default:
82
+        break;
83
+    }
84
+
85
+    if (mustAction) {
86
+      return DefaultButton(
87
+        color: const Color(0xffffffff),
88
+        backColor: const Color(0xFFFF703B),
89
+        width: 300.w,
90
+        height: 49.h,
91
+        text: btnLabel,
92
+        margin: const EdgeInsets.all(0),
93
+        fontSize: 20.sp,
94
+        radius: 24.5.w,
95
+        onPressed: btnFunction,
96
+      );
97
+    } else {
98
+      return const Text('');
99
+    }
100
+  }
101
+
51 102
   @override
52 103
   Widget builder(BuildContext context) {
53 104
     naviTitle = '订单详情';
@@ -79,11 +130,11 @@ class OrderPageInfo extends BasicPage {
79 130
         ),
80 131
         onCancel: () => true,
81 132
         onConfirm: () => {
82
-          orderDelete(orderId).then((value) {
83
-            Fluttertoast.showToast(msg: '订单取消成功!');
84
-            Get.offAllNamed('/order');
85
-          })
86
-        });
133
+              orderDelete(orderId).then((value) {
134
+                Fluttertoast.showToast(msg: '订单取消成功!');
135
+                Get.offAllNamed('/order');
136
+              })
137
+            });
87 138
   }
88 139
 
89 140
   // 满意度表单
@@ -94,38 +145,30 @@ class OrderPageInfo extends BasicPage {
94 145
     return Container(
95 146
         alignment: Alignment.center,
96 147
         child: Container(
97
-          margin:
98
-          const EdgeInsets.fromLTRB(15, 20, 15, 20),
148
+          margin: const EdgeInsets.fromLTRB(15, 20, 15, 20),
99 149
           child: Column(
100 150
             children: [
101 151
               Container(
102
-                padding: const EdgeInsets.fromLTRB(
103
-                    0, 0, 0, 10),
152
+                padding: const EdgeInsets.fromLTRB(0, 0, 0, 10),
104 153
                 decoration: const BoxDecoration(
105 154
                     border: Border(
106
-                        bottom: BorderSide(
107
-                            width: 0.8,
108
-                            color: Color(0x20000000)
109
-                          // 0x17000000
110
-                        ))),
155
+                        bottom: BorderSide(width: 0.8, color: Color(0x20000000)
156
+                            // 0x17000000
157
+                            ))),
111 158
                 child: Row(
112 159
                   children: [
113 160
                     Text(
114 161
                       '满意度:',
115 162
                       style: TextStyle(
116
-                          fontSize: 17.sp,
117
-                          fontWeight: FontWeight.bold),
163
+                          fontSize: 17.sp, fontWeight: FontWeight.bold),
118 164
                     ),
119 165
                     FFStars(
120 166
                       //https://pub.dev/packages/ff_stars
121
-                      normalStar: Image.asset(
122
-                          'images/icons/starOff.png'),
123
-                      selectedStar: Image.asset(
124
-                          'images/icons/starOn.png'),
125
-                      starsChanged:
126
-                          (realStars, selectedStars) {
127
-                            star = realStars;
128
-                            onEvaluate(star, desc);
167
+                      normalStar: Image.asset('images/icons/starOff.png'),
168
+                      selectedStar: Image.asset('images/icons/starOn.png'),
169
+                      starsChanged: (realStars, selectedStars) {
170
+                        star = realStars;
171
+                        onEvaluate(star, desc);
129 172
                       },
130 173
                       step: 1,
131 174
                       defaultStars: 0,
@@ -134,8 +177,7 @@ class OrderPageInfo extends BasicPage {
134 177
                 ),
135 178
               ),
136 179
               Container(
137
-                margin: const EdgeInsets.fromLTRB(
138
-                    0, 20, 0, 0),
180
+                margin: const EdgeInsets.fromLTRB(0, 20, 0, 0),
139 181
                 width: 300.w,
140 182
                 height: 100.w,
141 183
                 decoration: BoxDecoration(
@@ -147,15 +189,13 @@ class OrderPageInfo extends BasicPage {
147 189
                 child: TextField(
148 190
                   minLines: 6,
149 191
                   maxLines: 6,
150
-                  style: TextStyle(
151
-                      fontSize: 17.sp, height: 1.5),
192
+                  style: TextStyle(fontSize: 17.sp, height: 1.5),
152 193
                   decoration: const InputDecoration(
153 194
                     isCollapsed: true,
154 195
                     border: InputBorder.none,
155 196
                     counterText: '',
156 197
                     hintText: '请输入评价内容',
157
-                    floatingLabelBehavior:
158
-                    FloatingLabelBehavior.never,
198
+                    floatingLabelBehavior: FloatingLabelBehavior.never,
159 199
                   ),
160 200
                   onChanged: (e) {
161 201
                     desc = e;
@@ -170,10 +210,10 @@ class OrderPageInfo extends BasicPage {
170 210
 
171 211
   // 评价
172 212
   _fnEvaluate(String orderId) {
173
-    int evalStars = -1;
213
+    double evalStars = -1;
174 214
     String evalText = '';
175 215
 
176
-    onEvaluate(int val1, String val2) {
216
+    onEvaluate(double val1, String val2) {
177 217
       evalStars = val1;
178 218
       evalText = val2;
179 219
     }
@@ -184,9 +224,7 @@ class OrderPageInfo extends BasicPage {
184 224
       onCancel: () => true,
185 225
       onConfirm: () {
186 226
         if (evalStars != -1 && evalText != '') {
187
-          orderEvaluation(
188
-              orderId, evalStars, evalText)
189
-              .then((value) {
227
+          orderEvaluation(orderId, evalStars, evalText).then((value) {
190 228
             Fluttertoast.showToast(msg: '评价成功!');
191 229
             Get.offAllNamed('/order');
192 230
           });
@@ -199,15 +237,16 @@ class OrderPageInfo extends BasicPage {
199 237
   }
200 238
 
201 239
   // 调用支付接口
202
-  Future<void> payMoney (String payType) async {
203
-    if(payType=='wxPay'){
204
-      final isInstall=await fluwx.isWeChatInstalled;
205
-      if(!isInstall){
240
+  Future<void> payMoney(String payType) async {
241
+    if (payType == 'wxPay') {
242
+      final isInstall = await fluwx.isWeChatInstalled;
243
+      if (!isInstall) {
206 244
         EasyLoading.showError('请先安装微信');
207 245
         return;
208 246
       }
209 247
       createOrder(id.value, "wx").then((value) {
210
-        fluwx.payWithWeChat(
248
+        fluwx
249
+            .payWithWeChat(
211 250
           appId: value['appid'].toString(),
212 251
           partnerId: value['partnerId'].toString(),
213 252
           prepayId: value['prepayId'].toString(),
@@ -215,9 +254,10 @@ class OrderPageInfo extends BasicPage {
215 254
           nonceStr: value['noncestr'].toString(),
216 255
           timeStamp: int.parse(value['timestamp'].toString()),
217 256
           sign: value['sign'].toString(),
218
-        ).then((res) {
257
+        )
258
+            .then((res) {
219 259
           print("payWithWeChat--------${res}");
220
-        }).catchError((onError){
260
+        }).catchError((onError) {
221 261
           print("payWithWeChat错误--------${onError}");
222 262
         });
223 263
       });
@@ -230,16 +270,15 @@ class OrderPageInfo extends BasicPage {
230 270
           // EasyLoading.showSuccess('支付成功');
231 271
           Get.snackbar('提示', "支付成功");
232 272
           Get.offAllNamed('/order');
233
-        }else{
234
-
273
+        } else {
235 274
           EasyLoading.showError('支付失败');
236 275
         }
237 276
         // 关闭弹窗
238 277
       });
239 278
       return;
240
-    } else if(payType=='aliPay'){
241
-      final isInstall=await tobias.isAliPayInstalled();
242
-      if(!isInstall){
279
+    } else if (payType == 'aliPay') {
280
+      final isInstall = await tobias.isAliPayInstalled();
281
+      if (!isInstall) {
243 282
         EasyLoading.showError('请先安装支付宝');
244 283
         return;
245 284
       }
@@ -273,79 +312,28 @@ class OrderPageInfo extends BasicPage {
273 312
             height: 200.w, //对话框高度就是此高度
274 313
             child: Center(
275 314
                 child: Column(
276
-                  children: [
277
-                    Padding(
278
-                      padding: EdgeInsets.fromLTRB(0, 25.w, 0, 34.w),
279
-                      child: Bold(text: "支付方式", fontSize: 17.sp),
280
-                    ),
281
-                    PayItem(
282
-                      label: "支付宝",
283
-                      icon: const AssetImage('images/alipay.png'),
284
-                      onPress: () {
285
-                        payMoney('aliPay');
286
-                      },
287
-                    ),
288
-                    PayItem(
289
-                      label: "微信",
290
-                      icon: const AssetImage('images/weChatPay.png'),
291
-                      onPress: () {
292
-                        payMoney('wxPay');
293
-                      },
294
-                    ),
295
-                  ],
296
-                )),
315
+              children: [
316
+                Padding(
317
+                  padding: EdgeInsets.fromLTRB(0, 25.w, 0, 34.w),
318
+                  child: Bold(text: "支付方式", fontSize: 17.sp),
319
+                ),
320
+                PayItem(
321
+                  label: "支付宝",
322
+                  icon: const AssetImage('images/alipay.png'),
323
+                  onPress: () {
324
+                    payMoney('aliPay');
325
+                  },
326
+                ),
327
+                PayItem(
328
+                  label: "微信",
329
+                  icon: const AssetImage('images/weChatPay.png'),
330
+                  onPress: () {
331
+                    payMoney('wxPay');
332
+                  },
333
+                ),
334
+              ],
335
+            )),
297 336
           );
298 337
         });
299 338
   }
300
-
301
-  Widget _action(BuildContext context, String orderId) {
302
-    bool mustAction = false;
303
-    var btnLabel;
304
-    var btnFunction;
305
-
306
-    switch (processStatus) {
307
-      case 1:
308
-      case 2:
309
-        mustAction = true;
310
-        btnLabel = '取消';
311
-        btnFunction = () {
312
-          _cancelOrder(orderId);
313
-        };
314
-        break;
315
-      case 4:
316
-        mustAction = true;
317
-        btnLabel = '支付';
318
-        btnFunction = () {
319
-          _bottomSheet(context);
320
-        };
321
-        break;
322
-      case 5:
323
-        mustAction = true;
324
-        btnLabel = '评价';
325
-        btnFunction = () {
326
-          _fnEvaluate(orderId);
327
-        };
328
-        break;
329
-      case 3:
330
-      case 6:
331
-      default:
332
-        break;
333
-    }
334
-
335
-    if (mustAction) {
336
-      return DefaultButton(
337
-        color: const Color(0xffffffff),
338
-        backColor: const Color(0xFFFF703B),
339
-        width: 300.w,
340
-        height: 49.h,
341
-        text: btnLabel,
342
-        margin: const EdgeInsets.all(0),
343
-        fontSize: 20.sp,
344
-        radius: 24.5.w,
345
-        onPressed: btnFunction,
346
-      );
347
-    } else {
348
-      return const Text('');
349
-    }
350
-  }
351 339
 }

+ 8
- 5
lib/pages/userInfo/index.dart Прегледај датотеку

@@ -20,10 +20,12 @@ class UserInfo extends BasicPage {
20 20
   @override
21 21
   void beforeShow() {
22 22
     super.beforeShow();
23
-    _cName = TextEditingController(text: userInfo.user().nickName.toString());
24
-    _cPhone = TextEditingController(text: userInfo.user().phone.toString());
25
-    name = userInfo.user().nickName.toString();
23
+    name = userInfo.user().nickName != null
24
+        ? userInfo.user().nickName.toString()
25
+        : '';
26 26
     phone = userInfo.user().phone.toString();
27
+    _cName = TextEditingController(text: name);
28
+    _cPhone = TextEditingController(text: phone);
27 29
   }
28 30
 
29 31
   bool disableLogin = false;
@@ -41,7 +43,6 @@ class UserInfo extends BasicPage {
41 43
     } else {
42 44
       data = {
43 45
         ...userInfo.user().toJson(),
44
-        'avatar': userInfo.user().avatar ?? '',
45 46
         'nickName': name,
46 47
         'phone': phone
47 48
       };
@@ -134,7 +135,7 @@ class UserInfo extends BasicPage {
134 135
                   Row(
135 136
                       mainAxisAlignment: MainAxisAlignment.spaceBetween,
136 137
                       children: [
137
-                        Container(
138
+                        SizedBox(
138 139
                           width: 327.w,
139 140
                           child: TextField(
140 141
                             controller: _cName,
@@ -158,6 +159,7 @@ class UserInfo extends BasicPage {
158 159
                           ),
159 160
                         ),
160 161
                         GestureDetector(
162
+                          behavior: HitTestBehavior.opaque,
161 163
                           onTap: () {
162 164
                             name = '';
163 165
                             _cName.clear();
@@ -223,6 +225,7 @@ class UserInfo extends BasicPage {
223 225
                           ),
224 226
                         ),
225 227
                         GestureDetector(
228
+                          behavior: HitTestBehavior.opaque,
226 229
                           onTap: () {
227 230
                             phone = '';
228 231
                             _cPhone.clear();

+ 11
- 17
lib/services/homeAPI.dart Прегледај датотеку

@@ -34,15 +34,14 @@ Future getMachinery(params) async {
34 34
  * @param {*} data
35 35
  * @returns
36 36
  */
37
-Future searchMachinery(
38
-    params
39
-) async {
37
+Future searchMachinery(params) async {
40 38
   return request('/machinery',
41
-      options: Options(method: 'GET'),
42
-      queryParameters: params,
43
-      data: params).catchError((error) => {
44
-        Fluttertoast.showToast(msg: error.error['message']),
45
-      });
39
+          options: Options(method: 'GET'),
40
+          queryParameters: params,
41
+          data: params)
42
+      .catchError((error) => {
43
+            Fluttertoast.showToast(msg: error.error['message']),
44
+          });
46 45
 }
47 46
 
48 47
 /**
@@ -76,11 +75,8 @@ Future typeMachinery(
76 75
 
77 76
 Future getMachineryInfo(String id, String location, bool attached) async {
78 77
   return request('/machinery-summary/$id',
79
-          options: Options(method: 'GET'),
80
-          queryParameters: {'location': location, 'attached': attached})
81
-      .catchError((error) => {
82
-            Fluttertoast.showToast(msg: error.error['message']),
83
-          });
78
+      options: Options(method: 'GET'),
79
+      queryParameters: {'location': location, 'attached': attached});
84 80
 }
85 81
 
86 82
 /**
@@ -89,8 +85,6 @@ Future getMachineryInfo(String id, String location, bool attached) async {
89 85
  * @returns
90 86
  */
91 87
 Future getMachineryType(params) async {
92
-  return request('/machinery-type', options: Options(method: 'GET'),queryParameters: params);
88
+  return request('/machinery-type',
89
+      options: Options(method: 'GET'), queryParameters: params);
93 90
 }
94
-
95
-
96
-

+ 2
- 2
lib/services/user.dart Прегледај датотеку

@@ -12,14 +12,14 @@ Future getSMSCaptch(String phone) async {
12 12
   });
13 13
 }
14 14
 
15
-//登
15
+//登
16 16
 Future userLogin(String userName, String password) async {
17 17
   return request(
18 18
     '/login',
19 19
     options: Options(method: 'POST'),
20 20
     data: {'userName': userName, 'password': password},
21 21
   ).catchError((error) => {
22
-        Fluttertoast.showToast(msg: error.error['message']),
22
+        Fluttertoast.showToast(msg: error['message']),
23 23
       });
24 24
 }
25 25
 

+ 8
- 0
lib/utils/Request.dart Прегледај датотеку

@@ -1,6 +1,7 @@
1 1
 import 'dart:convert';
2 2
 
3 3
 import 'package:dio/dio.dart';
4
+import 'package:fluttertoast/fluttertoast.dart';
4 5
 import 'package:get/get.dart';
5 6
 import 'package:get_storage/get_storage.dart';
6 7
 
@@ -39,6 +40,7 @@ Dio createRequest() {
39 40
   );
40 41
 
41 42
   var dio = Dio(options);
43
+  GetStorage box = GetStorage();
42 44
   dio.interceptors.add(InterceptorsWrapper(onRequest: (options, handler) {
43 45
     // Do something before request is sent
44 46
     options.headers['Authorization'] = GetStorage().read("token");
@@ -50,6 +52,12 @@ Dio createRequest() {
50 52
     // you can reject a `DioError` object eg: `handler.reject(dioError)`
51 53
   }, onResponse: (response, handler) {
52 54
     var resp = response.data as Map<String, dynamic>;
55
+    if(resp['code']==1001){
56
+      Fluttertoast.showToast(msg: '登录过期请重新登录!');
57
+      box.remove('token');
58
+      Get.offAllNamed('/login');
59
+      return handler.next(response);
60
+    }
53 61
     if (resp['code'] == 1000) {
54 62
       response.data = resp['data'];
55 63
 

+ 9
- 0
lib/utils/location.dart Прегледај датотеку

@@ -33,6 +33,12 @@ void showPrivacy() {
33 33
 
34 34
 // 判断定位权限
35 35
 Future _requirePermission() async {
36
+  print(1);
37
+  // print(Permission.location);
38
+  print(2);
39
+  // print(Permission.locationAlways);
40
+  print(3);
41
+
36 42
   PermissionStatus _permissionGranted = await Permission.location.status;
37 43
   if (_permissionGranted == PermissionStatus.denied) {
38 44
     // 如果未允许, 尝试申请一次
@@ -40,6 +46,9 @@ Future _requirePermission() async {
40 46
     if (_permissionGranted != PermissionStatus.granted) {
41 47
       throw Exception("请设置允许当前程序定位功能");
42 48
     }
49
+    // if (await PermissionHelper.check(Permission.locationAlways)) {
50
+    //   // 这里写应用获取权限之后的业务逻辑
51
+    // }
43 52
   }
44 53
 }
45 54
 

+ 0
- 6
lib/widgets/CarsCard.dart Прегледај датотеку

@@ -1,14 +1,8 @@
1
-import 'package:flutter/foundation.dart';
2 1
 import 'package:flutter/material.dart';
3 2
 import 'package:flutter_screenutil/flutter_screenutil.dart';
4 3
 import 'package:get/get.dart';
5
-import 'package:get/get_core/src/get_main.dart';
6
-
7
-import '../models/entities/CardInfo.dart';
8 4
 import '../models/entities/CardListModel.dart';
9
-import '../pages/OrderConfirmation/index.dart';
10 5
 import '../pages/machinery/detail/index.dart';
11
-import '../pages/machinery/map/index.dart';
12 6
 import 'LinearGradientText.dart';
13 7
 
14 8
 class CarsCard extends StatefulWidget {

+ 14
- 35
lib/widgets/ExtendContentList.dart Прегледај датотеку

@@ -1,10 +1,6 @@
1 1
 import 'package:flutter/widgets.dart';
2 2
 import 'package:flutter_screenutil/flutter_screenutil.dart';
3
-import 'package:get/get_rx/src/rx_types/rx_types.dart';
4
-import 'package:get/get_state_manager/src/rx_flutter/rx_obx_widget.dart';
5
-
6 3
 import '../models/entities/CardInfo.dart';
7
-import '../models/entities/ExtendContent.dart';
8 4
 
9 5
 class ExtendContentList extends StatelessWidget {
10 6
   final List<ContentImageList> item;
@@ -23,37 +19,20 @@ class ExtendContentList extends StatelessWidget {
23 19
 
24 20
   @override
25 21
   Widget build(BuildContext context) {
26
-    //
27
-    // List<Widget> _widgets = [];
28
-    // Container(
29
-    //   child: item.contentType == "image" ? _image(item.content) : _text(item.content),
30
-    // );
31
-    // for (var i = 0; i < item.length; i += 1) {
32
-    //   if (i != 0 ) {
33
-    //     _widgets.add(SizedBox(height: 20.w,));
34
-    //   }
35
-    //   var item = item[i];
36
-    //   _widgets.add(Container(
37
-    //     child: item.contentType == "image" ? _image(item.content) : _text(item.content),
38
-    //   ));
39
-    // }
40
-
41
-    return Container(
42
-      child: Column(
43
-        children: item.map((item) {
44
-          if (item.contentType != 'image') {
45
-            return Container(
46
-                padding: EdgeInsets.fromLTRB(0, 20, 0, 10),
47
-                width: 344.w,
48
-                child: _text(item.content));
49
-          } else {
50
-            return Container(
51
-              padding: EdgeInsets.fromLTRB(0, 10, 0, 10),
52
-              child: _image(item.content),
53
-            );
54
-          }
55
-        }).toList(),
56
-      ),
22
+    return Column(
23
+      children: item.map((item) {
24
+        if (item.contentType != 'image') {
25
+          return Container(
26
+              padding: EdgeInsets.fromLTRB(0, 20, 0, 10),
27
+              width: 344.w,
28
+              child: _text(item.content));
29
+        } else {
30
+          return Container(
31
+            padding: EdgeInsets.fromLTRB(0, 10, 0, 10),
32
+            child: _image(item.content),
33
+          );
34
+        }
35
+      }).toList(),
57 36
     );
58 37
   }
59 38
 }

+ 133
- 124
lib/widgets/OrderListCard.dart Прегледај датотеку

@@ -12,7 +12,7 @@ class TextCell extends StatelessWidget {
12 12
   String title;
13 13
   String? value;
14 14
 
15
-  TextCell({Key? key, required this.title, this.value}):super(key: key);
15
+  TextCell({Key? key, required this.title, this.value}) : super(key: key);
16 16
 
17 17
   @override
18 18
   Widget build(BuildContext context) {
@@ -20,20 +20,19 @@ class TextCell extends StatelessWidget {
20 20
       text: TextSpan(children: <InlineSpan>[
21 21
         TextSpan(
22 22
             text: title,
23
-            style: const TextStyle(
24
-                color: Color(0xff666666),
25
-                fontSize: 16,
23
+            style: TextStyle(
24
+                color: const Color(0xff666666),
25
+                fontSize: 16.sp,
26 26
                 fontWeight: FontWeight.bold)),
27 27
         TextSpan(
28 28
             text: value,
29
-            style: const TextStyle(
30
-                color: Color(0xff222222),
31
-                fontSize: 16,
29
+            style: TextStyle(
30
+                color: const Color(0xff222222),
31
+                fontSize: 16.sp,
32 32
                 fontWeight: FontWeight.bold)),
33 33
       ]),
34 34
     );
35 35
   }
36
-
37 36
 }
38 37
 
39 38
 class OrderListCard extends StatelessWidget {
@@ -48,148 +47,158 @@ class OrderListCard extends StatelessWidget {
48 47
   Widget build(BuildContext context) {
49 48
     return Container(
50 49
       width: 375.w,
51
-      height: 345.h,
52
-      margin: const EdgeInsets.fromLTRB(0, 0, 0, 20),
50
+      margin: EdgeInsets.only(bottom: 20.h),
51
+      padding: EdgeInsets.symmetric(vertical: 30.h, horizontal: 15.w),
53 52
       decoration: const BoxDecoration(color: Colors.white, boxShadow: [
54 53
         BoxShadow(
55 54
             color: Colors.black12,
56 55
             offset: Offset(0.0, 15.0), //阴影xy轴偏移量
57 56
             blurRadius: 15.0, //阴影模糊程度
58 57
             spreadRadius: 1.0 //阴影扩散程度
59
-        )
58
+            )
60 59
       ]),
61 60
       child: Row(
62
-        crossAxisAlignment: CrossAxisAlignment.start,
63
-        mainAxisAlignment: MainAxisAlignment.spaceBetween,
64 61
         children: [
65 62
           Container(
66
-            margin: const EdgeInsets.fromLTRB(15, 20, 15, 0),
67
-            width: 18.0,
68
-            height: 275.h,
63
+            margin: EdgeInsets.only(right: 15.w),
64
+            width: 17.w,
65
+            height: 320.h,
69 66
             child: const Image(
70 67
               image: AssetImage('images/ordersLeft.png'),
71 68
             ),
72 69
           ),
73
-          Expanded(
74
-            child: Column(
75
-              crossAxisAlignment: CrossAxisAlignment.start,
76
-              children: [
77
-                Container(
78
-                  width: 320.w,
79
-                  margin: const EdgeInsets.fromLTRB(0, 10, 0, 15),
80
-                  padding: const EdgeInsets.fromLTRB(0, 0, 0, 20),
81
-                  decoration: const BoxDecoration(
82
-                      border: Border(
83
-                          bottom:
84
-                          BorderSide(width: 0.5, color: Color(0x20000000)
85
-                            // 0x17000000
86
-                          ))),
87
-                  child: GestureDetector(
88
-                    child:
89
-                    Row(
90
-                      mainAxisAlignment: MainAxisAlignment.spaceBetween,
91
-                      children: [
92
-                        TextCell(title: '订单编号:', value: item.orderNo),
93
-                        Bold(text: "详情 >>", fontSize: 16.sp, color: const Color(0xff222222)),
94
-                      ],
70
+          Column(
71
+            crossAxisAlignment: CrossAxisAlignment.start,
72
+            children: [
73
+              Container(
74
+                width: 313.w,
75
+                margin: EdgeInsets.only(bottom: 20.h),
76
+                padding: EdgeInsets.only(bottom: 20.h),
77
+                decoration: const BoxDecoration(
78
+                  border: Border(
79
+                    bottom: BorderSide(
80
+                      width: 0.5,
81
+                      color: Color(0x20000000),
95 82
                     ),
96
-                    onTap: () {
97
-                      Get.toNamed('/orderPageInfo', arguments: {
98
-                        'id': item.orderId,
99
-                        'title': processSign.label,
100
-                        'styleColor': processSign.color
101
-                      });
102
-                    },
103 83
                   ),
104 84
                 ),
105
-                Expanded(
106
-                    child: Column(
107
-                      crossAxisAlignment: CrossAxisAlignment.start,
108
-                      children: [
109
-                        Padding(
110
-                          padding: const EdgeInsets.fromLTRB(0, 0, 0, 15),
111
-                          child: TextCell(title: '农机名称:', value: item.machineryName),
112
-                        ),
113
-                        Padding(
114
-                          padding: const EdgeInsets.fromLTRB(0, 0, 0, 15),
115
-                          child: TextCell(title: '作业面积:', value: item.amount.toString()),
116
-                        ),
117
-                        Padding(
118
-                          padding: const EdgeInsets.fromLTRB(0, 0, 0, 15),
119
-                          child: TextCell(title: '需求时间:', value: DateFormat("yyyy-MM-dd").format(
120
-                              DateTime.parse(item.appointmentDate.toString()))),
121
-                        ),
122
-                        Padding(
123
-                          padding: const EdgeInsets.fromLTRB(0, 0, 0, 15),
124
-                          child: TextCell(title: '需求时间:', value: DateFormat("yyyy-MM-dd").format(
125
-                              DateTime.parse(item.createDate.toString()))),
126
-                        ),
127
-                      ],
128
-                    )),
129
-                Container(
130
-                  margin: const EdgeInsets.fromLTRB(0, 0, 0, 30),
131
-                  padding: const EdgeInsets.fromLTRB(0, 20, 0, 0),
132
-                  decoration: const BoxDecoration(
133
-                      border: Border(
134
-                          top: BorderSide(
135
-                              width: 0.5, color: Color(0x20000000)))),
136
-                  width: 320.w,
85
+                child: GestureDetector(
137 86
                   child: Row(
138 87
                     mainAxisAlignment: MainAxisAlignment.spaceBetween,
139 88
                     children: [
140
-                      RichText(
141
-                        text: TextSpan(children: <InlineSpan>[
142
-                          const TextSpan(
143
-                              text: '订单状态:',
144
-                              style: TextStyle(
145
-                                  color: Color(0xff666666),
146
-                                  fontSize: 16,
147
-                                  fontWeight: FontWeight.bold)),
89
+                      TextCell(title: '订单编号:', value: item.orderNo),
90
+                      Bold(
91
+                        text: "详情 >>",
92
+                        fontSize: 16.sp,
93
+                        color: const Color(0xff222222),
94
+                      ),
95
+                    ],
96
+                  ),
97
+                  onTap: () {
98
+                    Get.toNamed('/orderPageInfo', arguments: {
99
+                      'orderId': item.orderId,
100
+                      'title': processSign.label,
101
+                      'styleColor': processSign.color
102
+                    });
103
+                  },
104
+                ),
105
+              ),
106
+              Padding(
107
+                padding: EdgeInsets.only(bottom: 30.h),
108
+                child: TextCell(title: '农机名称:', value: item.machineryName),
109
+              ),
110
+              Padding(
111
+                padding: EdgeInsets.only(bottom: 30.h),
112
+                child: TextCell(title: '作业面积:', value: item.amount.toString()),
113
+              ),
114
+              Padding(
115
+                padding: EdgeInsets.only(bottom: 30.h),
116
+                child: TextCell(
117
+                    title: '需求时间:',
118
+                    value: DateFormat("yyyy-MM-dd").format(
119
+                        DateTime.parse(item.appointmentDate.toString()))),
120
+              ),
121
+              TextCell(
122
+                title: '下单时间:',
123
+                value: DateFormat("yyyy-MM-dd")
124
+                    .format(DateTime.parse(item.createDate.toString())),
125
+              ),
126
+              Container(
127
+                margin: EdgeInsets.only(top: 22.h),
128
+                padding: EdgeInsets.only(top: 30.h),
129
+                decoration: const BoxDecoration(
130
+                  border: Border(
131
+                    top: BorderSide(
132
+                      width: 0.5,
133
+                      color: Color(0x20000000),
134
+                    ),
135
+                  ),
136
+                ),
137
+                width: 313.w,
138
+                child: Row(
139
+                  mainAxisAlignment: MainAxisAlignment.spaceBetween,
140
+                  children: [
141
+                    RichText(
142
+                      text: TextSpan(
143
+                        children: <InlineSpan>[
148 144
                           TextSpan(
149
-                              text: processSign.label,
150
-                              style: TextStyle(
151
-                                  color: processSign.color,
152
-                                  fontSize: 16,
153
-                                  fontWeight: FontWeight.bold)),
154
-                        ]),
145
+                            text: '订单状态:',
146
+                            style: TextStyle(
147
+                                color: const Color(0xff666666),
148
+                                fontSize: 16.sp,
149
+                                fontWeight: FontWeight.bold),
150
+                          ),
151
+                          TextSpan(
152
+                            text: processSign.label,
153
+                            style: TextStyle(
154
+                                color: processSign.color,
155
+                                fontSize: 16.sp,
156
+                                fontWeight: FontWeight.bold),
157
+                          ),
158
+                        ],
155 159
                       ),
156
-                      Row(
157
-                        children: [
158
-                          const Text('费用:',
159
-                              style: TextStyle(
160
-                                  color: Color(0xff666666),
161
-                                  fontSize: 16,
162
-                                  fontWeight: FontWeight.bold)),
163
-                          LinearGradientText(
164
-                            colors: const <Color>[
165
-                              Color(0xFFFA7878),
166
-                              Color(0xFFB61515),
167
-                            ],
168
-                            child: RichText(
169
-                              text: TextSpan(children: <InlineSpan>[
160
+                    ),
161
+                    Row(
162
+                      children: [
163
+                        Text(
164
+                          '费用:',
165
+                          style: TextStyle(
166
+                              color: const Color(0xff666666),
167
+                              fontSize: 16.sp,
168
+                              fontWeight: FontWeight.bold),
169
+                        ),
170
+                        LinearGradientText(
171
+                          colors: const <Color>[
172
+                            Color(0xFFFA7878),
173
+                            Color(0xFFB61515),
174
+                          ],
175
+                          child: RichText(
176
+                            text: TextSpan(
177
+                              children: <InlineSpan>[
178
+                                TextSpan(
179
+                                  text: ((item.charges ?? 0) / 100).toString(),
180
+                                  style: TextStyle(
181
+                                    fontSize: 16.sp,
182
+                                    fontWeight: FontWeight.bold,
183
+                                  ),
184
+                                ),
170 185
                                 TextSpan(
171
-                                    text: ((item.charges ?? 0) / 100)
172
-                                        .toString(),
173
-                                    style: const TextStyle(
174
-                                      fontSize: 16,
175
-                                      fontWeight: FontWeight.bold,
176
-                                    )),
177
-                                const TextSpan(
178
-                                    text: "元",
179
-                                    style: TextStyle(
180
-                                      fontSize: 16,
181
-                                      fontWeight: FontWeight.bold,
182
-                                    )),
183
-                              ]),
186
+                                  text: "元",
187
+                                  style: TextStyle(
188
+                                    fontSize: 16.sp,
189
+                                    fontWeight: FontWeight.bold,
190
+                                  ),
191
+                                ),
192
+                              ],
184 193
                             ),
185 194
                           ),
186
-                        ],
187
-                      ),
188
-                    ],
189
-                  ),
195
+                        ),
196
+                      ],
197
+                    ),
198
+                  ],
190 199
                 ),
191
-              ],
192
-            ),
200
+              ),
201
+            ],
193 202
           ),
194 203
         ],
195 204
       ),

+ 13
- 7
lib/widgets/layout/BasicPage.dart Прегледај датотеку

@@ -96,19 +96,25 @@ class _BasicPageState extends State<BasicPage> {
96 96
     }
97 97
   }
98 98
 
99
+  final client = GetPlatform.isAndroid ? true : false;
100
+
99 101
   @override
100 102
   Widget build(BuildContext context) {
101 103
     return Scaffold(
102 104
       resizeToAvoidBottomInset: false,
103 105
       appBar: _getAppBar(),
104 106
       body: SafeArea(
105
-        child: GestureDetector(
106
-          behavior: HitTestBehavior.translucent,
107
-          onTap: () {
108
-            FocusScope.of(context).requestFocus(FocusNode());
109
-          },
110
-          child: widget.builder(context),
111
-        ),
107
+        //判断是否是安卓手机  因为安卓手机键盘有收起功能所以普通就行
108
+        //如果是苹果系统 因为苹果键盘没有收起功能只能点击屏幕收起所以需要加一个代码
109
+        child: client
110
+            ? widget.builder(context)
111
+            : GestureDetector(
112
+                behavior: HitTestBehavior.translucent,
113
+                onTap: () {
114
+                  FocusScope.of(context).requestFocus(FocusNode());
115
+                },
116
+                child: widget.builder(context),
117
+              ),
112 118
       ),
113 119
       bottomNavigationBar: widget.tabIndex == null
114 120
           ? null