Parcourir la source

add Loading EasyLoading

[baozhangchao] il y a 3 ans
Parent
révision
5d3a6ff87f
82 fichiers modifiés avec 1464 ajouts et 1439 suppressions
  1. 2
    0
      lib/main.dart
  2. 1
    1
      lib/models/Store.dart
  3. 2
    4
      lib/models/User.dart
  4. 3
    4
      lib/models/addressController.dart
  5. 13
    14
      lib/models/app.dart
  6. 2
    2
      lib/models/entities/CardInfo.dart
  7. 10
    11
      lib/models/entities/ExtendContent.dart
  8. 5
    10
      lib/models/entities/NewsInformationInfoTextModel.dart
  9. 19
    19
      lib/models/entities/NewsInformationModel.dart
  10. 55
    56
      lib/models/entities/OrderInfoModel.dart
  11. 55
    60
      lib/models/entities/OrderListAll.dart
  12. 1
    2
      lib/models/entities/PagedResult.dart
  13. 2
    3
      lib/models/entities/person.dart
  14. 0
    2
      lib/models/index.dart
  15. 10
    8
      lib/pages/ArticleInfo/ArticleInfo.dart
  16. 46
    43
      lib/pages/Information/ArticleInfo.dart
  17. 22
    31
      lib/pages/Information/index.dart
  18. 12
    0
      lib/pages/MoreCars/index.dart
  19. 42
    48
      lib/pages/OrderConfirmation/index.dart
  20. 13
    18
      lib/pages/addAddress/index.dart
  21. 5
    0
      lib/pages/addressList/index.dart
  22. 9
    9
      lib/pages/agreement/index.dart
  23. 25
    27
      lib/pages/feedback/index.dart
  24. 1
    1
      lib/pages/home.dart
  25. 21
    14
      lib/pages/home/widgets/home/index.dart
  26. 1
    2
      lib/pages/index.dart
  27. 23
    25
      lib/pages/infomation/index.dart
  28. 9
    9
      lib/pages/infomation/widgets/Information/index.dart
  29. 0
    1
      lib/pages/login/login.dart
  30. 21
    11
      lib/pages/machinery/detail/index.dart
  31. 35
    18
      lib/pages/machinery/detail/widgets/detail.dart
  32. 14
    9
      lib/pages/machinery/map/index.dart
  33. 32
    28
      lib/pages/machinery/map/widgets/detail.dart
  34. 8
    5
      lib/pages/machinery/widgets/DefLayout.dart
  35. 4
    8
      lib/pages/machinery/widgets/RoundButton.dart
  36. 44
    33
      lib/pages/machinery/widgets/summary.dart
  37. 9
    5
      lib/pages/main/index.dart
  38. 12
    15
      lib/pages/main/widgets/main/index.dart
  39. 2
    1
      lib/pages/main/widgets/main/widgets/UserAddress.dart
  40. 22
    20
      lib/pages/main/widgets/main/widgets/UserInfo.dart
  41. 1
    2
      lib/pages/order/index.dart
  42. 42
    36
      lib/pages/order/widgets/order/index.dart
  43. 92
    78
      lib/pages/orderInfo/index.dart
  44. 20
    37
      lib/pages/orderInfo/widgets/star.dart
  45. 16
    14
      lib/pages/search/index.dart
  46. 0
    1
      lib/pages/splash/splash.dart
  47. 32
    36
      lib/pages/userInfo/index.dart
  48. 0
    1
      lib/routes/index.dart
  49. 1
    2
      lib/routes/middleWares.dart
  50. 22
    20
      lib/routes/pages.dart
  51. 23
    31
      lib/services/address.dart
  52. 39
    25
      lib/services/homeAPI.dart
  53. 3
    7
      lib/services/main.dart
  54. 12
    19
      lib/services/news.dart
  55. 35
    45
      lib/services/orderAPI.dart
  56. 17
    23
      lib/services/user.dart
  57. 4
    6
      lib/theme.dart
  58. 2
    3
      lib/utils/amap/const_config.dart
  59. 0
    4
      lib/utils/dialog.dart
  60. 4
    4
      lib/utils/location.dart
  61. 2
    3
      lib/utils/timer.dart
  62. 19
    16
      lib/widgets/CarsCard.dart
  63. 20
    22
      lib/widgets/Cell.dart
  64. 14
    22
      lib/widgets/DefaultButton.dart
  65. 8
    12
      lib/widgets/ExtendContentList.dart
  66. 7
    4
      lib/widgets/GradientButton.dart
  67. 0
    1
      lib/widgets/LinearGradientText.dart
  68. 3
    4
      lib/widgets/LoadMore.dart
  69. 58
    44
      lib/widgets/Modal.dart
  70. 2
    5
      lib/widgets/NullCard.dart
  71. 209
    198
      lib/widgets/OrderInfoCard.dart
  72. 67
    91
      lib/widgets/OrderListCard.dart
  73. 4
    9
      lib/widgets/Refresher.dart
  74. 6
    7
      lib/widgets/amap/amap.dart
  75. 2
    3
      lib/widgets/amap/const_config.dart
  76. 4
    5
      lib/widgets/layout/BasicPage.dart
  77. 32
    9
      lib/widgets/layout/barList.dart
  78. 8
    10
      lib/widgets/layout/bottomBar/BottomBar.dart
  79. 6
    3
      lib/widgets/layout/bottomBar/item.dart
  80. 1
    0
      lib/widgets/layout/widgets/index.dart
  81. 14
    0
      pubspec.lock
  82. 1
    0
      pubspec.yaml

+ 2
- 0
lib/main.dart Voir le fichier

@@ -1,6 +1,7 @@
1 1
 import 'package:farmer_client/theme.dart';
2 2
 import 'package:farmer_client/utils/location.dart';
3 3
 import 'package:flutter/material.dart';
4
+import 'package:flutter_easyloading/flutter_easyloading.dart';
4 5
 import 'package:get/get.dart';
5 6
 import 'package:get_storage/get_storage.dart';
6 7
 import 'package:flutter_screenutil/flutter_screenutil.dart';
@@ -46,6 +47,7 @@ class MyApp extends StatelessWidget {
46 47
           routingCallback: routingCallback,
47 48
           initialBinding: AppBindings(),
48 49
           getPages: pages,
50
+          builder: EasyLoading.init(),
49 51
         );
50 52
       },
51 53
     );

+ 1
- 1
lib/models/Store.dart Voir le fichier

@@ -1 +1 @@
1
-// TODO Implement this library.
1
+// TODO Implement this library.

+ 2
- 4
lib/models/User.dart Voir le fichier

@@ -1,15 +1,13 @@
1
-
2 1
 import 'package:farmer_client/models/entities/person.dart';
3 2
 import 'package:get/get.dart';
4 3
 
5 4
 class User extends GetxController {
6 5
   Person? _person;
7 6
   Person? get person => _person;
8
-  set person (Person? p) {
7
+  set person(Person? p) {
9 8
     _person = p;
10 9
     update();
11 10
   }
12 11
 
13 12
   bool get isLogin => _person != null;
14
-
15
-}
13
+}

+ 3
- 4
lib/models/addressController.dart Voir le fichier

@@ -1,8 +1,7 @@
1
-
2 1
 import 'package:farmer_client/models/entities/Address.dart';
3 2
 import 'package:get/get.dart';
4 3
 
5
-class AddressController extends GetxController{
4
+class AddressController extends GetxController {
6 5
   static AddressController t = Get.find();
7
-  final address=Rx<Address>(Address.fromJson({'address':'选择位置'}));
8
-}
6
+  final address = Rx<Address>(Address.fromJson({'address': '选择位置'}));
7
+}

+ 13
- 14
lib/models/app.dart Voir le fichier

@@ -1,17 +1,17 @@
1
-
2 1
 import 'dart:io';
3 2
 
4 3
 import 'package:amap_flutter_location/amap_flutter_location.dart';
5 4
 import 'package:farmer_client/models/entities/person.dart';
6 5
 import 'package:farmer_client/widgets/Modal.dart';
7 6
 import 'package:get/get.dart';
7
+import 'package:get_storage/get_storage.dart';
8 8
 import '../services/user.dart';
9 9
 import '../utils/location.dart';
10 10
 
11 11
 class AppController extends GetxController {
12 12
   // 有了这句, 可以直接 AppController.t 调用
13 13
   static AppController t = Get.find();
14
-
14
+  GetStorage box = GetStorage();
15 15
   final user = Rx<Person>(Person());
16 16
   final location = Rxn<Map<String, Object>>();
17 17
   final testInt = 1.obs;
@@ -19,7 +19,7 @@ class AppController extends GetxController {
19 19
   AMapFlutterLocation? _location;
20 20
 
21 21
   get locationStr {
22
-    if (null ==location.value) return null;
22
+    if (null == location.value) return null;
23 23
 
24 24
     double longitude = location.value!['longitude'] as double;
25 25
     double latitude = location.value!['latitude'] as double;
@@ -27,7 +27,7 @@ class AppController extends GetxController {
27 27
     return longitude.toString() + "," + latitude.toString();
28 28
   }
29 29
 
30
-  void onLocationChange (Map<String, Object> result) {
30
+  void onLocationChange(Map<String, Object> result) {
31 31
     location(result);
32 32
   }
33 33
 
@@ -48,14 +48,14 @@ class AppController extends GetxController {
48 48
       );
49 49
     });
50 50
 
51
-
52
-    // 尝试获取一次人员信息
53
-    getCurrent().then((person) {
54
-      user(Person.fromJson(person));
55
-
56
-    }).catchError((e) {
57
-      print(e);
58
-    });
51
+    if (box.read('token') != null) {
52
+      // 尝试获取一次人员信息
53
+      getCurrent().then((person) {
54
+        user(Person.fromJson(person));
55
+      }).catchError((e) {
56
+        print(e);
57
+      });
58
+    }
59 59
   }
60 60
 
61 61
   @override
@@ -64,5 +64,4 @@ class AppController extends GetxController {
64 64
       _location?.destroy();
65 65
     }
66 66
   }
67
-
68
-}
67
+}

+ 2
- 2
lib/models/entities/CardInfo.dart Voir le fichier

@@ -47,9 +47,9 @@ class CardInfo {
47 47
   int? status;
48 48
 
49 49
   // @ApiModelProperty(value = "内容详情")
50
-   List<ContentImageList>? contentList=[];
50
+  List<ContentImageList>? contentList = [];
51 51
   // @ApiModelProperty(value = "图片列表")
52
-   List<BannerImageList>? imagesList=[];
52
+  List<BannerImageList>? imagesList = [];
53 53
 
54 54
   CardInfo();
55 55
 

+ 10
- 11
lib/models/entities/ExtendContent.dart Voir le fichier

@@ -1,4 +1,3 @@
1
-
2 1
 class ExtendContent {
3 2
   // 租户号
4 3
   String? extId;
@@ -23,7 +22,7 @@ class ExtendContent {
23 22
 
24 23
   ExtendContent();
25 24
 
26
-  ExtendContent.simple({ this.content, this.contentType });
25
+  ExtendContent.simple({this.content, this.contentType});
27 26
 
28 27
   ExtendContent.fromJson(Map<String, dynamic> json)
29 28
       : extId = json["extId"],
@@ -35,12 +34,12 @@ class ExtendContent {
35 34
         createDate = json["createDate"];
36 35
 
37 36
   Map<String, dynamic> toJson() => {
38
-    'extId' : extId,
39
-    'targetType' : targetType,
40
-    'targetId' : targetId,
41
-    'contentType' : contentType,
42
-    'content' : content,
43
-    'sort' : sort,
44
-    'createDate' : createDate,
45
-  };
46
-}
37
+        'extId': extId,
38
+        'targetType': targetType,
39
+        'targetId': targetId,
40
+        'contentType': contentType,
41
+        'content': content,
42
+        'sort': sort,
43
+        'createDate': createDate,
44
+      };
45
+}

+ 5
- 10
lib/models/entities/NewsInformationInfoTextModel.dart Voir le fichier

@@ -1,13 +1,11 @@
1
-
2
-List<ExtendContent> jsonToList(list){
3
-  List<ExtendContent> contList=[];
4
-  list.forEach((item){
1
+List<ExtendContent> jsonToList(list) {
2
+  List<ExtendContent> contList = [];
3
+  list.forEach((item) {
5 4
     contList.add(ExtendContent.fromJson(item));
6 5
   });
7 6
   return contList;
8 7
 }
9 8
 
10
-
11 9
 class NewsInformationInfoTextModel {
12 10
   String? createDate;
13 11
   String? newsId;
@@ -17,7 +15,7 @@ class NewsInformationInfoTextModel {
17 15
   String? typeId;
18 16
   String? typeName;
19 17
   num? weight;
20
-   List<ExtendContent>? contentList=[];
18
+  List<ExtendContent>? contentList = [];
21 19
 
22 20
   NewsInformationInfoTextModel();
23 21
 
@@ -30,8 +28,7 @@ class NewsInformationInfoTextModel {
30 28
         weight = json["weight"],
31 29
         status = json["status"],
32 30
         createDate = json["createDate"],
33
-        contentList= jsonToList(json["contentList"]);
34
-
31
+        contentList = jsonToList(json["contentList"]);
35 32
 
36 33
   Map<String, dynamic> toJson() => {
37 34
         'newsId': newsId,
@@ -42,8 +39,6 @@ class NewsInformationInfoTextModel {
42 39
         'weight': weight,
43 40
         'status': status,
44 41
         'createDate': createDate,
45
-
46
-
47 42
       };
48 43
 }
49 44
 

+ 19
- 19
lib/models/entities/NewsInformationModel.dart Voir le fichier

@@ -11,25 +11,25 @@ class NewsInformationModel {
11 11
   NewsInformationModel();
12 12
 
13 13
   NewsInformationModel.fromJson(Map<String, dynamic> json)
14
-      : newsId=json["newsId"],
15
-        title=json["title"],
16
-        typeId=json["typeId"],
17
-        typeNam=json["typeNam"],
18
-        thumb=json["thumb"],
19
-        weight=json["weight"],
20
-        status=json["status"],
21
-        createDate=json["createDate"],
22
-        contentList=json["contentList"];
14
+      : newsId = json["newsId"],
15
+        title = json["title"],
16
+        typeId = json["typeId"],
17
+        typeNam = json["typeNam"],
18
+        thumb = json["thumb"],
19
+        weight = json["weight"],
20
+        status = json["status"],
21
+        createDate = json["createDate"],
22
+        contentList = json["contentList"];
23 23
 
24 24
   Map<String, dynamic> toJson() => {
25
-    'newsId':newsId,
26
-    'title':title,
27
-    'typeId':typeId,
28
-    'typeNam':typeNam,
29
-    'thumb':thumb,
30
-    'weight':weight,
31
-    'status':status,
32
-    'createDate':createDate,
33
-    'contentList':contentList,
34
-  };
25
+        'newsId': newsId,
26
+        'title': title,
27
+        'typeId': typeId,
28
+        'typeNam': typeNam,
29
+        'thumb': thumb,
30
+        'weight': weight,
31
+        'status': status,
32
+        'createDate': createDate,
33
+        'contentList': contentList,
34
+      };
35 35
 }

+ 55
- 56
lib/models/entities/OrderInfoModel.dart Voir le fichier

@@ -29,62 +29,61 @@ class OrderInfoModel {
29 29
   OrderInfoModel();
30 30
 
31 31
   OrderInfoModel.fromJson(Map<String, dynamic> json)
32
-      : orderId=json["orderId"],
33
-        orderNo=json["orderNo"],
34
-        personId=json["personId"],
35
-        personName=json["personName"],
36
-        phone=json["phone"],
37
-        charges=json["charges"],
38
-        price=json["price"],
39
-        amount=json["amount"],
40
-        machineryId=json["machineryId"],
41
-        machineryName=json["machineryName"],
42
-        machineryType=json["machineryType"],
43
-        typeName=json["typeName"],
44
-        address=json["address"],
45
-        appointmentDate=json["appointmentDate"],
46
-        payStatus=json["payStatus"],
47
-        dispatchStatus=json["dispatchStatus"],
48
-        workStatus=json["workStatus"],
49
-        isEvaluated=json["isEvaluated"],
50
-        payType=json["payType"],
51
-        isRefund=json["isRefund"],
52
-        orgId=json["orgId"],
53
-        orgName=json["orgName"],
54
-        status=json["status"],
55
-        createDate=json["createDate"],
56
-        dispatchId=json["dispatchId"],
57
-        workId=json["workId"],
58
-        workName=json["workName"];
32
+      : orderId = json["orderId"],
33
+        orderNo = json["orderNo"],
34
+        personId = json["personId"],
35
+        personName = json["personName"],
36
+        phone = json["phone"],
37
+        charges = json["charges"],
38
+        price = json["price"],
39
+        amount = json["amount"],
40
+        machineryId = json["machineryId"],
41
+        machineryName = json["machineryName"],
42
+        machineryType = json["machineryType"],
43
+        typeName = json["typeName"],
44
+        address = json["address"],
45
+        appointmentDate = json["appointmentDate"],
46
+        payStatus = json["payStatus"],
47
+        dispatchStatus = json["dispatchStatus"],
48
+        workStatus = json["workStatus"],
49
+        isEvaluated = json["isEvaluated"],
50
+        payType = json["payType"],
51
+        isRefund = json["isRefund"],
52
+        orgId = json["orgId"],
53
+        orgName = json["orgName"],
54
+        status = json["status"],
55
+        createDate = json["createDate"],
56
+        dispatchId = json["dispatchId"],
57
+        workId = json["workId"],
58
+        workName = json["workName"];
59 59
 
60 60
   Map<String, dynamic> toJson() => {
61
-    'orderId':orderId,
62
-    'orderNo':orderNo,
63
-    'personId':personId,
64
-    'personName':personName,
65
-    'phone':phone,
66
-    'charges':charges,
67
-    'price':price,
68
-    'amount':amount,
69
-    'machineryId':machineryId,
70
-    'machineryName':machineryName,
71
-    'machineryType':machineryType,
72
-    'typeName':typeName,
73
-    'address':address,
74
-    'appointmentDate':appointmentDate,
75
-    'payStatus':payStatus,
76
-    'dispatchStatus':dispatchStatus,
77
-    'workStatus':workStatus,
78
-    'isEvaluated':isEvaluated,
79
-    'payType':payType,
80
-    'isRefund':isRefund,
81
-    'orgId':orgId,
82
-    'orgName':orgName,
83
-    'status':status,
84
-    'createDate':createDate,
85
-    'dispatchId':dispatchId,
86
-    'workId':workId,
87
-    'workName':workName,
88
-  };
61
+        'orderId': orderId,
62
+        'orderNo': orderNo,
63
+        'personId': personId,
64
+        'personName': personName,
65
+        'phone': phone,
66
+        'charges': charges,
67
+        'price': price,
68
+        'amount': amount,
69
+        'machineryId': machineryId,
70
+        'machineryName': machineryName,
71
+        'machineryType': machineryType,
72
+        'typeName': typeName,
73
+        'address': address,
74
+        'appointmentDate': appointmentDate,
75
+        'payStatus': payStatus,
76
+        'dispatchStatus': dispatchStatus,
77
+        'workStatus': workStatus,
78
+        'isEvaluated': isEvaluated,
79
+        'payType': payType,
80
+        'isRefund': isRefund,
81
+        'orgId': orgId,
82
+        'orgName': orgName,
83
+        'status': status,
84
+        'createDate': createDate,
85
+        'dispatchId': dispatchId,
86
+        'workId': workId,
87
+        'workName': workName,
88
+      };
89 89
 }
90
-

+ 55
- 60
lib/models/entities/OrderListAll.dart Voir le fichier

@@ -1,5 +1,4 @@
1 1
 class OrderListAll {
2
-
3 2
   String? orderId;
4 3
   String? orderNo;
5 4
   String? personId;
@@ -28,68 +27,64 @@ class OrderListAll {
28 27
   String? workId;
29 28
   String? workName;
30 29
 
31
-
32 30
   OrderListAll();
33 31
 
34 32
   OrderListAll.fromJson(Map<String, dynamic> json)
35
-      :orderId=json["orderId"],
36
-        orderNo=json["orderNo"],
37
-        personId=json["personId"],
38
-        personName=json["personName"],
39
-        phone=json["phone"],
40
-        charges=json["charges"],
41
-        price=json["price"],
42
-        amount=json["amount"],
43
-        machineryId=json["machineryId"],
44
-        machineryName=json["machineryName"],
45
-        machineryType=json["machineryType"],
46
-        typeName=json["typeName"],
47
-        address=json["address"],
48
-        appointmentDate=json["appointmentDate"],
49
-        payStatus=json["payStatus"],
50
-        dispatchStatus=json["dispatchStatus"],
51
-        workStatus=json["workStatus"],
52
-        isEvaluated=json["isEvaluated"],
53
-        payType=json["payType"],
54
-        isRefund=json["isRefund"],
55
-        orgId=json["orgId"],
56
-        orgName=json["orgName"],
57
-        status=json["status"],
58
-        createDate=json["createDate"],
59
-        dispatchId=json["dispatchId"],
60
-        workId=json["workId"],
61
-        workName=json["workName"];
33
+      : orderId = json["orderId"],
34
+        orderNo = json["orderNo"],
35
+        personId = json["personId"],
36
+        personName = json["personName"],
37
+        phone = json["phone"],
38
+        charges = json["charges"],
39
+        price = json["price"],
40
+        amount = json["amount"],
41
+        machineryId = json["machineryId"],
42
+        machineryName = json["machineryName"],
43
+        machineryType = json["machineryType"],
44
+        typeName = json["typeName"],
45
+        address = json["address"],
46
+        appointmentDate = json["appointmentDate"],
47
+        payStatus = json["payStatus"],
48
+        dispatchStatus = json["dispatchStatus"],
49
+        workStatus = json["workStatus"],
50
+        isEvaluated = json["isEvaluated"],
51
+        payType = json["payType"],
52
+        isRefund = json["isRefund"],
53
+        orgId = json["orgId"],
54
+        orgName = json["orgName"],
55
+        status = json["status"],
56
+        createDate = json["createDate"],
57
+        dispatchId = json["dispatchId"],
58
+        workId = json["workId"],
59
+        workName = json["workName"];
62 60
 
63 61
   Map<String, dynamic> toJson() => {
64
-    'orderId':orderId,
65
-    'orderNo':orderNo,
66
-    'personId':personId,
67
-    'personName':personName,
68
-    'phone':phone,
69
-    'charges':charges,
70
-    'price':price,
71
-    'amount':amount,
72
-    'machineryId':machineryId,
73
-    'machineryName':machineryName,
74
-    'machineryType':machineryType,
75
-    'typeName':typeName,
76
-    'address':address,
77
-    'appointmentDate':appointmentDate,
78
-    'payStatus':payStatus,
79
-    'dispatchStatus':dispatchStatus,
80
-    'workStatus':workStatus,
81
-    'isEvaluated':isEvaluated,
82
-    'payType':payType,
83
-    'isRefund':isRefund,
84
-    'orgId':orgId,
85
-    'orgName':orgName,
86
-    'status':status,
87
-    'createDate':createDate,
88
-    'dispatchId':dispatchId,
89
-    'workId':workId,
90
-    'workName':workName,
91
-
92
-
93
-
94
-  };
62
+        'orderId': orderId,
63
+        'orderNo': orderNo,
64
+        'personId': personId,
65
+        'personName': personName,
66
+        'phone': phone,
67
+        'charges': charges,
68
+        'price': price,
69
+        'amount': amount,
70
+        'machineryId': machineryId,
71
+        'machineryName': machineryName,
72
+        'machineryType': machineryType,
73
+        'typeName': typeName,
74
+        'address': address,
75
+        'appointmentDate': appointmentDate,
76
+        'payStatus': payStatus,
77
+        'dispatchStatus': dispatchStatus,
78
+        'workStatus': workStatus,
79
+        'isEvaluated': isEvaluated,
80
+        'payType': payType,
81
+        'isRefund': isRefund,
82
+        'orgId': orgId,
83
+        'orgName': orgName,
84
+        'status': status,
85
+        'createDate': createDate,
86
+        'dispatchId': dispatchId,
87
+        'workId': workId,
88
+        'workName': workName,
89
+      };
95 90
 }

+ 1
- 2
lib/models/entities/PagedResult.dart Voir le fichier

@@ -1,4 +1,3 @@
1
-
2 1
 class PagedResult {
3 2
   num total;
4 3
   num size;
@@ -15,7 +14,7 @@ class PagedResult {
15 14
   });
16 15
 
17 16
   PagedResult.fromJson(Map<String, dynamic> json)
18
-    : total = json['total'],
17
+      : total = json['total'],
19 18
         size = json['size'],
20 19
         pages = json['pages'],
21 20
         current = json['current'],

+ 2
- 3
lib/models/entities/person.dart Voir le fichier

@@ -40,7 +40,6 @@ class Person {
40 40
         'status': status,
41 41
         'createDate': createDate,
42 42
         'isOrgManager': isOrgManager,
43
-         'identity': identity,
44
-
45
-  };
43
+        'identity': identity,
44
+      };
46 45
 }

+ 0
- 2
lib/models/index.dart Voir le fichier

@@ -1,4 +1,3 @@
1
-
2 1
 export 'app.dart';
3 2
 
4 3
 import 'package:farmer_client/models/addressController.dart';
@@ -12,4 +11,3 @@ class AppBindings implements Bindings {
12 11
     Get.put(AddressController());
13 12
   }
14 13
 }
15
-

+ 10
- 8
lib/pages/ArticleInfo/ArticleInfo.dart Voir le fichier

@@ -1,5 +1,6 @@
1 1
 import 'package:farmer_client/services/news.dart';
2 2
 import 'package:flutter/material.dart';
3
+import 'package:flutter_easyloading/flutter_easyloading.dart';
3 4
 import 'package:flutter_screenutil/flutter_screenutil.dart';
4 5
 import 'package:get/get.dart';
5 6
 import 'package:get/get_core/src/get_main.dart';
@@ -10,7 +11,8 @@ import '../../widgets/layout/BasicPage.dart';
10 11
 
11 12
 class ArticleInfo extends BasicPage {
12 13
   String newsId = '';
13
-  final newsInfoContent = Rx<NewsInformationInfoTextModel>(NewsInformationInfoTextModel());
14
+  final newsInfoContent =
15
+      Rx<NewsInformationInfoTextModel>(NewsInformationInfoTextModel());
14 16
   final newsList = Rx<List<ExtendContent>>([]);
15 17
 
16 18
   @override
@@ -18,14 +20,16 @@ class ArticleInfo extends BasicPage {
18 20
     // TODO: implement beforeShow
19 21
     super.beforeShow();
20 22
     if (Get.arguments['newsId'] != null) {
23
+      EasyLoading.show(status: '数据加载中...');
24
+
21 25
       newsId = Get.arguments['newsId'];
22 26
 
23 27
       getNewsInfo(newsId).then((value) {
24 28
         newsInfoContent.value = NewsInformationInfoTextModel.fromJson(value);
25
-        newsList.value =  newsInfoContent.value.contentList!;
29
+        newsList.value = newsInfoContent.value.contentList!;
30
+        EasyLoading.dismiss();
26 31
 
27 32
       });
28
-
29 33
     }
30 34
   }
31 35
 
@@ -45,22 +49,20 @@ class ArticleInfo extends BasicPage {
45 49
                   image: AssetImage('images/icons/decorate.png'),
46 50
                   width: 17,
47 51
                 ),
48
-                Obx(()=>
49
-                    Text(
52
+                Obx(() => Text(
50 53
                       newsInfoContent.value.title.toString(),
51 54
                       style: TextStyle(
52 55
                         fontSize: 17.sp,
53 56
                         fontWeight: FontWeight.bold,
54 57
                       ),
55
-                    )
56
-                ),
58
+                    )),
57 59
                 Image(
58 60
                     image: AssetImage('images/icons/decorate.png'), width: 17),
59 61
               ],
60 62
             ),
61 63
           ),
62 64
           Obx(() => Column(
63
-                children:  newsList.value.map((item) {
65
+                children: newsList.value.map((item) {
64 66
                   if (item.contentType != 'image') {
65 67
                     return Container(
66 68
                       padding: EdgeInsets.fromLTRB(0, 20, 0, 10),

+ 46
- 43
lib/pages/Information/ArticleInfo.dart Voir le fichier

@@ -7,56 +7,59 @@ class ArticleInfo extends StatelessWidget {
7 7
   @override
8 8
   Widget build(BuildContext context) {
9 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标题',
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
+        child: Column(
20
+          children: [
21
+            Container(
22
+              alignment: Alignment.center,
23
+              child: Row(
24
+                mainAxisAlignment: MainAxisAlignment.center,
25
+                children: [
26
+                  Image(
27
+                    image: AssetImage('images/icons/decorate.png'),
28
+                    width: 17,
29
+                  ),
30
+                  Text(
31
+                    '我是22222222222标题',
29 32
                     style: TextStyle(
30 33
                       fontSize: 17.sp,
31 34
                       fontWeight: FontWeight.bold,
32
-
33 35
                     ),
34
-                    ),
35
-                    Image(image: AssetImage('images/icons/decorate.png'),width: 17),
36
-
37
-                  ],
38
-                ),
36
+                  ),
37
+                  Image(
38
+                      image: AssetImage('images/icons/decorate.png'),
39
+                      width: 17),
40
+                ],
39 41
               ),
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
-                ) ,
42
+            ),
43
+            Container(
44
+              padding: EdgeInsets.fromLTRB(0, 20, 0, 10),
45
+              width: 344.w,
46
+              child: Text(
47
+                'gr一年之计在于春,连日来,农业生产工作正在热火朝天的进行着:农技人员走村串户指导农户春耕生产,大型拖拉机忙着翻垦农田,植保无人机 ',
48
+                style: TextStyle(fontSize: 14.sp),
48 49
               ),
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
-          ),
50
+            ),
51
+            Container(
52
+              padding: EdgeInsets.fromLTRB(0, 10, 0, 10),
53
+              child: Image(
54
+                image: AssetImage('images/cars.png'),
55
+                width: 320.w,
56
+                height: 260.w,
57
+                fit: BoxFit.fill,
58
+              ),
59
+            )
60
+          ],
58 61
         ),
62
+      ),
59 63
     );
60
-
61 64
   }
62 65
 }

+ 22
- 31
lib/pages/Information/index.dart Voir le fichier

@@ -26,17 +26,14 @@ class _InformationState extends State<Information> {
26 26
           // ListTile用不好
27 27
 
28 28
           GestureDetector(
29
-            child:
30
-            Container(
29
+            child: Container(
31 30
                 padding: EdgeInsets.fromLTRB(0, 30, 0, 30),
32 31
                 width: 310.w,
33 32
                 decoration: const BoxDecoration(
34
-                    border:Border(
35
-                        bottom:
36
-                        BorderSide(width: 0.5, color: Color(0x20000000)
37
-                          // 0x17000000
38
-                        ))
39
-                ),
33
+                    border: Border(
34
+                        bottom: BorderSide(width: 0.5, color: Color(0x20000000)
35
+                            // 0x17000000
36
+                            ))),
40 37
                 child: Row(
41 38
                   children: [
42 39
                     Container(
@@ -44,15 +41,13 @@ class _InformationState extends State<Information> {
44 41
                       width: 100,
45 42
                       height: 100,
46 43
                       decoration: BoxDecoration(
47
-                        image:  DecorationImage(
44
+                        image: DecorationImage(
48 45
                           image: AssetImage('images/cars.png'),
49 46
                           fit: BoxFit.cover,
50 47
                         ),
51
-
52 48
                         borderRadius: BorderRadius.circular(12),
53 49
                       ),
54
-                    )
55
-                    ,
50
+                    ),
56 51
                     Column(
57 52
                       crossAxisAlignment: CrossAxisAlignment.start,
58 53
                       children: [
@@ -65,7 +60,9 @@ class _InformationState extends State<Information> {
65 60
                               textAlign: TextAlign.left,
66 61
                               overflow: TextOverflow.ellipsis,
67 62
                               style: TextStyle(
68
-                                fontSize: 17.sp, fontWeight: FontWeight.bold,)),
63
+                                fontSize: 17.sp,
64
+                                fontWeight: FontWeight.bold,
65
+                              )),
69 66
                         ),
70 67
                         Container(
71 68
                           child: Text('2022-02-09'),
@@ -73,24 +70,20 @@ class _InformationState extends State<Information> {
73 70
                       ],
74 71
                     )
75 72
                   ],
76
-                )
77
-            ),
73
+                )),
78 74
             onTap: () {
79 75
               Get.toNamed('/ArticleInfo');
80 76
             },
81 77
           ),
82 78
           GestureDetector(
83
-            child:
84
-            Container(
79
+            child: Container(
85 80
                 padding: EdgeInsets.fromLTRB(0, 30, 0, 30),
86 81
                 width: 310.w,
87 82
                 decoration: const BoxDecoration(
88
-                    border:Border(
89
-                        bottom:
90
-                        BorderSide(width: 0.5, color: Color(0x20000000)
91
-                          // 0x17000000
92
-                        ))
93
-                ),
83
+                    border: Border(
84
+                        bottom: BorderSide(width: 0.5, color: Color(0x20000000)
85
+                            // 0x17000000
86
+                            ))),
94 87
                 child: Row(
95 88
                   children: [
96 89
                     Container(
@@ -98,15 +91,13 @@ class _InformationState extends State<Information> {
98 91
                       width: 100,
99 92
                       height: 100,
100 93
                       decoration: BoxDecoration(
101
-                        image:  DecorationImage(
94
+                        image: DecorationImage(
102 95
                           image: AssetImage('images/cars.png'),
103 96
                           fit: BoxFit.cover,
104 97
                         ),
105
-
106 98
                         borderRadius: BorderRadius.circular(12),
107 99
                       ),
108
-                    )
109
-                    ,
100
+                    ),
110 101
                     Column(
111 102
                       crossAxisAlignment: CrossAxisAlignment.start,
112 103
                       children: [
@@ -119,7 +110,9 @@ class _InformationState extends State<Information> {
119 110
                               textAlign: TextAlign.left,
120 111
                               overflow: TextOverflow.ellipsis,
121 112
                               style: TextStyle(
122
-                                fontSize: 17.sp, fontWeight: FontWeight.bold,)),
113
+                                fontSize: 17.sp,
114
+                                fontWeight: FontWeight.bold,
115
+                              )),
123 116
                         ),
124 117
                         Container(
125 118
                           child: Text('2022-02-09'),
@@ -127,13 +120,11 @@ class _InformationState extends State<Information> {
127 120
                       ],
128 121
                     )
129 122
                   ],
130
-                )
131
-            ),
123
+                )),
132 124
             onTap: () {
133 125
               print('进入资讯详情');
134 126
             },
135 127
           )
136
-
137 128
         ],
138 129
       ),
139 130
     );

+ 12
- 0
lib/pages/MoreCars/index.dart Voir le fichier

@@ -2,6 +2,7 @@ import 'dart:convert';
2 2
 
3 3
 import 'package:farmer_client/pages/home/widgets/home/widgets/headers.dart';
4 4
 import 'package:flutter/material.dart';
5
+import 'package:flutter_easyloading/flutter_easyloading.dart';
5 6
 import 'package:flutter_screenutil/flutter_screenutil.dart';
6 7
 import 'package:get/get.dart';
7 8
 
@@ -52,18 +53,24 @@ class _MoreCarsState extends State<MoreCars> with TickerProviderStateMixin {
52 53
 
53 54
 //进来拿到全部农机
54 55
   void _getAllCarsList() {
56
+    EasyLoading.show(status: '数据加载中...');
57
+
55 58
     getMachinery(location ?? '112.087465,32.687507').then((value) {
56 59
       final list = <CardListModel>[];
57 60
       value['records'].forEach((item) {
58 61
         list.add(CardListModel.fromJson(item));
59 62
       });
60 63
       cardTypeList(list);
64
+      EasyLoading.dismiss();
65
+
61 66
     });
62 67
   }
63 68
 
64 69
   //全部农机分类
65 70
   void _geList() {
66 71
     getMachineryType().then((value) {
72
+      EasyLoading.show(status: '数据加载中...');
73
+
67 74
       final list = <CardTypeModel>[];
68 75
       List classtypeId = [];
69 76
       List<CardTypeModel> newTabs = [
@@ -82,6 +89,8 @@ class _MoreCarsState extends State<MoreCars> with TickerProviderStateMixin {
82 89
       hasTopLoad = true;
83 90
       _controller = TabController(length: tabText.value.length, vsync: this);
84 91
       print(hasTopLoad);
92
+      EasyLoading.dismiss();
93
+
85 94
     });
86 95
   }
87 96
 
@@ -92,6 +101,8 @@ class _MoreCarsState extends State<MoreCars> with TickerProviderStateMixin {
92 101
     } else {
93 102
       final typeId = classId.value[index];
94 103
       print('typeId+$typeId');
104
+      EasyLoading.show(status: '数据加载中...');
105
+
95 106
       typeMachinery(location ?? '112.087465,32.687507', typeId.toString())
96 107
           .then((value) {
97 108
         final list = <CardListModel>[];
@@ -99,6 +110,7 @@ class _MoreCarsState extends State<MoreCars> with TickerProviderStateMixin {
99 110
           list.add(CardListModel.fromJson(item));
100 111
         });
101 112
         cardTypeList(list);
113
+        EasyLoading.dismiss();
102 114
 
103 115
       });
104 116
     }

+ 42
- 48
lib/pages/OrderConfirmation/index.dart Voir le fichier

@@ -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/services.dart';
6
+import 'package:flutter_easyloading/flutter_easyloading.dart';
6 7
 import 'package:flutter_screenutil/flutter_screenutil.dart';
7 8
 import 'package:fluttertoast/fluttertoast.dart';
8 9
 import 'package:get/get.dart';
@@ -20,19 +21,23 @@ class OrderConfirmation extends BasicPage {
20 21
   final selectDate = Rx<DateTime>(DateTime.now()); //选择的时间
21 22
   final workingArea = Rx<int>(0);
22 23
   AddressController addressController = AddressController.t;
23
-  final item = Rx<CardInfo>(CardInfo());//全部详情
24
-  final orderInfo = Rx<OrderInfoModel>(OrderInfoModel());//全部详情
24
+  final item = Rx<CardInfo>(CardInfo()); //全部详情
25
+  final orderInfo = Rx<OrderInfoModel>(OrderInfoModel()); //全部详情
25 26
 
26 27
   @override
27 28
   void beforeShow() {
28 29
     // TODO: implement beforeShow
29 30
     super.beforeShow();
30
-    if(Get.arguments['item']!=null){
31
+    if (Get.arguments['item'] != null) {
31 32
       item(Get.arguments['item']);
32
-    }else{
33
-      markId=Get.arguments['id'];
34
-      getMachineryInfo(markId, '122.08400000000002,37.421998333333335', true).then((value) {
33
+    } else {
34
+      markId = Get.arguments['id'];
35
+      EasyLoading.show(status: '数据加载中...');
36
+
37
+      getMachineryInfo(markId, '122.08400000000002,37.421998333333335', true)
38
+          .then((value) {
35 39
         item(CardInfo.fromJson(value));
40
+        EasyLoading.dismiss();
36 41
 
37 42
       });
38 43
 
@@ -42,37 +47,30 @@ class OrderConfirmation extends BasicPage {
42 47
     }
43 48
   }
44 49
 
50
+  Map<String, dynamic> data = {};
45 51
 
46
-  Map<String, dynamic> data = {
47
-
48
-  };
49
-
50
-  void _orderSubmit (){
51
-
52
+  void _orderSubmit() {
52 53
     if ((_formKey.currentState as FormState).validate()) {
53
-          data = {
54
+      data = {
54 55
         'charges': item.value.price! * workingArea.value,
55
-        'price':  item.value.price,
56
+        'price': item.value.price,
56 57
         'amount': workingArea.value,
57
-        'machineryId':  item.value.machineryId,
58
-        'machineryName':  item.value.name,
59
-        'machineryType':  item.value.typeId,
60
-        'typeName':  item.value.typeName,
58
+        'machineryId': item.value.machineryId,
59
+        'machineryName': item.value.name,
60
+        'machineryType': item.value.typeId,
61
+        'typeName': item.value.typeName,
61 62
         'address': addressController.address.value.address,
62
-        'orgId':  item.value.orgId,
63
-        'appointmentDate': '${DateFormat("yyyy-MM-dd").format(selectDate.value)} 08:00:00',
63
+        'orgId': item.value.orgId,
64
+        'appointmentDate':
65
+            '${DateFormat("yyyy-MM-dd").format(selectDate.value)} 08:00:00',
64 66
       };
65 67
       generateOrder(data).then((value) {
66 68
         orderInfo(OrderInfoModel.fromJson(value));
67
-        Fluttertoast.showToast(
68
-            msg: '预约成功'
69
-        );
70
-        Get.offNamed('/orderPageInfo',arguments: {'id':orderInfo().orderId});
71
-
69
+        Fluttertoast.showToast(msg: '预约成功');
70
+        Get.offNamed('/orderPageInfo', arguments: {'id': orderInfo().orderId});
72 71
       });
73 72
       //验证通过提交数据
74 73
     }
75
-
76 74
   }
77 75
 
78 76
   @override
@@ -155,28 +153,26 @@ class OrderConfirmation extends BasicPage {
155 153
                     Padding(
156 154
                       padding: EdgeInsets.fromLTRB(10, 0, 0, 0),
157 155
                       child: GestureDetector(
158
-                        onTap: () async {
159
-                          var handleChnage = await showDatePicker(
160
-                            context: context,
161
-                            helpText: '请选择作业开始时间',
162
-                            cancelText: '取消',
163
-                            confirmText: '确定',
164
-                            initialDate: selectDate() == null
165
-                                ? DateTime.now()
166
-                                : selectDate(),
167
-                            firstDate: DateTime.now(),
168
-                            lastDate: DateTime(2030),
169
-                          );
170
-                          selectDate(handleChnage!);
171
-                          print('${selectDate}+');
172
-                        },
173
-                        child: Obx(()=>
174
-                            Text(selectDate == null
156
+                          onTap: () async {
157
+                            var handleChnage = await showDatePicker(
158
+                              context: context,
159
+                              helpText: '请选择作业开始时间',
160
+                              cancelText: '取消',
161
+                              confirmText: '确定',
162
+                              initialDate: selectDate() == null
163
+                                  ? DateTime.now()
164
+                                  : selectDate(),
165
+                              firstDate: DateTime.now(),
166
+                              lastDate: DateTime(2030),
167
+                            );
168
+                            selectDate(handleChnage!);
169
+                            print('${selectDate}+');
170
+                          },
171
+                          child: Obx(
172
+                            () => Text(selectDate == null
175 173
                                 ? '请选择日期'
176 174
                                 : '${DateFormat("yyyy-MM-dd").format(selectDate())}'),
177
-                        )
178
-
179
-                      ),
175
+                          )),
180 176
                     )
181 177
                   ],
182 178
                 )),
@@ -240,8 +236,6 @@ class OrderConfirmation extends BasicPage {
240 236
                 child: ElevatedButton(
241 237
                   onPressed: () {
242 238
                     _orderSubmit();
243
-
244
-
245 239
                   },
246 240
                   child: const Text(
247 241
                     "确定",

+ 13
- 18
lib/pages/addAddress/index.dart Voir le fichier

@@ -8,8 +8,7 @@ import 'package:fluttertoast/fluttertoast.dart';
8 8
 import 'package:get/get.dart';
9 9
 
10 10
 class AddAddress extends BasicPage {
11
-
12
-  final address =Rx<Address>(Address());
11
+  final address = Rx<Address>(Address());
13 12
   late String text = '';
14 13
   late String id = '';
15 14
 
@@ -17,7 +16,7 @@ class AddAddress extends BasicPage {
17 16
   void beforeShow() {
18 17
     super.beforeShow();
19 18
     if (Get.arguments != null) {
20
-      print( Get.arguments['item']);
19
+      print(Get.arguments['item']);
21 20
       // address(Get.arguments['item']);
22 21
       text = Get.arguments['item'];
23 22
       id = Get.arguments['id'];
@@ -26,7 +25,7 @@ class AddAddress extends BasicPage {
26 25
 
27 26
   @override
28 27
   Widget builder(BuildContext context) {
29
-    naviTitle='添加地址';
28
+    naviTitle = '添加地址';
30 29
     return Container(
31 30
       padding: EdgeInsets.all(15.w),
32 31
       child: Column(
@@ -62,7 +61,7 @@ class AddAddress extends BasicPage {
62 61
                 floatingLabelBehavior: FloatingLabelBehavior.never,
63 62
               ),
64 63
               onChanged: (e) {
65
-                  address().address=e;
64
+                address().address = e;
66 65
               },
67 66
             ),
68 67
           ),
@@ -73,21 +72,17 @@ class AddAddress extends BasicPage {
73 72
             height: 49.h,
74 73
             text: '保存',
75 74
             onPressed: () {
76
-              if(address.value.address==null){
77
-                Fluttertoast.showToast(
78
-                    msg: '请输入地址!');
79
-              } else{
80
-                if(text==''){
81
-                  addressSave(address().address.toString()).then((value){
82
-                    Fluttertoast.showToast(
83
-                        msg: '添加地址成功!');
75
+              if (address.value.address == null) {
76
+                Fluttertoast.showToast(msg: '请输入地址!');
77
+              } else {
78
+                if (text == '') {
79
+                  addressSave(address().address.toString()).then((value) {
80
+                    Fluttertoast.showToast(msg: '添加地址成功!');
84 81
                     Get.back();
85 82
                   });
86
-
87
-                }else{
88
-                  addressUpdate(id,address().address.toString()).then((value) {
89
-                    Fluttertoast.showToast(
90
-                        msg: '修改地址成功!');
83
+                } else {
84
+                  addressUpdate(id, address().address.toString()).then((value) {
85
+                    Fluttertoast.showToast(msg: '修改地址成功!');
91 86
                     Get.back();
92 87
                   });
93 88
                 }

+ 5
- 0
lib/pages/addressList/index.dart Voir le fichier

@@ -4,6 +4,7 @@ import 'package:farmer_client/pages/addressList/widget/AddressCard.dart';
4 4
 import 'package:farmer_client/widgets/DefaultButton.dart';
5 5
 import 'package:farmer_client/widgets/layout/BasicPage.dart';
6 6
 import 'package:flutter/material.dart';
7
+import 'package:flutter_easyloading/flutter_easyloading.dart';
7 8
 import 'package:flutter_screenutil/flutter_screenutil.dart';
8 9
 import 'package:fluttertoast/fluttertoast.dart';
9 10
 import 'package:get/get.dart';
@@ -19,12 +20,16 @@ class AddressList extends BasicPage {
19 20
   @override
20 21
   void beforeShow() {
21 22
     super.beforeShow();
23
+    EasyLoading.show(status: '数据加载中...');
24
+
22 25
     getAddress().then((value) {
23 26
       final list = <Address>[];
24 27
       value['records'].forEach((item) {
25 28
         list.add(Address.fromJson(item));
26 29
       });
27 30
       addressList(list);
31
+      EasyLoading.dismiss();
32
+
28 33
     });
29 34
     if (Get.arguments != null) {
30 35
       isBack = Get.arguments['isBack'];

+ 9
- 9
lib/pages/agreement/index.dart Voir le fichier

@@ -3,7 +3,6 @@ import 'package:flutter/material.dart';
3 3
 import 'package:flutter_screenutil/flutter_screenutil.dart';
4 4
 
5 5
 class Agreement extends BasicPage {
6
-
7 6
   @override
8 7
   Widget builder(BuildContext context) {
9 8
     naviTitle = '用户协议及隐私政策';
@@ -16,20 +15,21 @@ class Agreement extends BasicPage {
16 15
           Row(
17 16
             mainAxisAlignment: MainAxisAlignment.center,
18 17
             children: [
19
-              Image(image: const AssetImage(
20
-                  'images/icons/decorate.png'
21
-              ),width: 16.5.w),
22
-              Text('用户协议',
18
+              Image(
19
+                  image: const AssetImage('images/icons/decorate.png'),
20
+                  width: 16.5.w),
21
+              Text(
22
+                '用户协议',
23 23
                 style: TextStyle(
24 24
                     fontSize: 20.sp,
25 25
                     fontWeight: FontWeight.bold,
26
-                    color: const Color(0xFF222222)
27
-                ),
26
+                    color: const Color(0xFF222222)),
28 27
               ),
29
-              Image(image: const AssetImage('images/icons/decorate.png'),width: 16.5.w),
28
+              Image(
29
+                  image: const AssetImage('images/icons/decorate.png'),
30
+                  width: 16.5.w),
30 31
             ],
31 32
           ),
32
-
33 33
         ],
34 34
       ),
35 35
     );

+ 25
- 27
lib/pages/feedback/index.dart Voir le fichier

@@ -8,8 +8,8 @@ import 'package:get/get.dart';
8 8
 import '../../services/main.dart';
9 9
 
10 10
 class Feedback extends BasicPage {
11
-  final text=Rx<String>('');
12
-  final isEdit=Rx<bool>(false);
11
+  final text = Rx<String>('');
12
+  final isEdit = Rx<bool>(false);
13 13
 
14 14
   @override
15 15
   Widget builder(BuildContext context) {
@@ -40,38 +40,37 @@ class Feedback extends BasicPage {
40 40
                 floatingLabelBehavior: FloatingLabelBehavior.never,
41 41
               ),
42 42
               onTap: () {
43
-                  isEdit.value=true;
43
+                isEdit.value = true;
44 44
               },
45 45
               onChanged: (e) {
46
-                  text.value = e;
46
+                text.value = e;
47 47
               },
48 48
             ),
49 49
           ),
50
-          Obx(()=>
51
-          Visibility(
52
-          visible:!isEdit(),
53
-            child:
54
-          Positioned(
55
-            left: 20.w,
56
-            top: 5.w,
57
-            child: Row(
58
-              children: [
59
-                Image.asset(
60
-                  'images/icons/feedbackIcon.png',
61
-                  width: 15.w,
62
-                ),
63
-                Text(
64
-                  '请留下您宝贵的意见和建议!',
65
-                  style: TextStyle(
66
-                      fontSize: 17.sp,
67
-                      letterSpacing: 2,
68
-                      color: Color(0xFFBEBDBD)),
50
+          Obx(
51
+            () => Visibility(
52
+              visible: !isEdit(),
53
+              child: Positioned(
54
+                left: 20.w,
55
+                top: 5.w,
56
+                child: Row(
57
+                  children: [
58
+                    Image.asset(
59
+                      'images/icons/feedbackIcon.png',
60
+                      width: 15.w,
61
+                    ),
62
+                    Text(
63
+                      '请留下您宝贵的意见和建议!',
64
+                      style: TextStyle(
65
+                          fontSize: 17.sp,
66
+                          letterSpacing: 2,
67
+                          color: Color(0xFFBEBDBD)),
68
+                    ),
69
+                  ],
69 70
                 ),
70
-              ],
71
+              ),
71 72
             ),
72 73
           ),
73
-          ),
74
-          ),
75 74
           Positioned(
76 75
             bottom: 25.h,
77 76
             child: DefaultButton(
@@ -88,7 +87,6 @@ class Feedback extends BasicPage {
88 87
                     Fluttertoast.showToast(msg: '提交成功!');
89 88
                     Get.back();
90 89
                   });
91
-
92 90
                 }
93 91
               },
94 92
               margin: const EdgeInsets.all(0),

+ 1
- 1
lib/pages/home.dart Voir le fichier

@@ -1 +1 @@
1
-// TODO Implement this library.
1
+// TODO Implement this library.

+ 21
- 14
lib/pages/home/widgets/home/index.dart Voir le fichier

@@ -2,6 +2,7 @@ import 'package:carousel_slider/carousel_slider.dart';
2 2
 import 'package:farmer_client/pages/home/widgets/home/widgets/headers.dart';
3 3
 import 'package:farmer_client/widgets/NullCard.dart';
4 4
 import 'package:flutter/material.dart';
5
+import 'package:flutter_easyloading/flutter_easyloading.dart';
5 6
 import 'package:flutter_screenutil/flutter_screenutil.dart';
6 7
 import 'package:get/get.dart';
7 8
 import '../../../../models/app.dart';
@@ -31,35 +32,40 @@ class _HomePageState extends State<HomePage> {
31 32
   @override
32 33
   void initState() {
33 34
     super.initState();
34
-   // final long=   location.value!['longitude'].toString() + "," + location.value!['latitude'].toString();
35
-   //  print('location+$location,lolongglongng+$long');
36
-
35
+    // final long=   location.value!['longitude'].toString() + "," + location.value!['latitude'].toString();
36
+    //  print('location+$location,lolongglongng+$long');
37 37
     getHomeBanner('banner').then((value) {
38
+      EasyLoading.show(status: '数据加载中...');
39
+
38 40
       setState(() {
39 41
         value.forEach((item) {
40 42
           bannerList.add(Banners.fromJson(item));
41 43
         });
42 44
       });
45
+      EasyLoading.dismiss();
46
+
43 47
     });
44 48
 
45
-    getMachinery(location??'112.087465,32.687507').then((value) {
49
+    getMachinery(location ?? '112.087465,32.687507').then((value) {
50
+      EasyLoading.show(status: '数据加载中...');
51
+
46 52
       setState(() {
47 53
         value['records'].forEach((item) {
48 54
           machineryLists.add(CardListModel.fromJson(item));
49 55
         });
50 56
       });
57
+      EasyLoading.dismiss();
58
+
51 59
     });
52 60
   }
53 61
 
54 62
   @override
55 63
   Widget build(BuildContext context) {
56 64
     return Container(
57
-      decoration: BoxDecoration(
58
-        color: Colors.white
59
-      ),
65
+      decoration: BoxDecoration(color: Colors.white),
60 66
       alignment: Alignment.center,
61 67
       padding: EdgeInsets.fromLTRB(15.w, 0, 15.w, 0),
62
-      child:  Column(
68
+      child: Column(
63 69
         children: [
64 70
           TypeHeader(
65 71
             type: true,
@@ -124,12 +130,13 @@ class _HomePageState extends State<HomePage> {
124 130
                       )
125 131
                     ],
126 132
                   ),
127
-                  machineryLists.length>= 1?
128
-                  Column(
129
-                    children: machineryLists
130
-                        .map((item) => CarsCard(item: item))
131
-                        .toList(),
132
-                  ):NullCard(text: '暂无农机信息!')
133
+                  machineryLists.length >= 1
134
+                      ? Column(
135
+                          children: machineryLists
136
+                              .map((item) => CarsCard(item: item))
137
+                              .toList(),
138
+                        )
139
+                      : NullCard(text: '暂无农机信息!')
133 140
                 ],
134 141
               )),
135 142
         ],

+ 1
- 2
lib/pages/index.dart Voir le fichier

@@ -1,4 +1,3 @@
1
-
2 1
 export 'ArticleInfo/ArticleInfo.dart';
3 2
 export 'OrderConfirmation/index.dart';
4 3
 export 'aboutUs/index.dart';
@@ -17,4 +16,4 @@ export 'splash/splash.dart';
17 16
 export 'login/login.dart';
18 17
 export 'machinery/map/index.dart';
19 18
 export 'machinery/detail/index.dart';
20
-// export 'main/index.dart';
19
+// export 'main/index.dart';

+ 23
- 25
lib/pages/infomation/index.dart Voir le fichier

@@ -1,6 +1,7 @@
1 1
 import 'package:farmer_client/pages/infomation/widgets/Information/index.dart';
2 2
 import 'package:farmer_client/widgets/layout/BasicPage.dart';
3 3
 import 'package:flutter/material.dart';
4
+import 'package:flutter_easyloading/flutter_easyloading.dart';
4 5
 import 'package:get/get_rx/src/rx_types/rx_types.dart';
5 6
 import 'package:get/get_state_manager/get_state_manager.dart';
6 7
 
@@ -17,40 +18,37 @@ class Infomation extends BasicPage {
17 18
 
18 19
   final newsListItem = Rx<List<NewsInformationModel>>([]);
19 20
 
20
-@override
21
+  @override
21 22
   void beforeShow() {
22
-
23 23
     // TODO: implement beforeShow
24 24
     super.beforeShow();
25
-  getNewsList().then((value) {
26
-    final list = <NewsInformationModel>[];
25
+    EasyLoading.show(status: '数据加载中...');
27 26
 
28
-     value['records'].forEach((item) {
29
-       list.add(NewsInformationModel.fromJson(item));
30
-       print('newsListItem');
27
+    getNewsList().then((value) {
28
+      final list = <NewsInformationModel>[];
31 29
 
32
-       print(newsListItem.value);
30
+      value['records'].forEach((item) {
31
+        list.add(NewsInformationModel.fromJson(item));
32
+        print('newsListItem');
33 33
 
34
-     });
35
-    newsListItem.value=list;
34
+        print(newsListItem.value);
35
+      });
36
+      newsListItem.value = list;
37
+      EasyLoading.dismiss();
36 38
 
37
-  });
38
-}
39
+    });
40
+  }
39 41
 
40 42
   @override
41 43
   Widget builder(BuildContext context) {
42
-
43 44
     return Container(
44
-        child:
45
-            Obx(()=>
46
-          Column(
47
-            mainAxisSize: MainAxisSize.min,
48
-            children:newsListItem.value.map((item) => Information(item: item,)).toList(),
49
-          )
50
-
51
-            )
52
-    );
53
-
54
-
45
+        child: Obx(() => Column(
46
+              mainAxisSize: MainAxisSize.min,
47
+              children: newsListItem.value
48
+                  .map((item) => Information(
49
+                        item: item,
50
+                      ))
51
+                  .toList(),
52
+            )));
55 53
   }
56
-}
54
+}

+ 9
- 9
lib/pages/infomation/widgets/Information/index.dart Voir le fichier

@@ -20,14 +20,12 @@ class Information extends StatefulWidget {
20 20
 class _InformationState extends State<Information> {
21 21
   final NewsInformationModel item;
22 22
 
23
-
24 23
   _InformationState(this.item);
25 24
 
26
-
27 25
   @override
28 26
   Widget build(BuildContext context) {
29 27
     return Container(
30
-      child:   Column(
28
+      child: Column(
31 29
         children: [
32 30
           // ListTile用不好
33 31
           GestureDetector(
@@ -36,8 +34,8 @@ class _InformationState extends State<Information> {
36 34
                 decoration: const BoxDecoration(
37 35
                     border: Border(
38 36
                         bottom: BorderSide(width: 0.5, color: Color(0x20000000)
39
-                          // 0x17000000
40
-                        ))),
37
+                            // 0x17000000
38
+                            ))),
41 39
                 child: Row(
42 40
                   children: [
43 41
                     Container(
@@ -70,20 +68,22 @@ class _InformationState extends State<Information> {
70 68
                         ),
71 69
                         Container(
72 70
                           child: Text(
73
-                              item.createDate!=null? DateFormat("yyyy-MM-dd").format(DateTime.parse(item.createDate.toString())):item.createDate.toString(),),
71
+                            item.createDate != null
72
+                                ? DateFormat("yyyy-MM-dd").format(
73
+                                    DateTime.parse(item.createDate.toString()))
74
+                                : item.createDate.toString(),
75
+                          ),
74 76
                         )
75 77
                       ],
76 78
                     )
77 79
                   ],
78 80
                 )),
79 81
             onTap: () {
80
-              Get.to(ArticleInfo(),arguments: {'newsId':item.newsId});
82
+              Get.to(ArticleInfo(), arguments: {'newsId': item.newsId});
81 83
             },
82 84
           ),
83 85
         ],
84 86
       ),
85 87
     );
86
-
87
-
88 88
   }
89 89
 }

+ 0
- 1
lib/pages/login/login.dart Voir le fichier

@@ -101,7 +101,6 @@ class _RouteLogin extends State<MyRouteLogin> {
101 101
         userLogin(handlePhones, handleCodes).then((value) {
102 102
           userInfo(Person.fromJson(value['person']));
103 103
 
104
-
105 104
           Get.off(Home());
106 105
         });
107 106
       } else {

+ 21
- 11
lib/pages/machinery/detail/index.dart Voir le fichier

@@ -1,6 +1,7 @@
1 1
 import 'package:farmer_client/models/entities/CardInfo.dart';
2 2
 import 'package:farmer_client/widgets/layout/BasicPage.dart';
3 3
 import 'package:flutter/material.dart';
4
+import 'package:flutter_easyloading/flutter_easyloading.dart';
4 5
 import 'package:get/get.dart';
5 6
 import '../../../services/homeAPI.dart';
6 7
 import 'widgets/detail.dart';
@@ -8,30 +9,33 @@ import 'widgets/detail.dart';
8 9
 class MachineryDetailPage extends BasicPage {
9 10
   String markId = '';
10 11
   String marKm = '';
11
-  final machineryInfoContent = Rx<CardInfo>(CardInfo());//全部详情
12
-  final machineryListBanner = Rx<List<BannerImageList>>([]);//banner轮播
13
-  final machineryListContent= Rx<List<ContentImageList>>([]);//图文详情
12
+  final machineryInfoContent = Rx<CardInfo>(CardInfo()); //全部详情
13
+  final machineryListBanner = Rx<List<BannerImageList>>([]); //banner轮播
14
+  final machineryListContent = Rx<List<ContentImageList>>([]); //图文详情
14 15
   // 响应预约事件
15 16
   void handleClick() {
16
-    Get.toNamed('/orderConfirmation',arguments: {'item':machineryInfoContent()});
17
+    Get.toNamed('/orderConfirmation',
18
+        arguments: {'item': machineryInfoContent()});
17 19
   }
18 20
 
19
-
20 21
   @override
21 22
   void beforeShow() {
22 23
     // TODO: implement onMounted
23 24
     super.beforeShow();
24 25
     if (Get.arguments['id'] != null) {
25
-     markId = Get.arguments['id'];
26
-     marKm = Get.arguments['km'];
27
-     print(marKm);
28
-      getMachineryInfo(markId, '122.08400000000002,37.421998333333335', true).then((value) {
26
+      EasyLoading.show(status: '数据加载中...');
27
+
28
+      markId = Get.arguments['id'];
29
+      marKm = Get.arguments['km'];
30
+      print(marKm);
31
+      getMachineryInfo(markId, '122.08400000000002,37.421998333333335', true)
32
+          .then((value) {
29 33
         machineryInfoContent(CardInfo.fromJson(value));
30 34
         machineryListBanner(machineryInfoContent().imagesList!);
31 35
         machineryListContent(machineryInfoContent().contentList!);
36
+        EasyLoading.dismiss();
32 37
 
33 38
       });
34
-
35 39
     }
36 40
     print("----show----detail page--------------");
37 41
   }
@@ -46,6 +50,12 @@ class MachineryDetailPage extends BasicPage {
46 50
   @override
47 51
   Widget builder(BuildContext context) {
48 52
     naviTitle = "查看详情";
49
-    return Obx(()=>page(context: context, handleClick: handleClick,km:marKm,item:machineryInfoContent.value,bnnerItem:machineryListBanner.value,contentItem:machineryListContent.value));
53
+    return Obx(() => page(
54
+        context: context,
55
+        handleClick: handleClick,
56
+        km: marKm,
57
+        item: machineryInfoContent.value,
58
+        bnnerItem: machineryListBanner.value,
59
+        contentItem: machineryListContent.value));
50 60
   }
51 61
 }

+ 35
- 18
lib/pages/machinery/detail/widgets/detail.dart Voir le fichier

@@ -1,4 +1,3 @@
1
-
2 1
 import 'package:carousel_slider/carousel_slider.dart';
3 2
 import 'package:farmer_client/pages/machinery/widgets/DefLayout.dart';
4 3
 import 'package:farmer_client/pages/machinery/widgets/RoundButton.dart';
@@ -11,17 +10,21 @@ import 'package:get/get.dart';
11 10
 import '../../../../models/entities/CardInfo.dart';
12 11
 import '../../widgets/summary.dart';
13 12
 
14
-Widget page({ required BuildContext context, VoidCallback? handleClick,required String km,required CardInfo item,required List<BannerImageList> bnnerItem,required List<ContentImageList> contentItem}) {
15
-
16
-
13
+Widget page(
14
+    {required BuildContext context,
15
+    VoidCallback? handleClick,
16
+    required String km,
17
+    required CardInfo item,
18
+    required List<BannerImageList> bnnerItem,
19
+    required List<ContentImageList> contentItem}) {
17 20
   return DefLayout(
18 21
       head: CarouselSlider(
19 22
         items: bnnerItem
20 23
             .map((item) => Container(
21
-          child: Center(
22
-              child: Image.network(item.url.toString(),
23
-                  fit: BoxFit.fitWidth, width: 370.w)),
24
-        ))
24
+                  child: Center(
25
+                      child: Image.network(item.url.toString(),
26
+                          fit: BoxFit.fitWidth, width: 370.w)),
27
+                ))
25 28
             .toList(),
26 29
         options: CarouselOptions(
27 30
           autoPlay: true,
@@ -35,21 +38,29 @@ Widget page({ required BuildContext context, VoidCallback? handleClick,required
35 38
       children: [
36 39
         DefLayout.card(
37 40
           top: DefLayout.headHeight - DefLayout.offset,
38
-          padding: EdgeInsets.only(top: 45.w, left: 15.w, right: 15.w, bottom: 20.w),
39
-          child: _content(context, handleClick,item,contentItem,km),
41
+          padding:
42
+              EdgeInsets.only(top: 45.w, left: 15.w, right: 15.w, bottom: 20.w),
43
+          child: _content(context, handleClick, item, contentItem, km),
40 44
         )
41
-      ]
42
-  );
45
+      ]);
43 46
 }
44 47
 
45
-Widget _content(BuildContext context, VoidCallback? handleClick, CardInfo item,List<ContentImageList> contentItem, String km) {
48
+Widget _content(BuildContext context, VoidCallback? handleClick, CardInfo item,
49
+    List<ContentImageList> contentItem, String km) {
46 50
   return Column(
47 51
     children: [
48
-     summary(item: item,km:km),
52
+      summary(item: item, km: km),
49 53
       _sectionHead('农机详情'),
50
-      ExtendContentList(item: contentItem,),
51
-      SizedBox(height: 20.w,),
52
-      RoundButton(text: "预约", onPressed: handleClick,)
54
+      ExtendContentList(
55
+        item: contentItem,
56
+      ),
57
+      SizedBox(
58
+        height: 20.w,
59
+      ),
60
+      RoundButton(
61
+        text: "预约",
62
+        onPressed: handleClick,
63
+      )
53 64
     ],
54 65
   );
55 66
 }
@@ -68,7 +79,13 @@ Widget _sectionHead(String title) {
68 79
       children: [
69 80
         img,
70 81
         SizedBox(width: 20.w),
71
-        Text(title, style: TextStyle(fontSize: 16.sp, color: const Color(0xFF222222), fontWeight: FontWeight.w500),),
82
+        Text(
83
+          title,
84
+          style: TextStyle(
85
+              fontSize: 16.sp,
86
+              color: const Color(0xFF222222),
87
+              fontWeight: FontWeight.w500),
88
+        ),
72 89
         SizedBox(width: 20.w),
73 90
         img,
74 91
       ],

+ 14
- 9
lib/pages/machinery/map/index.dart Voir le fichier

@@ -1,7 +1,7 @@
1
-
2 1
 import 'package:farmer_client/pages/machinery/map/widgets/detail.dart';
3 2
 import 'package:farmer_client/widgets/layout/BasicPage.dart';
4 3
 import 'package:flutter/material.dart';
4
+import 'package:flutter_easyloading/flutter_easyloading.dart';
5 5
 import 'package:get/get.dart';
6 6
 
7 7
 import '../../../models/entities/CardInfo.dart';
@@ -10,12 +10,12 @@ import '../../../services/homeAPI.dart';
10 10
 class MachineryMapPage extends BasicPage {
11 11
   String markId = '';
12 12
   String marKm = '';
13
-  final machineryInfoContent = Rx<CardInfo>(CardInfo());//全部详情
13
+  final machineryInfoContent = Rx<CardInfo>(CardInfo()); //全部详情
14 14
   // 响应预约事件
15 15
   void handleClick() {
16 16
     // Get.toNamed("/machineryDetail");
17
-    Get.toNamed('/orderConfirmation',arguments: {'item':machineryInfoContent()});
18
-
17
+    Get.toNamed('/orderConfirmation',
18
+        arguments: {'item': machineryInfoContent()});
19 19
   }
20 20
 
21 21
   @override
@@ -23,14 +23,17 @@ class MachineryMapPage extends BasicPage {
23 23
     // TODO: implement onMounted
24 24
     super.beforeShow();
25 25
     if (Get.arguments['id'] != null) {
26
+      EasyLoading.show(status: '数据加载中...');
27
+
26 28
       markId = Get.arguments['id'];
27 29
       marKm = Get.arguments['km'];
28 30
       print(marKm);
29
-      getMachineryInfo(markId, '122.08400000000002,37.421998333333335', true).then((value) {
31
+      getMachineryInfo(markId, '122.08400000000002,37.421998333333335', true)
32
+          .then((value) {
30 33
         machineryInfoContent(CardInfo.fromJson(value));
34
+        EasyLoading.dismiss();
31 35
 
32 36
       });
33
-
34 37
     }
35 38
     print("----show----map page--------------");
36 39
   }
@@ -45,8 +48,10 @@ class MachineryMapPage extends BasicPage {
45 48
   @override
46 49
   Widget builder(BuildContext context) {
47 50
     naviTitle = "查看地图";
48
-    return Obx(()=>page(context: context, handleClick: handleClick,item: machineryInfoContent(),km: marKm));
51
+    return Obx(() => page(
52
+        context: context,
53
+        handleClick: handleClick,
54
+        item: machineryInfoContent(),
55
+        km: marKm));
49 56
   }
50
-  
51 57
 }
52
-

+ 32
- 28
lib/pages/machinery/map/widgets/detail.dart Voir le fichier

@@ -1,4 +1,3 @@
1
-
2 1
 import 'package:farmer_client/pages/machinery/widgets/DefLayout.dart';
3 2
 import 'package:farmer_client/pages/machinery/widgets/RoundButton.dart';
4 3
 import 'package:flutter/material.dart';
@@ -10,42 +9,47 @@ import 'package:farmer_client/widgets/amap/amap.dart';
10 9
 import '../../../../models/entities/CardInfo.dart';
11 10
 import '../../widgets/summary.dart';
12 11
 
13
-Widget page({required CardInfo item,required String km, required BuildContext context, VoidCallback? handleClick}) {
12
+Widget page(
13
+    {required CardInfo item,
14
+    required String km,
15
+    required BuildContext context,
16
+    VoidCallback? handleClick}) {
14 17
   final _offset = 20.w;
15 18
   final width = MediaQuery.of(context).size.width;
16 19
   final mapHeight = 226.5.w;
17 20
   final cardHeight = 250.w;
18 21
 
19
-
20 22
   final LatLng position = LatLng(32.690712, 112.091892);
21 23
 
22
-  return DefLayout(
23
-      head: AMap(position: position),
24
-      children: [
25
-        DefLayout.card(
26
-            top: DefLayout.headHeight - DefLayout.offset,
27
-            height: DefLayout.headHeight,
28
-            child: Image.network(item.thumb.toString(), fit: BoxFit.cover,
29
-            errorBuilder:  (ctx, exception, stackTrace) {
30
-              return Container(); //THE WIDGET YOU WANT TO SHOW IF URL NOT RETURN IMAGE
31
-            },
32
-            ),
33
-        ),
34
-        DefLayout.card(
35
-            top: (DefLayout.headHeight - DefLayout.offset) * 2,
36
-            padding: EdgeInsets.only(top: 45.w, left: 15.w, right: 15.w, bottom: 20.w),
37
-            child: _content(context, handleClick,item,km)
38
-        ),
39
-      ]
40
-  );
24
+  return DefLayout(head: AMap(position: position), children: [
25
+    DefLayout.card(
26
+      top: DefLayout.headHeight - DefLayout.offset,
27
+      height: DefLayout.headHeight,
28
+      child: Image.network(
29
+        item.thumb.toString(),
30
+        fit: BoxFit.cover,
31
+        errorBuilder: (ctx, exception, stackTrace) {
32
+          return Container(); //THE WIDGET YOU WANT TO SHOW IF URL NOT RETURN IMAGE
33
+        },
34
+      ),
35
+    ),
36
+    DefLayout.card(
37
+        top: (DefLayout.headHeight - DefLayout.offset) * 2,
38
+        padding:
39
+            EdgeInsets.only(top: 45.w, left: 15.w, right: 15.w, bottom: 20.w),
40
+        child: _content(context, handleClick, item, km)),
41
+  ]);
41 42
 }
42 43
 
43
-Widget _content(BuildContext context, VoidCallback? handleClick,CardInfo item,String km) {
44
-  return
45
-    Column(
44
+Widget _content(
45
+    BuildContext context, VoidCallback? handleClick, CardInfo item, String km) {
46
+  return Column(
46 47
     children: [
47
-      summary(item: item,km:km),
48
-      RoundButton(text: "预约", onPressed: handleClick,),
48
+      summary(item: item, km: km),
49
+      RoundButton(
50
+        text: "预约",
51
+        onPressed: handleClick,
52
+      ),
49 53
     ],
50 54
   );
51
-}
55
+}

+ 8
- 5
lib/pages/machinery/widgets/DefLayout.dart Voir le fichier

@@ -1,4 +1,3 @@
1
-
2 1
 import 'package:flutter/material.dart';
3 2
 import 'package:flutter_screenutil/flutter_screenutil.dart';
4 3
 
@@ -6,12 +5,17 @@ class DefLayout extends StatelessWidget {
6 5
   Widget head;
7 6
   List<Widget> children;
8 7
 
9
-  DefLayout({Key? key, required this.head, required this.children}): super(key: key);
8
+  DefLayout({Key? key, required this.head, required this.children})
9
+      : super(key: key);
10 10
 
11 11
   static double headHeight = 214.w;
12 12
   static double offset = 20.w;
13 13
 
14
-  static Widget card({required double top, required Widget child, double? height, EdgeInsetsGeometry? padding}) {
14
+  static Widget card(
15
+      {required double top,
16
+      required Widget child,
17
+      double? height,
18
+      EdgeInsetsGeometry? padding}) {
15 19
     final _border = 20.w;
16 20
     return Container(
17 21
       margin: EdgeInsets.only(top: top),
@@ -20,8 +24,7 @@ class DefLayout extends StatelessWidget {
20 24
       clipBehavior: Clip.hardEdge,
21 25
       decoration: BoxDecoration(
22 26
           color: Colors.white,
23
-          borderRadius: BorderRadius.vertical(top: Radius.circular(_border))
24
-      ),
27
+          borderRadius: BorderRadius.vertical(top: Radius.circular(_border))),
25 28
       child: child,
26 29
     );
27 30
   }

+ 4
- 8
lib/pages/machinery/widgets/RoundButton.dart Voir le fichier

@@ -1,30 +1,26 @@
1
-
2 1
 import 'package:flutter/material.dart';
3 2
 import 'package:flutter_screenutil/flutter_screenutil.dart';
4 3
 
5 4
 class RoundButton extends StatelessWidget {
6
-
7 5
   String text;
8 6
   VoidCallback? onPressed;
9 7
 
10
-  RoundButton({Key? key, this.onPressed, required this.text}): super(key: key);
8
+  RoundButton({Key? key, this.onPressed, required this.text}) : super(key: key);
11 9
 
12 10
   @override
13 11
   Widget build(BuildContext context) {
14
-
15 12
     return ElevatedButton(
16 13
       child: Text(text),
17 14
       style: ElevatedButton.styleFrom(
18 15
           primary: const Color(0xFFFF703B),
19
-          textStyle: TextStyle(color: Colors.white, fontSize: 20.sp, letterSpacing: 5.sp),
16
+          textStyle: TextStyle(
17
+              color: Colors.white, fontSize: 20.sp, letterSpacing: 5.sp),
20 18
           elevation: 0,
21 19
           minimumSize: Size(double.infinity, 49.w),
22 20
           shape: RoundedRectangleBorder(
23 21
             borderRadius: BorderRadius.all(Radius.circular(24.5.w)),
24
-          )
25
-      ),
22
+          )),
26 23
       onPressed: onPressed,
27 24
     );
28 25
   }
29
-
30 26
 }

+ 44
- 33
lib/pages/machinery/widgets/summary.dart Voir le fichier

@@ -6,22 +6,26 @@ import 'package:farmer_client/widgets/LinearGradientText.dart';
6 6
 
7 7
 import '../../../models/entities/CardInfo.dart';
8 8
 
9
-Widget summary({required CardInfo item,required String km}) {
10
-
9
+Widget summary({required CardInfo item, required String km}) {
11 10
   return Column(
12 11
     children: [
13 12
       _title(item: item),
14
-      SizedBox(height: 20.w,),
15
-      _desc(item: item,km: km),
16
-      SizedBox(height: 20.w,),
13
+      SizedBox(
14
+        height: 20.w,
15
+      ),
16
+      _desc(item: item, km: km),
17
+      SizedBox(
18
+        height: 20.w,
19
+      ),
17 20
       _detail(item: item),
18
-      SizedBox(height: 20.w,),
21
+      SizedBox(
22
+        height: 20.w,
23
+      ),
19 24
     ],
20 25
   );
21 26
 }
22 27
 
23 28
 Widget _title({required CardInfo item}) {
24
-
25 29
   return Row(
26 30
     children: [
27 31
       Expanded(
@@ -41,28 +45,26 @@ Widget _title({required CardInfo item}) {
41 45
             Color(0xFFB61515),
42 46
           ],
43 47
           child: RichText(
44
-            text: TextSpan(
45
-                children: <InlineSpan>[
46
-                  TextSpan(
47
-                      text: ((item.price??0)/100).toString(),
48
-                      style: TextStyle(
49
-                        fontSize: 22.sp,
50
-                        fontWeight: FontWeight.bold,
51
-                      )),
52
-                  TextSpan(
53
-                      text: "元/",
54
-                      style: TextStyle(
55
-                        fontSize: 22.sp,
56
-                        fontWeight: FontWeight.bold,
57
-                      )),
58
-                  TextSpan(
59
-                      text: "公顷",
60
-                      style: TextStyle(
61
-                        fontSize: 12.sp,
62
-                        fontWeight: FontWeight.bold,
63
-                      )),
64
-                ]
65
-            ),
48
+            text: TextSpan(children: <InlineSpan>[
49
+              TextSpan(
50
+                  text: ((item.price ?? 0) / 100).toString(),
51
+                  style: TextStyle(
52
+                    fontSize: 22.sp,
53
+                    fontWeight: FontWeight.bold,
54
+                  )),
55
+              TextSpan(
56
+                  text: "元/",
57
+                  style: TextStyle(
58
+                    fontSize: 22.sp,
59
+                    fontWeight: FontWeight.bold,
60
+                  )),
61
+              TextSpan(
62
+                  text: "公顷",
63
+                  style: TextStyle(
64
+                    fontSize: 12.sp,
65
+                    fontWeight: FontWeight.bold,
66
+                  )),
67
+            ]),
66 68
           ),
67 69
         ),
68 70
       )
@@ -70,13 +72,19 @@ Widget _title({required CardInfo item}) {
70 72
   );
71 73
 }
72 74
 
73
-Widget _desc({required CardInfo item,required String km}) {
75
+Widget _desc({required CardInfo item, required String km}) {
74 76
   return Row(
75 77
     children: [
76
-      Icon(Icons.location_on_outlined, size: 16.sp,),
78
+      Icon(
79
+        Icons.location_on_outlined,
80
+        size: 16.sp,
81
+      ),
77 82
       Expanded(
78 83
         flex: 1,
79
-        child: Text("距离当前位置$km >>", style: TextStyle(color: const Color(0xFF222222), fontSize: 15.sp),),
84
+        child: Text(
85
+          "距离当前位置$km >>",
86
+          style: TextStyle(color: const Color(0xFF222222), fontSize: 15.sp),
87
+        ),
80 88
       ),
81 89
     ],
82 90
   );
@@ -85,6 +93,9 @@ Widget _desc({required CardInfo item,required String km}) {
85 93
 Widget _detail({required CardInfo item}) {
86 94
   return Container(
87 95
     alignment: Alignment.centerLeft,
88
-    child: Text(item.orgName.toString(), style: TextStyle(color: const Color(0xFF222222), fontSize: 15.sp),),
96
+    child: Text(
97
+      item.orgName.toString(),
98
+      style: TextStyle(color: const Color(0xFF222222), fontSize: 15.sp),
99
+    ),
89 100
   );
90 101
 }

+ 9
- 5
lib/pages/main/index.dart Voir le fichier

@@ -1,6 +1,7 @@
1 1
 import 'package:farmer_client/pages/main/widgets/main/index.dart';
2 2
 import 'package:farmer_client/widgets/layout/BasicPage.dart';
3 3
 import 'package:flutter/material.dart';
4
+import 'package:flutter_easyloading/flutter_easyloading.dart';
4 5
 import 'package:get/get.dart';
5 6
 import 'package:get/get_rx/src/rx_types/rx_types.dart';
6 7
 
@@ -15,13 +16,12 @@ class Main extends BasicPage {
15 16
   final addressListInfo = Rx<List<Address>>([]);
16 17
   final addressInfoContent = Rx<Address>(Address());
17 18
 
18
-
19
-
20
-
21 19
   @override
22 20
   void beforeShow() {
23 21
     // TODO: implement beforeShow
24 22
     super.beforeShow();
23
+    EasyLoading.show(status: '数据加载中...');
24
+
25 25
     getAddress().then((value) {
26 26
       List<Address> list = [];
27 27
       value['records'].forEach((item) {
@@ -29,11 +29,15 @@ class Main extends BasicPage {
29 29
       });
30 30
       addressListInfo(list);
31 31
       addressInfoContent(addressListInfo()[0]);
32
+      EasyLoading.dismiss();
33
+
32 34
     });
33 35
   }
34 36
 
35 37
   @override
36 38
   Widget builder(BuildContext context) {
37
-    return Obx(()=>MainPage( item: addressInfoContent(),));
39
+    return Obx(() => MainPage(
40
+          item: addressInfoContent(),
41
+        ));
38 42
   }
39
-}
43
+}

+ 12
- 15
lib/pages/main/widgets/main/index.dart Voir le fichier

@@ -11,26 +11,24 @@ import 'package:farmer_client/widgets/Modal.dart' as modal;
11 11
 class MainPage extends StatelessWidget {
12 12
   final Address item;
13 13
 
14
-
15
-
16 14
   MainPage({Key? key, required this.item}) : super(key: key);
17 15
 
18 16
   GetStorage box = GetStorage();
19 17
 
20
-  void _userOut(){
21
-    modal.showDialog(title: '提示', content:
22
-    Container(
23
-      alignment: Alignment.center,
24
-      child:  Text('确定要退出登陆吗?'),
25
-    ),onCancel: ()=>true,
18
+  void _userOut() {
19
+    modal.showDialog(
20
+        title: '提示',
21
+        content: Container(
22
+          alignment: Alignment.center,
23
+          child: Text('确定要退出登陆吗?'),
24
+        ),
25
+        onCancel: () => true,
26 26
         onConfirm: () => {
27
-        box.remove('token'),
28
-    Get.offNamed('/login'),
29
-
30
-  });
27
+              box.remove('token'),
28
+              Get.offNamed('/login'),
29
+            });
31 30
   }
32 31
 
33
-
34 32
   @override
35 33
   Widget build(BuildContext context) {
36 34
     return Container(
@@ -40,7 +38,7 @@ class MainPage extends StatelessWidget {
40 38
           Column(
41 39
             children: [
42 40
               UserInfo(), //头部,头像手机号姓名
43
-              UserAddress(item:item),//用户地址
41
+              UserAddress(item: item), //用户地址
44 42
               OtherColumn(), //功能菜单栏
45 43
               Container(
46 44
                 height: 70.h,
@@ -61,7 +59,6 @@ class MainPage extends StatelessWidget {
61 59
                   child: ElevatedButton(
62 60
                     onPressed: () {
63 61
                       _userOut();
64
-
65 62
                     },
66 63
                     child: const Text(
67 64
                       "退出登陆",

+ 2
- 1
lib/pages/main/widgets/main/widgets/UserAddress.dart Voir le fichier

@@ -65,7 +65,8 @@ class UserAddress extends StatelessWidget {
65 65
                         ),
66 66
                         Container(
67 67
                           width: 260,
68
-                          child:  Text(item!=null?item.address.toString():'请设置详细地址!',
68
+                          child: Text(
69
+                            item != null ? item.address.toString() : '请设置详细地址!',
69 70
                             softWrap: true,
70 71
                             maxLines: 1,
71 72
                             textAlign: TextAlign.left,

+ 22
- 20
lib/pages/main/widgets/main/widgets/UserInfo.dart Voir le fichier

@@ -7,7 +7,7 @@ import '../../../../../models/app.dart';
7 7
 class UserInfo extends StatelessWidget {
8 8
   AppController userInfo = AppController.t;
9 9
 
10
-   UserInfo({Key? key}) : super(key: key);
10
+  UserInfo({Key? key}) : super(key: key);
11 11
 
12 12
   @override
13 13
   Widget build(BuildContext context) {
@@ -44,7 +44,7 @@ class UserInfo extends StatelessWidget {
44 44
                 child: GestureDetector(
45 45
                   child: const Text(
46 46
                     '修改个人信息',
47
-                    style: TextStyle(color: Colors.white,fontSize: 14),
47
+                    style: TextStyle(color: Colors.white, fontSize: 14),
48 48
                   ),
49 49
                   onTap: () {
50 50
                     Get.toNamed('/userInfo');
@@ -61,13 +61,14 @@ class UserInfo extends StatelessWidget {
61 61
                     height: 63.w,
62 62
                     decoration: BoxDecoration(
63 63
                       shape: BoxShape.circle,
64
-                      image: userInfo.user().avatar!=null?
65
-                      DecorationImage(
66
-                        image: NetworkImage(userInfo.user().avatar.toString()),
67
-                        fit: BoxFit.cover,
68
-                      ): DecorationImage(
69
-                        image: AssetImage('images/userMoren.png')
70
-                      ),
64
+                      image: userInfo.user().avatar != null
65
+                          ? DecorationImage(
66
+                              image: NetworkImage(
67
+                                  userInfo.user().avatar.toString()),
68
+                              fit: BoxFit.cover,
69
+                            )
70
+                          : DecorationImage(
71
+                              image: AssetImage('images/userMoren.png')),
71 72
                       border: Border.all(
72 73
                         color: Colors.white,
73 74
                         width: 2,
@@ -84,9 +85,10 @@ class UserInfo extends StatelessWidget {
84 85
                   children: [
85 86
                     Container(
86 87
                       margin: EdgeInsets.fromLTRB(0, 0, 0, 10),
87
-                      child:
88
-                      Text(
89
-                        userInfo.user().nickName!=null?userInfo.user().nickName.toString():'请修改个人信息!',
88
+                      child: Text(
89
+                        userInfo.user().nickName != null
90
+                            ? userInfo.user().nickName.toString()
91
+                            : '请修改个人信息!',
90 92
                         style: TextStyle(
91 93
                           color: Colors.white,
92 94
                           fontSize: 17,
@@ -95,14 +97,14 @@ class UserInfo extends StatelessWidget {
95 97
                     ),
96 98
                     Container(
97 99
                       margin: EdgeInsets.fromLTRB(0, 10, 0, 0),
98
-                      child:
99
-                          Text(
100
-                            userInfo.user().phone!=null?userInfo.user().phone.toString():'请修改手机号!',
101
-                            style: TextStyle(
102
-                              color: Colors.white,
103
-                              fontSize: 17,
104
-                            ),
105
-
100
+                      child: Text(
101
+                        userInfo.user().phone != null
102
+                            ? userInfo.user().phone.toString()
103
+                            : '请修改手机号!',
104
+                        style: TextStyle(
105
+                          color: Colors.white,
106
+                          fontSize: 17,
107
+                        ),
106 108
                       ),
107 109
                     ),
108 110
                     // const Text(

+ 1
- 2
lib/pages/order/index.dart Voir le fichier

@@ -2,7 +2,6 @@ import 'package:farmer_client/widgets/layout/BasicPage.dart';
2 2
 import 'package:flutter/material.dart';
3 3
 import './widgets/order/index.dart';
4 4
 
5
-
6 5
 class Order extends BasicPage {
7 6
   Order({Key? key}) : super(key: key) {
8 7
     tabIndex = 1;
@@ -13,4 +12,4 @@ class Order extends BasicPage {
13 12
   Widget builder(BuildContext context) {
14 13
     return const OrderPage();
15 14
   }
16
-}
15
+}

+ 42
- 36
lib/pages/order/widgets/order/index.dart Voir le fichier

@@ -1,5 +1,6 @@
1 1
 import 'package:farmer_client/widgets/NullCard.dart';
2 2
 import 'package:flutter/material.dart';
3
+import 'package:flutter_easyloading/flutter_easyloading.dart';
3 4
 import 'package:flutter_screenutil/flutter_screenutil.dart';
4 5
 import 'package:get/get_rx/src/rx_types/rx_types.dart';
5 6
 
@@ -22,59 +23,64 @@ class _OrderPageState extends State<OrderPage> {
22 23
   void initState() {
23 24
     // TODO: implement initState
24 25
     super.initState();
26
+
25 27
     getOrderList(true).then((value) {
28
+      EasyLoading.show(status: '数据加载中...');
29
+
26 30
       final list = <OrderListAll>[];
27 31
       setState(() {
28 32
         value['records'].forEach((item) {
29 33
           list.add(OrderListAll.fromJson(item));
30
-
31 34
         });
32 35
       });
33 36
       orderListItem(list);
37
+      EasyLoading.dismiss();
34 38
 
35 39
     });
36 40
   }
37 41
 
38 42
   @override
39 43
   Widget build(BuildContext context) {
40
-    return orderListItem().length>0?
41
-      Column(
42
-      children: [
43
-        Container(
44
-          padding: EdgeInsets.fromLTRB(15, 0, 15, 0),
45
-          height: 55.w,
46
-          decoration: BoxDecoration(color: Colors.white),
47
-          child: Row(
48
-            mainAxisAlignment: MainAxisAlignment.spaceBetween,
44
+    return orderListItem().length > 0
45
+        ? Column(
49 46
             children: [
50
-              Row(
51
-                children: [
52
-                  Padding(
53
-                    padding: EdgeInsets.fromLTRB(0, 0, 8, 0),
54
-                    child: Image(
55
-                      image: AssetImage('images/ordersListImga.png'),
56
-                      fit: BoxFit.cover,
57
-                      width: 18.w,
47
+              Container(
48
+                padding: EdgeInsets.fromLTRB(15, 0, 15, 0),
49
+                height: 55.w,
50
+                decoration: BoxDecoration(color: Colors.white),
51
+                child: Row(
52
+                  mainAxisAlignment: MainAxisAlignment.spaceBetween,
53
+                  children: [
54
+                    Row(
55
+                      children: [
56
+                        Padding(
57
+                          padding: EdgeInsets.fromLTRB(0, 0, 8, 0),
58
+                          child: Image(
59
+                            image: AssetImage('images/ordersListImga.png'),
60
+                            fit: BoxFit.cover,
61
+                            width: 18.w,
62
+                          ),
63
+                        ),
64
+                        Text(
65
+                          '订单列表',
66
+                          style: TextStyle(
67
+                              color: Color(0xff222222),
68
+                              fontSize: 20.sp,
69
+                              fontWeight: FontWeight.bold),
70
+                        )
71
+                      ],
58 72
                     ),
59
-                  ),
60
-                  Text(
61
-                    '订单列表',
62
-                    style: TextStyle(
63
-                        color: Color(0xff222222),
64
-                        fontSize: 20.sp,
65
-                        fontWeight: FontWeight.bold),
66
-                  )
67
-                ],
73
+                  ],
74
+                ),
75
+              ),
76
+              Column(
77
+                mainAxisSize: MainAxisSize.min,
78
+                children: orderListItem()
79
+                    .map((item) => OrderListCard(item: item))
80
+                    .toList(),
68 81
               ),
69 82
             ],
70
-          ),
71
-        ),
72
-        Column(
73
-          mainAxisSize: MainAxisSize.min,
74
-          children:
75
-          orderListItem().map((item) => OrderListCard(item: item)).toList(),
76
-        ),
77
-      ],
78
-    ):NullCard(text: '您还没有新的订单!');
83
+          )
84
+        : NullCard(text: '您还没有新的订单!');
79 85
   }
80 86
 }

+ 92
- 78
lib/pages/orderInfo/index.dart Voir le fichier

@@ -2,6 +2,7 @@ import 'package:farmer_client/pages/orderInfo/widgets/star.dart';
2 2
 import 'package:farmer_client/widgets/DefaultButton.dart';
3 3
 import 'package:ff_stars/ff_stars.dart';
4 4
 import 'package:flutter/material.dart';
5
+import 'package:flutter_easyloading/flutter_easyloading.dart';
5 6
 import 'package:flutter_screenutil/flutter_screenutil.dart';
6 7
 import 'package:fluttertoast/fluttertoast.dart';
7 8
 import 'package:get/get.dart';
@@ -23,9 +24,8 @@ class OrderPageInfo extends BasicPage {
23 24
   final orderStateText = Rx<String>('待支付');
24 25
   final orderStateColor = Rx<Color>(Colors.black);
25 26
   final orderInfoContent = Rx<OrderInfoModel>(OrderInfoModel());
26
-  final evalText=Rx<String>('');
27
-  final evalStars=Rx<num>(-1);
28
-
27
+  final evalText = Rx<String>('');
28
+  final evalStars = Rx<num>(-1);
29 29
 
30 30
   // orderStates
31 31
 
@@ -40,7 +40,11 @@ class OrderPageInfo extends BasicPage {
40 40
       orderStateColor(Get.arguments['styleColor']);
41 41
 
42 42
       orderInfo(id()).then((value) {
43
+        EasyLoading.show(status: '数据加载中...');
44
+
43 45
         orderInfoContent(OrderInfoModel.fromJson(value));
46
+        EasyLoading.dismiss();
47
+
44 48
       });
45 49
     }
46 50
   }
@@ -81,85 +85,97 @@ class OrderPageInfo extends BasicPage {
81 85
                     height: 49.h,
82 86
                     text: '评价',
83 87
                     onPressed: () {
84
-
85 88
                       modal.showDialog(
86 89
                           title: '评价此订单',
87 90
                           content: Container(
88
-                            alignment: Alignment.center,
89
-                            child:Container(
90
-                              margin: const EdgeInsets.fromLTRB(15, 20, 15, 20),
91
-                              child: Column(
92
-                                children: [
93
-                                  Container(
94
-                                    padding: const EdgeInsets.fromLTRB(0, 0, 0, 10),
95
-                                    decoration: const BoxDecoration(
96
-                                        border: Border(
97
-                                            bottom: BorderSide(
98
-                                                width: 0.8, color: Color(0x20000000)
99
-                                              // 0x17000000
100
-                                            ))),
101
-                                    child: Row(
102
-                                      children: [
103
-                                        Text('满意度:',style: TextStyle(fontSize: 17.sp,fontWeight: FontWeight.bold),),
104
-                                        FFStars(
105
-                                          //https://pub.dev/packages/ff_stars
106
-                                          normalStar:Image.asset('images/icons/starOff.png'),
107
-                                          selectedStar:Image.asset('images/icons/starOn.png'),
108
-                                          starsChanged: (realStars, selectedStars) {
109
-                                            evalStars(realStars);
110
-                                            print("real: $selectedStars, final: $realStars");
111
-                                          },
112
-                                          step: 1,
113
-                                          defaultStars: 0,
114
-                                        ),
115
-                                      ],
116
-                                    ),
117
-                                  ),
118
-                                  Container(
119
-                                    margin: const EdgeInsets.fromLTRB(0, 20, 0, 0),
120
-                                    width: 300.w,
121
-                                    height: 100.w,
122
-                                    decoration: BoxDecoration(
123
-                                      border: Border.all(
124
-                                        color: Color(0x20000000),
125
-                                        width: 0.8,
91
+                              alignment: Alignment.center,
92
+                              child: Container(
93
+                                margin:
94
+                                    const EdgeInsets.fromLTRB(15, 20, 15, 20),
95
+                                child: Column(
96
+                                  children: [
97
+                                    Container(
98
+                                      padding: const EdgeInsets.fromLTRB(
99
+                                          0, 0, 0, 10),
100
+                                      decoration: const BoxDecoration(
101
+                                          border: Border(
102
+                                              bottom: BorderSide(
103
+                                                  width: 0.8,
104
+                                                  color: Color(0x20000000)
105
+                                                  // 0x17000000
106
+                                                  ))),
107
+                                      child: Row(
108
+                                        children: [
109
+                                          Text(
110
+                                            '满意度:',
111
+                                            style: TextStyle(
112
+                                                fontSize: 17.sp,
113
+                                                fontWeight: FontWeight.bold),
114
+                                          ),
115
+                                          FFStars(
116
+                                            //https://pub.dev/packages/ff_stars
117
+                                            normalStar: Image.asset(
118
+                                                'images/icons/starOff.png'),
119
+                                            selectedStar: Image.asset(
120
+                                                'images/icons/starOn.png'),
121
+                                            starsChanged:
122
+                                                (realStars, selectedStars) {
123
+                                              evalStars(realStars);
124
+                                              print(
125
+                                                  "real: $selectedStars, final: $realStars");
126
+                                            },
127
+                                            step: 1,
128
+                                            defaultStars: 0,
129
+                                          ),
130
+                                        ],
126 131
                                       ),
127 132
                                     ),
128
-                                    child:  TextField(
129
-                                      minLines: 6,
130
-                                      maxLines: 6,
131
-                                      style: TextStyle(fontSize: 17.sp, height: 1.5),
132
-                                      decoration: const InputDecoration(
133
-                                        isCollapsed: true,
134
-                                        border: InputBorder.none,
135
-                                        counterText: '',
136
-                                        hintText: '请输入评价内容',
137
-                                        floatingLabelBehavior: FloatingLabelBehavior.never,
133
+                                    Container(
134
+                                      margin: const EdgeInsets.fromLTRB(
135
+                                          0, 20, 0, 0),
136
+                                      width: 300.w,
137
+                                      height: 100.w,
138
+                                      decoration: BoxDecoration(
139
+                                        border: Border.all(
140
+                                          color: Color(0x20000000),
141
+                                          width: 0.8,
142
+                                        ),
138 143
                                       ),
139
-                                      onChanged: (e) {
140
-                                        evalText(e);
141
-                                      },
142
-                                    ),
143
-                                  )
144
-
145
-                                ],
146
-                              )
147
-                              ,
148
-                            )
149
-                          ),
144
+                                      child: TextField(
145
+                                        minLines: 6,
146
+                                        maxLines: 6,
147
+                                        style: TextStyle(
148
+                                            fontSize: 17.sp, height: 1.5),
149
+                                        decoration: const InputDecoration(
150
+                                          isCollapsed: true,
151
+                                          border: InputBorder.none,
152
+                                          counterText: '',
153
+                                          hintText: '请输入评价内容',
154
+                                          floatingLabelBehavior:
155
+                                              FloatingLabelBehavior.never,
156
+                                        ),
157
+                                        onChanged: (e) {
158
+                                          evalText(e);
159
+                                        },
160
+                                      ),
161
+                                    )
162
+                                  ],
163
+                                ),
164
+                              )),
150 165
                           onCancel: () => true,
151
-                          onConfirm:() {
152
-                                if(evalStars.value!=-1&&evalText.value!=''){
153
-                                    orderEvaluation(id,evalStars.value,evalText.value).then((value) {
154
-                                      Fluttertoast.showToast(msg: '评价成功!');
155
-                                       Get.offNamed('/order');
156
-                                    });
157
-                                }else{
158
-                                  Fluttertoast.showToast(msg: '请完整选择评分或输入评价内容');
159
-                                  return false;
160
-                                }
161
-                          }
162
-                          );
166
+                          onConfirm: () {
167
+                            if (evalStars.value != -1 && evalText.value != '') {
168
+                              orderEvaluation(
169
+                                      id, evalStars.value, evalText.value)
170
+                                  .then((value) {
171
+                                Fluttertoast.showToast(msg: '评价成功!');
172
+                                Get.offNamed('/order');
173
+                              });
174
+                            } else {
175
+                              Fluttertoast.showToast(msg: '请完整选择评分或输入评价内容');
176
+                              return false;
177
+                            }
178
+                          });
163 179
                     },
164 180
                     margin: const EdgeInsets.all(0),
165 181
                     fontSize: 20.sp,
@@ -300,9 +316,7 @@ class _BottomWidget extends StatelessWidget {
300 316
                 Padding(
301 317
                   padding: EdgeInsets.fromLTRB(15.w, 0, 15.w, 0),
302 318
                   child: ListTile(
303
-                    onTap: (){
304
-
305
-                    },
319
+                    onTap: () {},
306 320
                     contentPadding: EdgeInsets.symmetric(horizontal: 0.0),
307 321
                     // 这边使用了contentPadding
308 322
                     leading: Image(

+ 20
- 37
lib/pages/orderInfo/widgets/star.dart Voir le fichier

@@ -1,34 +1,29 @@
1
-
2 1
 import 'package:flutter/material.dart';
3 2
 
4
-
5
-
6
-
7 3
 class HTStarRating extends StatefulWidget {
8
-  final double rating;       // 当前分数
9
-  final double maxRating;    // 满分
10
-  final int count;           // 总共几颗心
11
-  final double size;          // 星星大小
4
+  final double rating; // 当前分数
5
+  final double maxRating; // 满分
6
+  final int count; // 总共几颗心
7
+  final double size; // 星星大小
12 8
   final Color defaultColor;
13 9
   final Color selectedColor;
14 10
   final Widget unselectedImage;
15 11
   final Widget selectedImage;
16 12
 
17 13
   HTStarRating({
18
-    required this.rating,   // 必填
14
+    required this.rating, // 必填
19 15
     //选填, 初始默认值
20 16
     this.maxRating = 10,
21 17
     this.count = 5,
22 18
     this.size = 30,
23 19
     this.defaultColor = Colors.grey,
24 20
     this.selectedColor = Colors.red,
25
-     Widget? unselectedImage,
26
-     Widget? selectedImage,
27
-
28
-
29
-  }):unselectedImage = unselectedImage?? Icon(
30
-      Icons.star_border, color: defaultColor, size: size),
31
-        selectedImage = selectedImage?? Icon(Icons.star, color: selectedColor,size: size);
21
+    Widget? unselectedImage,
22
+    Widget? selectedImage,
23
+  })  : unselectedImage = unselectedImage ??
24
+            Icon(Icons.star_border, color: defaultColor, size: size),
25
+        selectedImage =
26
+            selectedImage ?? Icon(Icons.star, color: selectedColor, size: size);
32 27
 
33 28
   @override
34 29
   _HTStarRatingState createState() => _HTStarRatingState();
@@ -39,23 +34,16 @@ class _HTStarRatingState extends State<HTStarRating> {
39 34
   Widget build(BuildContext context) {
40 35
     return Stack(
41 36
       children: <Widget>[
42
-        Row(
43
-            mainAxisSize: MainAxisSize.min,
44
-            children: buildDefaultStar()
45
-        ),
46
-        Row(
47
-            mainAxisSize: MainAxisSize.min,
48
-            children: buildSelectedStar()
49
-        )
37
+        Row(mainAxisSize: MainAxisSize.min, children: buildDefaultStar()),
38
+        Row(mainAxisSize: MainAxisSize.min, children: buildSelectedStar())
50 39
       ],
51 40
     );
52 41
   }
53 42
 
54
-
55 43
   /*
56 44
   *  创建默认的星星
57 45
   * */
58
-  List<Widget> buildDefaultStar(){
46
+  List<Widget> buildDefaultStar() {
59 47
     return List.generate(widget.count, (index) {
60 48
       return widget.unselectedImage;
61 49
     });
@@ -72,20 +60,17 @@ class _HTStarRatingState extends State<HTStarRating> {
72 60
     double oneValue = widget.maxRating / widget.count;
73 61
     int entireCount = (widget.rating / oneValue).floor(); //.floor() 向下取整
74 62
 
75
-    for (var i = 0; i< entireCount ; i++){
63
+    for (var i = 0; i < entireCount; i++) {
76 64
       starts.add(star);
77 65
     }
78 66
     //构建部分start
79
-    double leftWidth = ((widget.rating /oneValue)-entireCount)* widget.size;
80
-    final halfStar = ClipRect(
81
-        clipper: HTStartClipper(leftWidth),
82
-        child: star
83
-    );
67
+    double leftWidth = ((widget.rating / oneValue) - entireCount) * widget.size;
68
+    final halfStar = ClipRect(clipper: HTStartClipper(leftWidth), child: star);
84 69
     starts.add(halfStar);
85 70
 
86 71
     // 防止传入参数大于总分
87
-    if (starts.length > widget.count){
88
-      return starts.sublist(0,widget.count);
72
+    if (starts.length > widget.count) {
73
+      return starts.sublist(0, widget.count);
89 74
     }
90 75
 
91 76
     return starts;
@@ -96,7 +81,6 @@ class _HTStarRatingState extends State<HTStarRating> {
96 81
 * 切割
97 82
 * */
98 83
 class HTStartClipper extends CustomClipper<Rect> {
99
-
100 84
   double width;
101 85
 
102 86
   HTStartClipper(this.width);
@@ -110,5 +94,4 @@ class HTStartClipper extends CustomClipper<Rect> {
110 94
   bool shouldReclip(HTStartClipper oldClipper) {
111 95
     return oldClipper.width != this.width;
112 96
   }
113
-
114
-}
97
+}

+ 16
- 14
lib/pages/search/index.dart Voir le fichier

@@ -2,6 +2,7 @@ import 'dart:async';
2 2
 
3 3
 import 'package:farmer_client/widgets/layout/BasicPage.dart';
4 4
 import 'package:flutter/material.dart';
5
+import 'package:flutter_easyloading/flutter_easyloading.dart';
5 6
 import 'package:flutter_screenutil/flutter_screenutil.dart';
6 7
 import 'package:get/get.dart';
7 8
 import 'package:get/get_rx/src/rx_types/rx_types.dart';
@@ -17,17 +18,19 @@ class SearchPage extends BasicPage {
17 18
   final cardSearchList = Rx<List<CardListModel>>([]);
18 19
   var location = AppController.t.locationStr;
19 20
 
21
+  void _onChange(String value) {
22
+    print(location);
23
+    searchMachinery(location.toString(), value).then((value) {
24
+      EasyLoading.show(status: '数据加载中...');
20 25
 
21
-  void _onChange(String value){
22
-      print(location);
23
-      searchMachinery(location.toString(),value).then((value) {
24
-        final list = <CardListModel>[];
25
-        value['records'].forEach((item) {
26
-          list.add(CardListModel.fromJson(item));
27
-        });
28
-        cardSearchList(list);
26
+      final list = <CardListModel>[];
27
+      value['records'].forEach((item) {
28
+        list.add(CardListModel.fromJson(item));
29 29
       });
30
+      cardSearchList(list);
31
+      EasyLoading.dismiss();
30 32
 
33
+    });
31 34
   }
32 35
 
33 36
   @override
@@ -71,12 +74,11 @@ class SearchPage extends BasicPage {
71 74
           ],
72 75
         ),
73 76
       ),
74
-          Obx(()=>Column(
75
-              children:
76
-              cardSearchList.value.length>0?
77
-                  cardSearchList().map((item) => CarsCard(item: item)).toList()
78
-                  :  [NullCard(text: '暂无农机信息!')],
79
-            ))
77
+      Obx(() => Column(
78
+            children: cardSearchList.value.length > 0
79
+                ? cardSearchList().map((item) => CarsCard(item: item)).toList()
80
+                : [NullCard(text: '暂无农机信息!')],
81
+          ))
80 82
     ]));
81 83
   }
82 84
 }

+ 0
- 1
lib/pages/splash/splash.dart Voir le fichier

@@ -4,7 +4,6 @@ import 'package:flutter_screenutil/flutter_screenutil.dart';
4 4
 import 'package:flutter/material.dart';
5 5
 import 'package:get_storage/get_storage.dart';
6 6
 
7
-
8 7
 class SplashScreen extends StatefulWidget {
9 8
   const SplashScreen({Key? key}) : super(key: key);
10 9
 

+ 32
- 36
lib/pages/userInfo/index.dart Voir le fichier

@@ -1,6 +1,7 @@
1 1
 import 'package:farmer_client/widgets/DefaultButton.dart';
2 2
 import 'package:farmer_client/widgets/layout/BasicPage.dart';
3 3
 import 'package:flutter/material.dart';
4
+import 'package:flutter_easyloading/flutter_easyloading.dart';
4 5
 import 'package:flutter_screenutil/flutter_screenutil.dart';
5 6
 import 'package:fluttertoast/fluttertoast.dart';
6 7
 import 'package:get/get.dart';
@@ -10,62 +11,58 @@ import '../../models/entities/person.dart';
10 11
 import '../../services/user.dart';
11 12
 
12 13
 class UserInfo extends BasicPage {
13
-  late String name ;
14
+  late String name;
14 15
   late String phone;
15 16
   late TextEditingController _cName;
16 17
   late TextEditingController _cPhone;
17 18
   AppController userInfo = AppController.t;
18 19
 
19
-
20 20
   @override
21 21
   void beforeShow() {
22 22
     super.beforeShow();
23 23
     _cName = TextEditingController(text: userInfo.user().nickName.toString());
24
-    _cPhone = TextEditingController(text:userInfo.user().phone.toString());
25
-    name=userInfo.user().nickName.toString();
26
-    phone=userInfo.user().phone.toString();
24
+    _cPhone = TextEditingController(text: userInfo.user().phone.toString());
25
+    name = userInfo.user().nickName.toString();
26
+    phone = userInfo.user().phone.toString();
27 27
   }
28 28
 
29 29
   bool disableLogin = false;
30 30
   RegExp exp = RegExp(r'^1[3456789]\d{9}$');
31 31
 
32
-  Map<String, dynamic> data = {
33
-
34
-  };
35
-
32
+  Map<String, dynamic> data = {};
36 33
 
37 34
   void handleOk() {
38 35
     if (name == '' && phone == '') {
39 36
       Fluttertoast.showToast(msg: '请输入正确的信息');
40 37
       return;
41
-
42
-    } else if (phone==''&&!exp.hasMatch(phone)) {
38
+    } else if (phone == '' && !exp.hasMatch(phone)) {
43 39
       Fluttertoast.showToast(msg: '请输入正确的手机号');
44 40
       return;
45 41
     } else {
46
-      data={
42
+      data = {
47 43
         ...userInfo.user().toJson(),
48
-        'avatar':userInfo.user().avatar ?? '',
44
+        'avatar': userInfo.user().avatar ?? '',
49 45
         'nickName': name,
50 46
         'phone': phone
51 47
       };
52
-      updateInfo(userInfo.user().personId.toString(),data).then((value) {
48
+      updateInfo(userInfo.user().personId.toString(), data).then((value) {
53 49
         // 尝试获取一次人员信息
50
+        EasyLoading.show(status: '数据加载中...');
51
+
54 52
         getCurrent().then((person) {
55 53
           userInfo.user(Person.fromJson(person));
56 54
           Fluttertoast.showToast(msg: '保存成功');
55
+          EasyLoading.dismiss();
57 56
 
58
-          Get.back();
59
-
57
+          Get.offAllNamed('/main');
60 58
         }).catchError((e) {
59
+          EasyLoading.showError('出错啦!');
61 60
           print(e);
62 61
         });
63
-
64 62
       });
65 63
     }
66 64
   }
67 65
 
68
-
69 66
   @override
70 67
   Widget builder(BuildContext context) {
71 68
     naviTitle = '个人信息';
@@ -98,16 +95,16 @@ class UserInfo extends BasicPage {
98 95
                     height: 63.w,
99 96
                     decoration: BoxDecoration(
100 97
                       shape: BoxShape.circle,
101
-                      image: userInfo.user().avatar!=null?
102
-                      DecorationImage(
103
-                        image: NetworkImage(userInfo.user().avatar.toString()),
104
-                        fit: BoxFit.cover,
105
-                      ): DecorationImage(
106
-                          image: AssetImage('images/userMoren.png')
107
-                      ),
98
+                      image: userInfo.user().avatar != null
99
+                          ? DecorationImage(
100
+                              image: NetworkImage(
101
+                                  userInfo.user().avatar.toString()),
102
+                              fit: BoxFit.cover,
103
+                            )
104
+                          : DecorationImage(
105
+                              image: AssetImage('images/userMoren.png')),
108 106
                     ),
109 107
                   ),
110
-
111 108
                 ]),
112 109
           ),
113 110
           Text(
@@ -119,7 +116,7 @@ class UserInfo extends BasicPage {
119 116
                 fontWeight: FontWeight.bold),
120 117
           ),
121 118
           Container(
122
-            width: 345.w,
119
+              width: 345.w,
123 120
               margin: EdgeInsets.fromLTRB(0, 10.h, 0, 40.h),
124 121
               padding: EdgeInsets.symmetric(vertical: 19.h, horizontal: 0),
125 122
               decoration: BoxDecoration(
@@ -152,18 +149,17 @@ class UserInfo extends BasicPage {
152 149
                               border: InputBorder.none,
153 150
                               counterText: '', //去掉计数
154 151
                               floatingLabelBehavior:
155
-                              FloatingLabelBehavior.never,
152
+                                  FloatingLabelBehavior.never,
156 153
                             ),
157 154
                             onChanged: (e) {
158
-
159
-                                name = e;
160
-                                print(name);
155
+                              name = e;
156
+                              print(name);
161 157
                             },
162 158
                           ),
163 159
                         ),
164 160
                         GestureDetector(
165 161
                           onTap: () {
166
-                              name = '';
162
+                            name = '';
167 163
                             _cName.clear();
168 164
                           },
169 165
                           child: Image.asset(
@@ -184,7 +180,7 @@ class UserInfo extends BasicPage {
184 180
                 fontWeight: FontWeight.bold),
185 181
           ),
186 182
           Container(
187
-            width: 345.w,
183
+              width: 345.w,
188 184
               margin: EdgeInsets.fromLTRB(0, 10.h, 0, 40.h),
189 185
               padding: EdgeInsets.symmetric(vertical: 19.h, horizontal: 0),
190 186
               decoration: BoxDecoration(
@@ -219,16 +215,16 @@ class UserInfo extends BasicPage {
219 215
                               border: InputBorder.none,
220 216
                               counterText: '', //去掉计数
221 217
                               floatingLabelBehavior:
222
-                              FloatingLabelBehavior.never,
218
+                                  FloatingLabelBehavior.never,
223 219
                             ),
224 220
                             onChanged: (e) {
225
-                                phone = e;
221
+                              phone = e;
226 222
                             },
227 223
                           ),
228 224
                         ),
229 225
                         GestureDetector(
230 226
                           onTap: () {
231
-                              phone = '';
227
+                            phone = '';
232 228
                             _cPhone.clear();
233 229
                           },
234 230
                           child: Image.asset(

+ 0
- 1
lib/routes/index.dart Voir le fichier

@@ -1,3 +1,2 @@
1
-
2 1
 export 'pages.dart';
3 2
 export 'middleWares.dart';

+ 1
- 2
lib/routes/middleWares.dart Voir le fichier

@@ -1,9 +1,8 @@
1
-
2 1
 import 'package:flutter/scheduler.dart';
3 2
 import 'package:get/get.dart';
4 3
 import 'package:get_storage/get_storage.dart';
5 4
 
6
-void routingCallback (routing) {
5
+void routingCallback(routing) {
7 6
   // GetStorage box = GetStorage();
8 7
   // bool isLogin = box.hasData('token');
9 8
   // bool isSplashScreen = routing?.current == '/splash';

+ 22
- 20
lib/routes/pages.dart Voir le fichier

@@ -3,25 +3,27 @@ import 'package:get_storage/get_storage.dart';
3 3
 import '../pages/index.dart';
4 4
 
5 5
 List<GetPage> pages = [
6
-  GetPage(name: '/', page: () {
7
-    GetStorage box = GetStorage();
8
-    return box.hasData('token') ? Home() : MyRouteLogin();
9
-  }),
10
-  GetPage(name: '/main', page: () =>  Main()),
11
-  GetPage(name: '/order', page: () =>  Order()),
12
-  GetPage(name: '/infomation', page: () =>  Infomation()),
13
-  GetPage(name: '/ArticleInfo', page: () =>  ArticleInfo()),//资讯详情
6
+  GetPage(
7
+      name: '/',
8
+      page: () {
9
+        GetStorage box = GetStorage();
10
+        return box.hasData('token') ? Home() : MyRouteLogin();
11
+      }),
12
+  GetPage(name: '/main', page: () => Main()),
13
+  GetPage(name: '/order', page: () => Order()),
14
+  GetPage(name: '/infomation', page: () => Infomation()),
15
+  GetPage(name: '/ArticleInfo', page: () => ArticleInfo()), //资讯详情
14 16
   // GetPage(name: '/splash', page: () => SplashScreen()), // SplashScreen
15
-  GetPage(name: '/login', page: () =>  MyRouteLogin()),
16
-  GetPage(name: '/addressList', page: () =>  AddressList()),
17
-  GetPage(name: '/addAddress', page: () =>  AddAddress()),
18
-  GetPage(name: '/userInfo', page: () =>  UserInfo()),
19
-  GetPage(name: '/machineryMap', page: () =>  MachineryMapPage()),
20
-  GetPage(name: '/machineryDetail', page: () =>  MachineryDetailPage()),
21
-  GetPage(name: '/aboutUs', page: () =>  AboutUs()),
22
-  GetPage(name: '/agreement', page: () =>  Agreement()),
23
-  GetPage(name: '/feedback', page: () =>  Feedback()),
24
-  GetPage(name: '/orderConfirmation', page: () =>  OrderConfirmation()),
25
-  GetPage(name: '/orderPageInfo', page: () =>  OrderPageInfo()),
26
-  GetPage(name: '/searchPage', page: () =>  SearchPage()),
17
+  GetPage(name: '/login', page: () => MyRouteLogin()),
18
+  GetPage(name: '/addressList', page: () => AddressList()),
19
+  GetPage(name: '/addAddress', page: () => AddAddress()),
20
+  GetPage(name: '/userInfo', page: () => UserInfo()),
21
+  GetPage(name: '/machineryMap', page: () => MachineryMapPage()),
22
+  GetPage(name: '/machineryDetail', page: () => MachineryDetailPage()),
23
+  GetPage(name: '/aboutUs', page: () => AboutUs()),
24
+  GetPage(name: '/agreement', page: () => Agreement()),
25
+  GetPage(name: '/feedback', page: () => Feedback()),
26
+  GetPage(name: '/orderConfirmation', page: () => OrderConfirmation()),
27
+  GetPage(name: '/orderPageInfo', page: () => OrderPageInfo()),
28
+  GetPage(name: '/searchPage', page: () => SearchPage()),
27 29
 ];

+ 23
- 31
lib/services/address.dart Voir le fichier

@@ -1,4 +1,3 @@
1
-
2 1
 import 'package:dio/dio.dart';
3 2
 import 'package:farmer_client/utils/Request.dart';
4 3
 import 'package:fluttertoast/fluttertoast.dart';
@@ -9,13 +8,12 @@ import 'package:fluttertoast/fluttertoast.dart';
9 8
  * @returns
10 9
  */
11 10
 Future getAddress() async {
12
-  return request('/address',
13
-      options: Options(method: 'GET')).catchError((error) => {
14
-    Fluttertoast.showToast(msg: error.error['message']),
15
-  });
11
+  return request('/address', options: Options(method: 'GET'))
12
+      .catchError((error) => {
13
+            Fluttertoast.showToast(msg: error.error['message']),
14
+          });
16 15
 }
17 16
 
18
-
19 17
 /**
20 18
  * 地址保存
21 19
  * @param {*} data
@@ -23,51 +21,45 @@ Future getAddress() async {
23 21
  */
24 22
 Future addressSave(String address) async {
25 23
   return request('/address',
26
-      options: Options(method: 'POST'), data: {'address': address})
24
+          options: Options(method: 'POST'), data: {'address': address})
27 25
       .catchError((error) => {
28
-    Fluttertoast.showToast(msg: error.error['message']),
29
-  });
26
+            Fluttertoast.showToast(msg: error.error['message']),
27
+          });
30 28
 }
31 29
 
32
-
33
-
34 30
 /**
35 31
  * 地址删除
36 32
  * @param {*} data
37 33
  * @returns
38 34
  */
39
-Future addressDelete(String id)async{
40
-  return request('/address/$id',options: Options(method: 'DELETE')).catchError((error) =>
41
-  { Fluttertoast.showToast(
42
-      msg: error.error['message']
43
-  ),});
44
-
35
+Future addressDelete(String id) async {
36
+  return request('/address/$id', options: Options(method: 'DELETE'))
37
+      .catchError((error) => {
38
+            Fluttertoast.showToast(msg: error.error['message']),
39
+          });
45 40
 }
46 41
 
47
-
48 42
 /**
49 43
  * 地址修改更新
50 44
  * @param {*} data
51 45
  * @returns
52 46
  */
53
-Future addressUpdate(String id,String address)async{
54
-  return request('/address/$id',options: Options(method: 'PUT'),data: {'address':address}).catchError((error) =>
55
-  { Fluttertoast.showToast(
56
-      msg: error.error['message']
57
-  ),});
58
-
47
+Future addressUpdate(String id, String address) async {
48
+  return request('/address/$id',
49
+          options: Options(method: 'PUT'), data: {'address': address})
50
+      .catchError((error) => {
51
+            Fluttertoast.showToast(msg: error.error['message']),
52
+          });
59 53
 }
60 54
 
61
-
62 55
 /**
63 56
  * 地址是否默认
64 57
  * @param {*} data
65 58
  * @returns
66 59
  */
67
-Future addressDefault(String id)async{
68
-  return request('/address/$id/default',options: Options(method: 'PUT')).catchError((error) =>
69
-  { Fluttertoast.showToast(
70
-      msg: error.error['message']
71
-  ),});
72
-
60
+Future addressDefault(String id) async {
61
+  return request('/address/$id/default', options: Options(method: 'PUT'))
62
+      .catchError((error) => {
63
+            Fluttertoast.showToast(msg: error.error['message']),
64
+          });
73 65
 }

+ 39
- 25
lib/services/homeAPI.dart Voir le fichier

@@ -34,48 +34,62 @@ Future getMachinery(String location) async {
34 34
  * @param {*} data
35 35
  * @returns
36 36
  */
37
-Future searchMachinery(String location,String? q,) async {
38
-  return request('/machinery', options: Options(method: 'GET'), queryParameters: {
39
-    'location': location,'q':q,
40
-  },data: {'q':q,'location':location}).catchError((error) => {
41
-    Fluttertoast.showToast(msg: error.error['message']),
42
-  });
37
+Future searchMachinery(
38
+  String location,
39
+  String? q,
40
+) async {
41
+  return request('/machinery',
42
+      options: Options(method: 'GET'),
43
+      queryParameters: {
44
+        'location': location,
45
+        'q': q,
46
+      },
47
+      data: {
48
+        'q': q,
49
+        'location': location
50
+      }).catchError((error) => {
51
+        Fluttertoast.showToast(msg: error.error['message']),
52
+      });
43 53
 }
44 54
 
45
-
46
-
47
-
48 55
 /**
49 56
  * 农机分类
50 57
  * @param {*} data
51 58
  * @returns
52 59
  */
53
-Future typeMachinery(String location,String typeId,) async {
54
-  return request('/machinery', options: Options(method: 'GET'), queryParameters: {
55
-    'location': location,'typeId':typeId,
56
-  },data: {'typeId':typeId,'location':location}).catchError((error) => {
57
-    Fluttertoast.showToast(msg: error.error['message']),
58
-  });
60
+Future typeMachinery(
61
+  String location,
62
+  String typeId,
63
+) async {
64
+  return request('/machinery',
65
+      options: Options(method: 'GET'),
66
+      queryParameters: {
67
+        'location': location,
68
+        'typeId': typeId,
69
+      },
70
+      data: {
71
+        'typeId': typeId,
72
+        'location': location
73
+      }).catchError((error) => {
74
+        Fluttertoast.showToast(msg: error.error['message']),
75
+      });
59 76
 }
60 77
 
61
-
62
-
63 78
 /**
64 79
  * 农机详情
65 80
  * @param {*} data
66 81
  * @returns
67 82
  */
68 83
 
69
-Future getMachineryInfo(String id,String location ,bool attached)async {
70
-  return request('/machinery-summary/$id', options: Options(method: 'GET'),
71
-      queryParameters: { 'location': location, 'attached': attached})
72
-      .catchError((error) =>
73
-  { Fluttertoast.showToast(
74
-      msg: error.error['message']
75
-  ),});
84
+Future getMachineryInfo(String id, String location, bool attached) async {
85
+  return request('/machinery-summary/$id',
86
+          options: Options(method: 'GET'),
87
+          queryParameters: {'location': location, 'attached': attached})
88
+      .catchError((error) => {
89
+            Fluttertoast.showToast(msg: error.error['message']),
90
+          });
76 91
 }
77 92
 
78
-
79 93
 /**
80 94
  * 农机分类Tab列查询
81 95
  * @param {*} data

+ 3
- 7
lib/services/main.dart Voir le fichier

@@ -10,12 +10,8 @@ import 'package:fluttertoast/fluttertoast.dart';
10 10
 
11 11
 Future feedback(String content) async {
12 12
   return request('/feedback',
13
-      options: Options(method: 'POST'), data: {'content': content})
13
+          options: Options(method: 'POST'), data: {'content': content})
14 14
       .catchError((error) => {
15
-    Fluttertoast.showToast(msg: error.error['message']),
16
-  });
15
+            Fluttertoast.showToast(msg: error.error['message']),
16
+          });
17 17
 }
18
-
19
-
20
-
21
-

+ 12
- 19
lib/services/news.dart Voir le fichier

@@ -1,21 +1,17 @@
1
-
2
-
3 1
 import 'package:dio/dio.dart';
4 2
 import 'package:farmer_client/utils/Request.dart';
5 3
 import 'package:fluttertoast/fluttertoast.dart';
6 4
 
7
-
8 5
 /**
9 6
  * 农机资讯
10 7
  * @param {*} data
11 8
  * @returns
12 9
  */
13
-Future getNewsList()async{
14
-  return request('/news',options: Options(method: 'GET')).catchError((error) =>
15
-  { Fluttertoast.showToast(
16
-      msg: error.error['message']
17
-  ),});
18
-
10
+Future getNewsList() async {
11
+  return request('/news', options: Options(method: 'GET'))
12
+      .catchError((error) => {
13
+            Fluttertoast.showToast(msg: error.error['message']),
14
+          });
19 15
 }
20 16
 
21 17
 /**
@@ -23,14 +19,11 @@ Future getNewsList()async{
23 19
  * @param {*} data
24 20
  * @returns
25 21
  */
26
-Future getNewsInfo(String id)async{
27
-  return request('/news/$id',options: Options(method: 'GET'),).catchError((error) =>
28
-  { Fluttertoast.showToast(
29
-      msg: error.error['message']
30
-  ),});
31
-
22
+Future getNewsInfo(String id) async {
23
+  return request(
24
+    '/news/$id',
25
+    options: Options(method: 'GET'),
26
+  ).catchError((error) => {
27
+        Fluttertoast.showToast(msg: error.error['message']),
28
+      });
32 29
 }
33
-
34
-
35
-
36
-

+ 35
- 45
lib/services/orderAPI.dart Voir le fichier

@@ -1,92 +1,82 @@
1
-
2
-
3 1
 import 'package:dio/dio.dart';
4 2
 import 'package:farmer_client/utils/Request.dart';
5 3
 import 'package:fluttertoast/fluttertoast.dart';
6 4
 
7
-
8 5
 /**
9 6
  * 订单列表
10 7
  * @param {*} data
11 8
  * @returns
12 9
  */
13
-Future getOrderList(bool mine)async{
14
-  return request('/order',options: Options(method: 'GET'),queryParameters: { 'mine': mine}).catchError((error) =>
15
-  { Fluttertoast.showToast(
16
-      msg: error.error['message']
17
-  ),});
18
-
10
+Future getOrderList(bool mine) async {
11
+  return request('/order',
12
+          options: Options(method: 'GET'), queryParameters: {'mine': mine})
13
+      .catchError((error) => {
14
+            Fluttertoast.showToast(msg: error.error['message']),
15
+          });
19 16
 }
20 17
 
21
-
22 18
 /**
23 19
  * 订单详情
24 20
  * @param {*} data
25 21
  * @returns
26 22
  */
27
-Future orderInfo(String id)async{
28
-  return request('/order/$id',options: Options(method: 'GET'),).catchError((error) =>
29
-  { Fluttertoast.showToast(
30
-      msg: error.error['message']
31
-  ),});
32
-
23
+Future orderInfo(String id) async {
24
+  return request(
25
+    '/order/$id',
26
+    options: Options(method: 'GET'),
27
+  ).catchError((error) => {
28
+        Fluttertoast.showToast(msg: error.error['message']),
29
+      });
33 30
 }
34 31
 
35
-
36 32
 /**
37 33
  * 生成订单
38 34
  * @param {*} data
39 35
  * @returns
40 36
  */
41 37
 
42
-Future generateOrder(item)async{
43
-  return request('/order',options: Options(method: 'POST'),data: item).catchError((error) =>
44
-  { Fluttertoast.showToast(
45
-      msg: error.error['message']
46
-  ),});
47
-
38
+Future generateOrder(item) async {
39
+  return request('/order', options: Options(method: 'POST'), data: item)
40
+      .catchError((error) => {
41
+            Fluttertoast.showToast(msg: error.error['message']),
42
+          });
48 43
 }
49 44
 
50
-
51
-
52 45
 /**
53 46
  * 删除订单
54 47
  * @param {*} data
55 48
  * @returns
56 49
  */
57
-Future orderDelete(String id)async{
58
-  return request('/order/$id',options: Options(method: 'DELETE')).catchError((error) =>
59
-  { Fluttertoast.showToast(
60
-      msg: error.error['message']
61
-  ),});
50
+Future orderDelete(String id) async {
51
+  return request('/order/$id', options: Options(method: 'DELETE'))
52
+      .catchError((error) => {
53
+            Fluttertoast.showToast(msg: error.error['message']),
54
+          });
62 55
 }
63 56
 
64
-
65 57
 /**
66 58
  * --------------订单退款-----------------
67 59
  * @param {*} data
68 60
  * @returns
69 61
  */
70
-Future orderRefund (String id)async{
71
-  return request('/order/$id/refund',options: Options(method: 'PUT')).catchError((error) =>
72
-  { Fluttertoast.showToast(
73
-      msg: error.error['message']
74
-  ),});
62
+Future orderRefund(String id) async {
63
+  return request('/order/$id/refund', options: Options(method: 'PUT'))
64
+      .catchError((error) => {
65
+            Fluttertoast.showToast(msg: error.error['message']),
66
+          });
75 67
 }
76 68
 
77
-
78
-
79
-
80 69
 /**
81 70
  * 评价订单
82 71
  * @param {*} data
83 72
  * @returns
84 73
  */
85 74
 
86
-Future orderEvaluation (String orderId,num score,String content)async{
87
-  return request('/evaluation',options: Options(method: 'POST'),data: {'orderId':orderId,'score':score,'content':content}).catchError((error) =>
88
-  { Fluttertoast.showToast(
89
-      msg: error.error['message']
90
-  ),});
75
+Future orderEvaluation(String orderId, num score, String content) async {
76
+  return request('/evaluation',
77
+          options: Options(method: 'POST'),
78
+          data: {'orderId': orderId, 'score': score, 'content': content})
79
+      .catchError((error) => {
80
+            Fluttertoast.showToast(msg: error.error['message']),
81
+          });
91 82
 }
92
-

+ 17
- 23
lib/services/user.dart Voir le fichier

@@ -1,46 +1,40 @@
1
-
2
-
3 1
 import 'package:dio/dio.dart';
4 2
 import 'package:farmer_client/utils/Request.dart';
5 3
 import 'package:fluttertoast/fluttertoast.dart';
6 4
 
7
-
8 5
 Future getSMSCaptch(String phone) async {
9
-  return request('/sms-captcha', options: Options(method: 'POST'), queryParameters: { 'phone': phone }).then((value) {
10
-    Fluttertoast.showToast(
11
-        msg: '验证码发送成功!'
12
-    );
6
+  return request('/sms-captcha',
7
+      options: Options(method: 'POST'),
8
+      queryParameters: {'phone': phone}).then((value) {
9
+    Fluttertoast.showToast(msg: '验证码发送成功!');
13 10
   }).catchError((error) {
14
-
15
-    Fluttertoast.showToast(
16
-      msg: error.error['message']
17
-    );
11
+    Fluttertoast.showToast(msg: error.error['message']);
18 12
   });
19 13
 }
20 14
 
21 15
 //登陆
22
-Future userLogin(String userName,String password) async {
23
-  return request('/login', options: Options(method: 'POST'),
24
-    data: { 'userName': userName, 'password': password},).catchError((error) =>
25
-  { Fluttertoast.showToast(
26
-      msg: error.error['message']
27
-  ),});
16
+Future userLogin(String userName, String password) async {
17
+  return request(
18
+    '/login',
19
+    options: Options(method: 'POST'),
20
+    data: {'userName': userName, 'password': password},
21
+  ).catchError((error) => {
22
+        Fluttertoast.showToast(msg: error.error['message']),
23
+      });
28 24
 }
29 25
 
30 26
 Future getCurrent() async {
31 27
   return request('/person/current');
32 28
 }
33 29
 
34
-
35
-
36 30
 /**
37 31
  * 修改个人信息
38 32
  * @param {*}
39 33
  * @returns
40 34
  */
41 35
 Future updateInfo(String id, userdata) async {
42
-  return request('/person/$id', options: Options(method: 'PUT'),data: userdata).catchError((error) =>
43
-  { Fluttertoast.showToast(
44
-      msg: error.error['message']
45
-  ),});
36
+  return request('/person/$id', options: Options(method: 'PUT'), data: userdata)
37
+      .catchError((error) => {
38
+            Fluttertoast.showToast(msg: error.error['message']),
39
+          });
46 40
 }

+ 4
- 6
lib/theme.dart Voir le fichier

@@ -1,4 +1,3 @@
1
-
2 1
 import 'package:flutter/material.dart';
3 2
 import 'package:flutter_screenutil/flutter_screenutil.dart';
4 3
 
@@ -11,11 +10,10 @@ ThemeData getTheme() {
11 10
       elevation: 0,
12 11
       toolbarHeight: 44.w,
13 12
       titleTextStyle: TextStyle(
14
-        color: const Color(0xFF333333),
15
-        fontWeight: FontWeight.bold,
16
-        fontSize: 17.sp,
17
-        letterSpacing: 2
18
-      ),
13
+          color: const Color(0xFF333333),
14
+          fontWeight: FontWeight.bold,
15
+          fontSize: 17.sp,
16
+          letterSpacing: 2),
19 17
     ),
20 18
     backgroundColor: Colors.white,
21 19
   );

+ 2
- 3
lib/utils/amap/const_config.dart Voir le fichier

@@ -7,8 +7,7 @@ class ConstConfig {
7 7
   ///注意:使用[AMapWidget]的`apiKey`属性设置的key的优先级高于通过Native配置key的优先级,
8 8
   ///使用[AMapWidget]的`apiKey`属性配置后Native配置的key将失效,请根据实际情况选择使用
9 9
   static const AMapApiKey amapApiKeys = AMapApiKey(
10
-      androidKey: 'b481b4187e24e625fa0056fd0530e663',
11
-      iosKey: '您申请的iOS平台的key');
10
+      androidKey: 'b481b4187e24e625fa0056fd0530e663', iosKey: '您申请的iOS平台的key');
12 11
 
13 12
   ///高德隐私合规声明,这里只是示例,实际使用中请按照实际参数设置[AMapPrivacyStatement]的'hasContains''hasShow''hasAgree'这三个参数
14 13
   ///
@@ -18,5 +17,5 @@ class ConstConfig {
18 17
   ///
19 18
   /// 高德SDK合规使用方案请参考:https://lbs.amap.com/news/sdkhgsy
20 19
   static const AMapPrivacyStatement amapPrivacyStatement =
21
-  AMapPrivacyStatement(hasContains: true, hasShow: true, hasAgree: true);
20
+      AMapPrivacyStatement(hasContains: true, hasShow: true, hasAgree: true);
22 21
 }

+ 0
- 4
lib/utils/dialog.dart Voir le fichier

@@ -1,5 +1,3 @@
1
-
2
-
3 1
 import 'package:flutter/widgets.dart';
4 2
 
5 3
 class CommonPopup extends StatelessWidget {
@@ -12,6 +10,4 @@ class CommonPopup extends StatelessWidget {
12 10
     // TODO: implement build
13 11
     throw UnimplementedError();
14 12
   }
15
-
16 13
 }
17
-

+ 4
- 4
lib/utils/location.dart Voir le fichier

@@ -6,7 +6,7 @@ import 'package:permission_handler/permission_handler.dart';
6 6
 
7 7
 import 'amap/const_config.dart';
8 8
 
9
-typedef AMAPListener = void Function (Map<String, Object>);
9
+typedef AMAPListener = void Function(Map<String, Object>);
10 10
 
11 11
 void showPrivacy() {
12 12
   /// 设置是否已经包含高德隐私政策并弹窗展示显示用户查看,如果未包含或者没有弹窗展示,高德定位SDK将不会工作
@@ -44,7 +44,8 @@ Future _requirePermission() async {
44 44
 }
45 45
 
46 46
 Future requireLocation(AMAPListener listener) async {
47
-  AMapFlutterLocation.setApiKey(ConstConfig.amapApiKeys.androidKey!, ConstConfig.amapApiKeys.iosKey!);
47
+  AMapFlutterLocation.setApiKey(
48
+      ConstConfig.amapApiKeys.androidKey!, ConstConfig.amapApiKeys.iosKey!);
48 49
   showPrivacy();
49 50
   await _requirePermission();
50 51
   final AMapFlutterLocation location = AMapFlutterLocation();
@@ -100,7 +101,6 @@ _getAMapLocationOption() {
100 101
   return locationOption;
101 102
 }
102 103
 
103
-
104 104
 // import 'dart:io';
105 105
 //
106 106
 // import 'package:flutter_baidu_mapapi_base/flutter_baidu_mapapi_base.dart'
@@ -131,4 +131,4 @@ _getAMapLocationOption() {
131 131
 //   }
132 132
 //
133 133
 //   return location;
134
-// }
134
+// }

+ 2
- 3
lib/utils/timer.dart Voir le fichier

@@ -1,12 +1,11 @@
1
-
2 1
 import 'dart:async';
3 2
 
4
-Timer setInterval(void Function (Timer) f, int milliseconds) {
3
+Timer setInterval(void Function(Timer) f, int milliseconds) {
5 4
   var duration = Duration(milliseconds: milliseconds);
6 5
   return Timer.periodic(duration, f);
7 6
 }
8 7
 
9
-void setTimeout(void Function () f, int milliseconds) {
8
+void setTimeout(void Function() f, int milliseconds) {
10 9
   var duration = Duration(milliseconds: milliseconds);
11 10
   Timer? t = null;
12 11
   t = Timer(duration, () {

+ 19
- 16
lib/widgets/CarsCard.dart Voir le fichier

@@ -20,15 +20,15 @@ class CarsCard extends StatefulWidget {
20 20
   _CarsCardPage createState() => _CarsCardPage();
21 21
 }
22 22
 
23
-
24 23
 class _CarsCardPage extends State<CarsCard> {
25 24
   // final CardListModel item;
26 25
   // _CarsCardPage(this.item);
27
-  setMorKm () {
26
+  setMorKm() {
28 27
     String n = '';
29
-    if (widget.item.distance !=null) {
30
-      if ((widget.item.distance??0) >= 1000) {
31
-        n = ((widget.item.distance??0) / 1000).toStringAsFixed(2).toString() + '公里';
28
+    if (widget.item.distance != null) {
29
+      if ((widget.item.distance ?? 0) >= 1000) {
30
+        n = ((widget.item.distance ?? 0) / 1000).toStringAsFixed(2).toString() +
31
+            '公里';
32 32
       } else {
33 33
         n = widget.item.distance.toString() + '米';
34 34
       }
@@ -36,7 +36,7 @@ class _CarsCardPage extends State<CarsCard> {
36 36
       n = '0m';
37 37
     }
38 38
     return n;
39
-}
39
+  }
40 40
 
41 41
   @override
42 42
   Widget build(BuildContext context) {
@@ -53,7 +53,10 @@ class _CarsCardPage extends State<CarsCard> {
53 53
         children: [
54 54
           GestureDetector(
55 55
             onTap: () {
56
-              Get.to(MachineryDetailPage(),arguments: {'id':widget.item.machineryId,'km':setMorKm().toString()});
56
+              Get.to(MachineryDetailPage(), arguments: {
57
+                'id': widget.item.machineryId,
58
+                'km': setMorKm().toString()
59
+              });
57 60
             },
58 61
             child: Image.network(
59 62
               widget.item.thumb.toString(),
@@ -130,7 +133,7 @@ class _CarsCardPage extends State<CarsCard> {
130 133
                     child: ElevatedButton(
131 134
                       onPressed: () {
132 135
                         Get.toNamed('/orderConfirmation',
133
-                            arguments: {'id':widget.item.machineryId});
136
+                            arguments: {'id': widget.item.machineryId});
134 137
                       },
135 138
                       child: const Text(
136 139
                         "预约",
@@ -177,18 +180,18 @@ class _CarsCardPage extends State<CarsCard> {
177 180
                                 Text(
178 181
                                   '距离当前位置',
179 182
                                   style: TextStyle(
180
-                                      fontSize: 15, fontWeight: FontWeight.bold),
183
+                                      fontSize: 15,
184
+                                      fontWeight: FontWeight.bold),
181 185
                                 ),
182 186
                                 Text(
183 187
                                   setMorKm().toString(),
184 188
                                   style: TextStyle(
185
-                                      fontSize: 15, fontWeight: FontWeight.bold),
189
+                                      fontSize: 15,
190
+                                      fontWeight: FontWeight.bold),
186 191
                                 ),
187
-
188 192
                               ],
189 193
                             ),
190 194
                           ),
191
-
192 195
                           GestureDetector(
193 196
                             child: Text(
194 197
                               '进入地图 >>',
@@ -197,8 +200,10 @@ class _CarsCardPage extends State<CarsCard> {
197 200
                             ),
198 201
                             onTap: () {
199 202
                               print('进入地图');
200
-                              Get.toNamed('/machineryMap',
201
-                                  arguments: {'id':widget.item.machineryId,'km':setMorKm().toString()});
203
+                              Get.toNamed('/machineryMap', arguments: {
204
+                                'id': widget.item.machineryId,
205
+                                'km': setMorKm().toString()
206
+                              });
202 207
                             },
203 208
                           )
204 209
                         ],
@@ -210,5 +215,3 @@ class _CarsCardPage extends State<CarsCard> {
210 215
     );
211 216
   }
212 217
 }
213
-
214
-

+ 20
- 22
lib/widgets/Cell.dart Voir le fichier

@@ -1,10 +1,9 @@
1
-
2 1
 import 'package:flutter/cupertino.dart';
3 2
 import 'package:flutter/widgets.dart';
4 3
 import 'package:flutter_screenutil/flutter_screenutil.dart';
5 4
 
6 5
 class Cell extends StatelessWidget {
7
-  const Cell ({
6
+  const Cell({
8 7
     Key? key,
9 8
     this.header,
10 9
     required this.child,
@@ -19,36 +18,35 @@ class Cell extends StatelessWidget {
19 18
 
20 19
   @override
21 20
   Widget build(BuildContext context) {
22
-
23 21
     return Container(
24 22
       margin: margin,
25 23
       padding: EdgeInsets.symmetric(vertical: 10.h, horizontal: 0.0),
26 24
       decoration: const BoxDecoration(
27
-        border: Border(
28
-          bottom: BorderSide(width: 1.0, color: Color(0x1F000000)),
29
-        )
30
-      ),
25
+          border: Border(
26
+        bottom: BorderSide(width: 1.0, color: Color(0x1F000000)),
27
+      )),
31 28
       child: Row(
32 29
         children: [
33
-          if (null != header) SizedBox(
34
-            width: 53.w,
35
-            child: Container(
36
-              decoration: const BoxDecoration(
37
-                border: Border(
38
-                  right: BorderSide(width: 1, color: Color(0xFF333333))
39
-                )
30
+          if (null != header)
31
+            SizedBox(
32
+              width: 53.w,
33
+              child: Container(
34
+                decoration: const BoxDecoration(
35
+                    border: Border(
36
+                        right: BorderSide(width: 1, color: Color(0xFF333333)))),
37
+                child: header,
40 38
               ),
41
-              child: header,
42 39
             ),
40
+          Expanded(
41
+            child: child,
43 42
           ),
44
-          Expanded(child: child,),
45
-          if (null != footer) ConstrainedBox (
46
-            constraints: BoxConstraints(maxWidth: 100.w),
47
-            child: footer,
48
-          )
43
+          if (null != footer)
44
+            ConstrainedBox(
45
+              constraints: BoxConstraints(maxWidth: 100.w),
46
+              child: footer,
47
+            )
49 48
         ],
50 49
       ),
51 50
     );
52 51
   }
53
-  
54
-}
52
+}

+ 14
- 22
lib/widgets/DefaultButton.dart Voir le fichier

@@ -1,7 +1,5 @@
1 1
 import 'package:flutter/material.dart';
2 2
 
3
-
4
-
5 3
 class DefaultButton extends StatefulWidget {
6 4
   //点击回调
7 5
   final GestureTapCallback onPressed;
@@ -15,7 +13,7 @@ class DefaultButton extends StatefulWidget {
15 13
   final double? radius;
16 14
 
17 15
   EdgeInsetsGeometry marginDefault =
18
-  const EdgeInsets.fromLTRB(0, 90.0, 0, 30); //按钮默认的margin值
16
+      const EdgeInsets.fromLTRB(0, 90.0, 0, 30); //按钮默认的margin值
19 17
 
20 18
   DefaultButton({
21 19
     Key? key,
@@ -33,9 +31,11 @@ class DefaultButton extends StatefulWidget {
33 31
   @override
34 32
   State createState() {
35 33
     if (margin == null) {
36
-      return _DefaultButtonState(onPressed, text, marginDefault,width,height,fontSize,backColor,color,radius);
34
+      return _DefaultButtonState(onPressed, text, marginDefault, width, height,
35
+          fontSize, backColor, color, radius);
37 36
     }
38
-    return _DefaultButtonState(onPressed, text, margin,width,height,fontSize,backColor,color,radius);
37
+    return _DefaultButtonState(onPressed, text, margin, width, height, fontSize,
38
+        backColor, color, radius);
39 39
   }
40 40
 }
41 41
 
@@ -50,17 +50,8 @@ class _DefaultButtonState extends State<DefaultButton> {
50 50
   final Color backColor;
51 51
   final Color color;
52 52
   final double? radius;
53
-  _DefaultButtonState(
54
-      this.onPressed,
55
-      this.text,
56
-      this.margin,
57
-      this.width,
58
-      this.height,
59
-      this.fontSize,
60
-      this.backColor,
61
-      this.color,
62
-      this.radius
63
-      );
53
+  _DefaultButtonState(this.onPressed, this.text, this.margin, this.width,
54
+      this.height, this.fontSize, this.backColor, this.color, this.radius);
64 55
 
65 56
   @override
66 57
   Widget build(BuildContext context) {
@@ -74,13 +65,16 @@ class _DefaultButtonState extends State<DefaultButton> {
74 65
           disabledColor: const Color(0xF5F6F7ff),
75 66
           disabledTextColor: const Color(0xF5F6F7ff),
76 67
           colorBrightness: Brightness.dark,
77
-          shape:
78
-          RoundedRectangleBorder(borderRadius: BorderRadius.circular(radius??5)),
79
-          child: Text(text,style:  TextStyle(
68
+          shape: RoundedRectangleBorder(
69
+              borderRadius: BorderRadius.circular(radius ?? 5)),
70
+          child: Text(
71
+            text,
72
+            style: TextStyle(
80 73
               fontSize: fontSize,
81 74
               fontWeight: FontWeight.bold,
82 75
               color: color,
83
-          ),),
76
+            ),
77
+          ),
84 78
           textColor: Colors.white,
85 79
           onPressed: onPressed,
86 80
         ),
@@ -89,6 +83,4 @@ class _DefaultButtonState extends State<DefaultButton> {
89 83
 
90 84
     return _SectionBtn;
91 85
   }
92
-
93 86
 }
94
-

+ 8
- 12
lib/widgets/ExtendContentList.dart Voir le fichier

@@ -1,4 +1,3 @@
1
-
2 1
 import 'package:flutter/widgets.dart';
3 2
 import 'package:flutter_screenutil/flutter_screenutil.dart';
4 3
 import 'package:get/get_rx/src/rx_types/rx_types.dart';
@@ -10,8 +9,8 @@ import '../models/entities/ExtendContent.dart';
10 9
 class ExtendContentList extends StatelessWidget {
11 10
   final List<ContentImageList> item;
12 11
 
13
-  const ExtendContentList({ Key? key, required this.item }) : super(key: key);
14
-  
12
+  const ExtendContentList({Key? key, required this.item}) : super(key: key);
13
+
15 14
   Widget? _image(String? content) {
16 15
     if (null == content || content.isEmpty) return null;
17 16
     return Image.network(content, fit: BoxFit.cover);
@@ -39,15 +38,14 @@ class ExtendContentList extends StatelessWidget {
39 38
     //   ));
40 39
     // }
41 40
 
42
-    return  Container(
43
-      child:  Column(
44
-        children:  item.map((item) {
41
+    return Container(
42
+      child: Column(
43
+        children: item.map((item) {
45 44
           if (item.contentType != 'image') {
46 45
             return Container(
47
-              padding: EdgeInsets.fromLTRB(0, 20, 0, 10),
48
-              width: 344.w,
49
-              child: _text(item.content)
50
-            );
46
+                padding: EdgeInsets.fromLTRB(0, 20, 0, 10),
47
+                width: 344.w,
48
+                child: _text(item.content));
51 49
           } else {
52 50
             return Container(
53 51
               padding: EdgeInsets.fromLTRB(0, 10, 0, 10),
@@ -57,7 +55,5 @@ class ExtendContentList extends StatelessWidget {
57 55
         }).toList(),
58 56
       ),
59 57
     );
60
-
61 58
   }
62
-
63 59
 }

+ 7
- 4
lib/widgets/GradientButton.dart Voir le fichier

@@ -1,5 +1,3 @@
1
-
2
-
3 1
 import 'package:flutter/material.dart';
4 2
 import 'package:flutter/widgets.dart';
5 3
 
@@ -47,7 +45,12 @@ class GradientButton extends StatelessWidget {
47 45
 
48 46
     return DecoratedBox(
49 47
       decoration: BoxDecoration(
50
-        gradient: disabled ? null : LinearGradient(begin: linearStart??Alignment.topCenter, end: linearEnd??Alignment.bottomCenter, colors: _colors),
48
+        gradient: disabled
49
+            ? null
50
+            : LinearGradient(
51
+                begin: linearStart ?? Alignment.topCenter,
52
+                end: linearEnd ?? Alignment.bottomCenter,
53
+                colors: _colors),
51 54
         color: disabled ? disabledColor ?? theme.disabledColor : null,
52 55
         borderRadius: radius,
53 56
       ),
@@ -85,4 +88,4 @@ class GradientButton extends StatelessWidget {
85 88
       ),
86 89
     );
87 90
   }
88
-}
91
+}

+ 0
- 1
lib/widgets/LinearGradientText.dart Voir le fichier

@@ -1,4 +1,3 @@
1
-
2 1
 import 'package:flutter/widgets.dart';
3 2
 
4 3
 class LinearGradientText extends StatelessWidget {

+ 3
- 4
lib/widgets/LoadMore.dart Voir le fichier

@@ -1,4 +1,3 @@
1
-
2 1
 import 'package:flutter/widgets.dart';
3 2
 
4 3
 import 'package:farmer_client/models/entities/PagedResult.dart';
@@ -9,7 +8,7 @@ class LoadMore extends StatefulWidget {
9 8
     required this.builder,
10 9
     required this.fetch,
11 10
     this.onError,
12
-  }): super(key: key);
11
+  }) : super(key: key);
13 12
 
14 13
   Future Function(Map param) fetch;
15 14
   Function? onError;
@@ -22,7 +21,7 @@ class LoadMore extends StatefulWidget {
22 21
   }) builder;
23 22
 
24 23
   @override
25
-  State<StatefulWidget> createState () => _LoadMoreState();
24
+  State<StatefulWidget> createState() => _LoadMoreState();
26 25
 }
27 26
 
28 27
 class _LoadMoreState extends State<LoadMore> {
@@ -54,7 +53,7 @@ class _LoadMoreState extends State<LoadMore> {
54 53
   Future fetchData() {
55 54
     final pageNum = result.current + 1;
56 55
     final pageSize = result.size == 0 ? 10 : result.size;
57
-    Map params = { "pageNum": pageNum, "pageSize": pageSize };
56
+    Map params = {"pageNum": pageNum, "pageSize": pageSize};
58 57
     return Future.value(widget.fetch(params).then((res) {
59 58
       setState(() {
60 59
         result = PagedResult.fromJson(res);

+ 58
- 44
lib/widgets/Modal.dart Voir le fichier

@@ -1,4 +1,3 @@
1
-
2 1
 import 'package:flutter/cupertino.dart';
3 2
 import 'package:flutter/material.dart';
4 3
 import 'package:flutter/widgets.dart';
@@ -28,30 +27,35 @@ void _handleFunc(ModalFunc? func) {
28 27
 }
29 28
 
30 29
 /// 打开一个 dialog
31
-void showDialog({ required String title, String? message, Widget? content, ModalFunc? onConfirm, ModalFunc? onCancel }) {
32
-  Get.dialog(
33
-    Modal(
34
-      type: 'dialog',
35
-      title: title,
36
-      message: message,
37
-      content: content,
38
-      onConfirm: () => _handleFunc(onConfirm),
39
-      onCancel: () => _handleFunc(onCancel),
40
-    )
41
-  );
30
+void showDialog(
31
+    {required String title,
32
+    String? message,
33
+    Widget? content,
34
+    ModalFunc? onConfirm,
35
+    ModalFunc? onCancel}) {
36
+  Get.dialog(Modal(
37
+    type: 'dialog',
38
+    title: title,
39
+    message: message,
40
+    content: content,
41
+    onConfirm: () => _handleFunc(onConfirm),
42
+    onCancel: () => _handleFunc(onCancel),
43
+  ));
42 44
 }
43 45
 
44 46
 /// 打开一个 alert
45
-void showAlert({ required String title, String? message, Widget? content, ModalFunc? onConfirm }) {
46
-  Get.dialog(
47
-      Modal(
48
-        type: 'alert',
49
-        title: title,
50
-        message: message,
51
-        content: content,
52
-        onConfirm: () => _handleFunc(onConfirm),
53
-      )
54
-  );
47
+void showAlert(
48
+    {required String title,
49
+    String? message,
50
+    Widget? content,
51
+    ModalFunc? onConfirm}) {
52
+  Get.dialog(Modal(
53
+    type: 'alert',
54
+    title: title,
55
+    message: message,
56
+    content: content,
57
+    onConfirm: () => _handleFunc(onConfirm),
58
+  ));
55 59
 }
56 60
 
57 61
 void _closeModal() {
@@ -60,7 +64,6 @@ void _closeModal() {
60 64
 }
61 65
 
62 66
 class Modal extends StatelessWidget {
63
-
64 67
   String title;
65 68
   String type;
66 69
   String? message;
@@ -68,8 +71,12 @@ class Modal extends StatelessWidget {
68 71
   VoidCallback? onConfirm;
69 72
   VoidCallback? onCancel;
70 73
 
71
-  final _titleStyle = TextStyle(color: const Color(0xFF222222), fontSize: 20.sp, fontWeight: FontWeight.bold);
72
-  final _messageStyle = TextStyle(color: const Color(0xFF666666), fontSize: 18.sp);
74
+  final _titleStyle = TextStyle(
75
+      color: const Color(0xFF222222),
76
+      fontSize: 20.sp,
77
+      fontWeight: FontWeight.bold);
78
+  final _messageStyle =
79
+      TextStyle(color: const Color(0xFF666666), fontSize: 18.sp);
73 80
   final _primaryColor = const Color(0xFFFF703B);
74 81
   final _btnSize = Size(90.w, 36.w);
75 82
   final _btnShape = RoundedRectangleBorder(
@@ -82,29 +89,33 @@ class Modal extends StatelessWidget {
82 89
       onConfirm!();
83 90
     }
84 91
   }
92
+
85 93
   void _handleCancel() {
86 94
     if (null != onCancel) {
87 95
       onCancel!();
88 96
     }
89 97
   }
90 98
 
91
-  Modal({Key? key,
99
+  Modal({
100
+    Key? key,
92 101
     this.type = 'alert',
93 102
     required this.title,
94 103
     this.message,
95 104
     this.content,
96 105
     this.onConfirm,
97 106
     this.onCancel,
98
-  }): super(key: key);
107
+  }) : super(key: key);
99 108
 
100 109
   Widget _confirmBtn() {
101 110
     return ElevatedButton(
102
-      child: Text("确定", style: TextStyle(color: Colors.white, fontSize: 18.sp, letterSpacing: 5.sp)),
111
+      child: Text("确定",
112
+          style: TextStyle(
113
+              color: Colors.white, fontSize: 18.sp, letterSpacing: 5.sp)),
103 114
       style: ElevatedButton.styleFrom(
104
-          primary: _primaryColor,
105
-          elevation: 0,
106
-          minimumSize: _btnSize,
107
-          shape: _btnShape,
115
+        primary: _primaryColor,
116
+        elevation: 0,
117
+        minimumSize: _btnSize,
118
+        shape: _btnShape,
108 119
       ),
109 120
       onPressed: _handleConfirm,
110 121
     );
@@ -112,7 +123,9 @@ class Modal extends StatelessWidget {
112 123
 
113 124
   Widget _cancelBtn() {
114 125
     return ElevatedButton(
115
-      child: Text("取消", style: TextStyle(color: _primaryColor, fontSize: 18.sp, letterSpacing: 5.sp)),
126
+      child: Text("取消",
127
+          style: TextStyle(
128
+              color: _primaryColor, fontSize: 18.sp, letterSpacing: 5.sp)),
116 129
       style: ElevatedButton.styleFrom(
117 130
         primary: Colors.white,
118 131
         elevation: 0,
@@ -125,31 +138,34 @@ class Modal extends StatelessWidget {
125 138
 
126 139
   Widget _alert() {
127 140
     return SimpleDialog(
128
-      shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(24.w)),
129
-      titleTextStyle: _titleStyle,
130
-      title: Text(title, textAlign: TextAlign.center),
141
+        shape:
142
+            RoundedRectangleBorder(borderRadius: BorderRadius.circular(24.w)),
143
+        titleTextStyle: _titleStyle,
144
+        title: Text(title, textAlign: TextAlign.center),
131 145
         children: [
132
-          if (null != message) Text(message!, textAlign: TextAlign.center, style: _messageStyle),
146
+          if (null != message)
147
+            Text(message!, textAlign: TextAlign.center, style: _messageStyle),
133 148
           if (null != content) content!,
134 149
           SizedBox(height: 16.w),
135 150
           Center(
136 151
             child: _confirmBtn(),
137 152
           ),
138 153
           SizedBox(height: 10.w),
139
-        ]
140
-    );
154
+        ]);
141 155
   }
142 156
 
143 157
   Widget _dialog() {
144 158
     Widget hSpacer = SizedBox(width: 16.w);
145 159
 
146 160
     return SimpleDialog(
147
-        shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(24.w)),
161
+        shape:
162
+            RoundedRectangleBorder(borderRadius: BorderRadius.circular(24.w)),
148 163
         titleTextStyle: _titleStyle,
149 164
         title: Text(title, textAlign: TextAlign.center),
150 165
         alignment: Alignment.center,
151 166
         children: [
152
-          if (null != message) Text(message!, textAlign: TextAlign.center, style: _messageStyle),
167
+          if (null != message)
168
+            Text(message!, textAlign: TextAlign.center, style: _messageStyle),
153 169
           if (null != content) content!,
154 170
           SizedBox(height: 16.w),
155 171
           Row(
@@ -167,13 +183,11 @@ class Modal extends StatelessWidget {
167 183
             ],
168 184
           ),
169 185
           SizedBox(height: 10.w),
170
-        ]
171
-    );
186
+        ]);
172 187
   }
173 188
 
174 189
   @override
175 190
   Widget build(BuildContext context) {
176 191
     return type == 'alert' ? _alert() : _dialog();
177 192
   }
178
-
179 193
 }

+ 2
- 5
lib/widgets/NullCard.dart Voir le fichier

@@ -21,13 +21,10 @@ class NullCard extends StatelessWidget {
21 21
           ),
22 22
           Text(
23 23
             text,
24
-            style: TextStyle(
25
-                fontSize: 17.sp, color: Color(0xFFb4b4b4)),
24
+            style: TextStyle(fontSize: 17.sp, color: Color(0xFFb4b4b4)),
26 25
           )
27 26
         ],
28 27
       ),
29 28
     );
30 29
   }
31
-
32
-
33
-}
30
+}

+ 209
- 198
lib/widgets/OrderInfoCard.dart Voir le fichier

@@ -12,222 +12,233 @@ class OrderInfoCard extends StatelessWidget {
12 12
   final String? orderStateText;
13 13
   final Color? orderStateColor;
14 14
 
15
- // final  DateTime timeNew=item.appointmentDate;
16
-
17
-  const OrderInfoCard({Key? key, required this.item, required this.orderStateColor, required this.orderStateText}) : super(key: key);
18
-
15
+  // final  DateTime timeNew=item.appointmentDate;
19 16
 
17
+  const OrderInfoCard(
18
+      {Key? key,
19
+      required this.item,
20
+      required this.orderStateColor,
21
+      required this.orderStateText})
22
+      : super(key: key);
20 23
 
21 24
   @override
22 25
   Widget build(BuildContext context) {
23 26
     return Container(
24
-        width: 345.w,
25
-        height: 484.5.h,
26
-        margin: EdgeInsets.fromLTRB(15.w, 17.w, 15.w, 0),
27
-        decoration: BoxDecoration(
28
-          color: Colors.white,
29
-          //设置四周圆角 角度
30
-          borderRadius: BorderRadius.all(Radius.circular(2.0)),
31
-          //设置四周边框
32
-          boxShadow: [
33
-            BoxShadow(
34
-              blurRadius: 10, //阴影范围
35
-              spreadRadius: 0.1, //阴影浓度
36
-              color: Colors.grey.withOpacity(0.2), //阴影颜色
37
-            ),
38
-          ],
39
-        ),
40
-        child: Column(
41
-          crossAxisAlignment: CrossAxisAlignment.start,
42
-          children: [
43
-            Container(
44
-                margin: EdgeInsets.fromLTRB(15.w, 0, 0, 0),
45
-                child: Column(
46
-                  crossAxisAlignment: CrossAxisAlignment.start,
47
-                  children: [
48
-                    Container(
49
-                      padding: EdgeInsets.fromLTRB(0, 15, 0, 20),
50
-                      width: 314.w,
51
-                      decoration: const BoxDecoration(
52
-                          border: Border(
53
-                              bottom: BorderSide(
54
-                                  width: 0.5, color: Color(0x20000000)
55
-                                  // 0x17000000
56
-                                  ))),
57
-                      child: RichText(
58
-                        text:  TextSpan(children: <InlineSpan>[
59
-                          TextSpan(
60
-                              text: '订单编号:',
61
-                              style: TextStyle(
62
-                                  color: Color(0xff666666),
63
-                                  fontSize: 16,
64
-                                  fontWeight: FontWeight.bold)),
65
-                          TextSpan(
66
-                              text: item.orderNo.toString(),
67
-                              style: TextStyle(
68
-                                  color: Color(0xff222222),
69
-                                  fontSize: 16,
70
-                                  fontWeight: FontWeight.bold)),
71
-                        ]),
72
-                      ),
27
+      width: 345.w,
28
+      height: 484.5.h,
29
+      margin: EdgeInsets.fromLTRB(15.w, 17.w, 15.w, 0),
30
+      decoration: BoxDecoration(
31
+        color: Colors.white,
32
+        //设置四周圆角 角度
33
+        borderRadius: BorderRadius.all(Radius.circular(2.0)),
34
+        //设置四周边框
35
+        boxShadow: [
36
+          BoxShadow(
37
+            blurRadius: 10, //阴影范围
38
+            spreadRadius: 0.1, //阴影浓度
39
+            color: Colors.grey.withOpacity(0.2), //阴影颜色
40
+          ),
41
+        ],
42
+      ),
43
+      child: Column(
44
+        crossAxisAlignment: CrossAxisAlignment.start,
45
+        children: [
46
+          Container(
47
+              margin: EdgeInsets.fromLTRB(15.w, 0, 0, 0),
48
+              child: Column(
49
+                crossAxisAlignment: CrossAxisAlignment.start,
50
+                children: [
51
+                  Container(
52
+                    padding: EdgeInsets.fromLTRB(0, 15, 0, 20),
53
+                    width: 314.w,
54
+                    decoration: const BoxDecoration(
55
+                        border: Border(
56
+                            bottom:
57
+                                BorderSide(width: 0.5, color: Color(0x20000000)
58
+                                    // 0x17000000
59
+                                    ))),
60
+                    child: RichText(
61
+                      text: TextSpan(children: <InlineSpan>[
62
+                        TextSpan(
63
+                            text: '订单编号:',
64
+                            style: TextStyle(
65
+                                color: Color(0xff666666),
66
+                                fontSize: 16,
67
+                                fontWeight: FontWeight.bold)),
68
+                        TextSpan(
69
+                            text: item.orderNo.toString(),
70
+                            style: TextStyle(
71
+                                color: Color(0xff222222),
72
+                                fontSize: 16,
73
+                                fontWeight: FontWeight.bold)),
74
+                      ]),
73 75
                     ),
74
-                    Padding(
75
-                      padding: EdgeInsets.fromLTRB(0, 20, 0, 15),
76
-                      child: RichText(
77
-                        text:  TextSpan(children: <InlineSpan>[
78
-                          TextSpan(
79
-                              text: '农机名称:',
80
-                              style: TextStyle(
81
-                                  color: Color(0xff666666),
82
-                                  fontSize: 16,
83
-                                  fontWeight: FontWeight.bold)),
84
-                          TextSpan(
85
-                              text: item.machineryName.toString(),
86
-                              style: TextStyle(
87
-                                  color: Color(0xff222222),
88
-                                  fontSize: 16,
89
-                                  fontWeight: FontWeight.bold)),
90
-                        ]),
91
-                      ),
76
+                  ),
77
+                  Padding(
78
+                    padding: EdgeInsets.fromLTRB(0, 20, 0, 15),
79
+                    child: RichText(
80
+                      text: TextSpan(children: <InlineSpan>[
81
+                        TextSpan(
82
+                            text: '农机名称:',
83
+                            style: TextStyle(
84
+                                color: Color(0xff666666),
85
+                                fontSize: 16,
86
+                                fontWeight: FontWeight.bold)),
87
+                        TextSpan(
88
+                            text: item.machineryName.toString(),
89
+                            style: TextStyle(
90
+                                color: Color(0xff222222),
91
+                                fontSize: 16,
92
+                                fontWeight: FontWeight.bold)),
93
+                      ]),
92 94
                     ),
93
-                    Padding(
94
-                      padding: EdgeInsets.fromLTRB(0, 0, 0, 15),
95
-                      child: RichText(
96
-                        text:  TextSpan(children: <InlineSpan>[
97
-                          TextSpan(
98
-                              text: '作业面积:',
99
-                              style: TextStyle(
100
-                                  color: Color(0xff666666),
101
-                                  fontSize: 16,
102
-                                  fontWeight: FontWeight.bold)),
103
-                          TextSpan(
104
-                              text: item.amount.toString(),
105
-                              style: TextStyle(
106
-                                  color: Color(0xff222222),
107
-                                  fontSize: 16,
108
-                                  fontWeight: FontWeight.bold)),
109
-                        ]),
110
-                      ),
95
+                  ),
96
+                  Padding(
97
+                    padding: EdgeInsets.fromLTRB(0, 0, 0, 15),
98
+                    child: RichText(
99
+                      text: TextSpan(children: <InlineSpan>[
100
+                        TextSpan(
101
+                            text: '作业面积:',
102
+                            style: TextStyle(
103
+                                color: Color(0xff666666),
104
+                                fontSize: 16,
105
+                                fontWeight: FontWeight.bold)),
106
+                        TextSpan(
107
+                            text: item.amount.toString(),
108
+                            style: TextStyle(
109
+                                color: Color(0xff222222),
110
+                                fontSize: 16,
111
+                                fontWeight: FontWeight.bold)),
112
+                      ]),
111 113
                     ),
112
-                    Padding(
113
-                      padding: EdgeInsets.fromLTRB(0, 0, 0, 15),
114
-                      child: RichText(
115
-                        text:  TextSpan(children: <InlineSpan>[
116
-                          TextSpan(
117
-                              text: '需求时间:',
118
-                              style: TextStyle(
119
-                                  color: Color(0xff666666),
120
-                                  fontSize: 16,
121
-                                  fontWeight: FontWeight.bold)),
122
-                          TextSpan(
123
-                          // '${DateFormat("yyyy-MM-dd").format(item.appointmentDate.toString())}'
124
-                              text:item.appointmentDate!=null? DateFormat("yyyy-MM-dd").format(DateTime.parse(item.appointmentDate.toString())):item.appointmentDate.toString(),
125
-                              style: TextStyle(
126
-                                  color: Color(0xff222222),
127
-                                  fontSize: 16,
128
-                                  fontWeight: FontWeight.bold)),
129
-                        ]),
130
-                      ),
114
+                  ),
115
+                  Padding(
116
+                    padding: EdgeInsets.fromLTRB(0, 0, 0, 15),
117
+                    child: RichText(
118
+                      text: TextSpan(children: <InlineSpan>[
119
+                        TextSpan(
120
+                            text: '需求时间:',
121
+                            style: TextStyle(
122
+                                color: Color(0xff666666),
123
+                                fontSize: 16,
124
+                                fontWeight: FontWeight.bold)),
125
+                        TextSpan(
126
+                            // '${DateFormat("yyyy-MM-dd").format(item.appointmentDate.toString())}'
127
+                            text: item.appointmentDate != null
128
+                                ? DateFormat("yyyy-MM-dd").format(
129
+                                    DateTime.parse(
130
+                                        item.appointmentDate.toString()))
131
+                                : item.appointmentDate.toString(),
132
+                            style: TextStyle(
133
+                                color: Color(0xff222222),
134
+                                fontSize: 16,
135
+                                fontWeight: FontWeight.bold)),
136
+                      ]),
131 137
                     ),
132
-                    Padding(
133
-                      padding: EdgeInsets.fromLTRB(0, 0, 0, 20),
134
-                      child: RichText(
135
-                        text:  TextSpan(children: <InlineSpan>[
136
-                          const TextSpan(
137
-                              text: '下单时间:',
138
-                              style: TextStyle(
139
-                                  color: Color(0xff666666),
140
-                                  fontSize: 16,
141
-                                  fontWeight: FontWeight.bold)),
142
-                          TextSpan(
143
-                              // text: DateFormat("yyyy-MM-dd").format(DateTime.parse(item.createDate!.toString())),
144
-                              text:item.createDate!=null? DateFormat("yyyy-MM-dd").format(DateTime.parse(item.createDate.toString())):item.createDate.toString(),
145
-
146
-                              style: const TextStyle(
147
-                                  color: Color(0xff222222),
148
-                                  fontSize: 16,
149
-                                  fontWeight: FontWeight.bold)),
150
-                        ]),
151
-                      ),
138
+                  ),
139
+                  Padding(
140
+                    padding: EdgeInsets.fromLTRB(0, 0, 0, 20),
141
+                    child: RichText(
142
+                      text: TextSpan(children: <InlineSpan>[
143
+                        const TextSpan(
144
+                            text: '下单时间:',
145
+                            style: TextStyle(
146
+                                color: Color(0xff666666),
147
+                                fontSize: 16,
148
+                                fontWeight: FontWeight.bold)),
149
+                        TextSpan(
150
+                            // text: DateFormat("yyyy-MM-dd").format(DateTime.parse(item.createDate!.toString())),
151
+                            text: item.createDate != null
152
+                                ? DateFormat("yyyy-MM-dd").format(
153
+                                    DateTime.parse(item.createDate.toString()))
154
+                                : item.createDate.toString(),
155
+                            style: const TextStyle(
156
+                                color: Color(0xff222222),
157
+                                fontSize: 16,
158
+                                fontWeight: FontWeight.bold)),
159
+                      ]),
152 160
                     ),
153
-                    Padding(
154
-                      padding: EdgeInsets.fromLTRB(0, 0, 0, 20),
155
-                      child: RichText(
156
-                        text:  TextSpan(children: <InlineSpan>[
157
-                          TextSpan(
158
-                              text: '订单状态:',
159
-                              style: TextStyle(
160
-                                  color: Color(0xff666666),
161
-                                  fontSize: 16,
162
-                                  fontWeight: FontWeight.bold)),
163
-                          TextSpan(
164
-                              text: orderStateText==null?'未支付':orderStateText=='已付款'? '已付款,待调度':orderStateText,
165
-                              style: TextStyle(
166
-                                  color:orderStateColor??Colors.black,
167
-                                  fontSize: 16,
168
-                                  fontWeight: FontWeight.bold)),
169
-                        ]),
170
-                      ),
161
+                  ),
162
+                  Padding(
163
+                    padding: EdgeInsets.fromLTRB(0, 0, 0, 20),
164
+                    child: RichText(
165
+                      text: TextSpan(children: <InlineSpan>[
166
+                        TextSpan(
167
+                            text: '订单状态:',
168
+                            style: TextStyle(
169
+                                color: Color(0xff666666),
170
+                                fontSize: 16,
171
+                                fontWeight: FontWeight.bold)),
172
+                        TextSpan(
173
+                            text: orderStateText == null
174
+                                ? '未支付'
175
+                                : orderStateText == '已付款'
176
+                                    ? '已付款,待调度'
177
+                                    : orderStateText,
178
+                            style: TextStyle(
179
+                                color: orderStateColor ?? Colors.black,
180
+                                fontSize: 16,
181
+                                fontWeight: FontWeight.bold)),
182
+                      ]),
171 183
                     ),
172
-                    Container(
173
-                        padding: EdgeInsets.fromLTRB(0, 20, 0, 0),
174
-                        width: 314.w,
175
-                        decoration: const BoxDecoration(
176
-                            border: Border(
177
-                                top: BorderSide(
178
-                                    width: 0.8, color: Color(0x20000000)
179
-                                    // 0x17000000
180
-                                    ))),
181
-                        child: Column(
182
-                          children: [
183
-                            Row(
184
+                  ),
185
+                  Container(
186
+                      padding: EdgeInsets.fromLTRB(0, 20, 0, 0),
187
+                      width: 314.w,
188
+                      decoration: const BoxDecoration(
189
+                          border: Border(
190
+                              top: BorderSide(
191
+                                  width: 0.8, color: Color(0x20000000)
192
+                                  // 0x17000000
193
+                                  ))),
194
+                      child: Column(
195
+                        children: [
196
+                          Row(
197
+                            mainAxisAlignment: MainAxisAlignment.spaceBetween,
198
+                            children: [
199
+                              const Text('费用:',
200
+                                  style: TextStyle(
201
+                                      color: Color(0xff666666),
202
+                                      fontSize: 16,
203
+                                      fontWeight: FontWeight.bold)),
204
+                              LinearGradientText(
205
+                                colors: const <Color>[
206
+                                  Color(0xFFFA7878),
207
+                                  Color(0xFFB61515),
208
+                                ],
209
+                                child: Text(
210
+                                    ((item.charges ?? 0) / 100).toString(),
211
+                                    style: TextStyle(
212
+                                        color: Color(0xffB61515),
213
+                                        fontSize: 16,
214
+                                        fontWeight: FontWeight.bold)),
215
+                              ),
216
+                            ],
217
+                          ),
218
+                          Padding(
219
+                            padding: EdgeInsets.fromLTRB(0, 30, 0, 0),
220
+                            child: Row(
184 221
                               mainAxisAlignment: MainAxisAlignment.spaceBetween,
185
-                              children:  [
186
-                                const Text('费用:',
222
+                              children: [
223
+                                Text('状态:',
187 224
                                     style: TextStyle(
188 225
                                         color: Color(0xff666666),
189 226
                                         fontSize: 16,
190 227
                                         fontWeight: FontWeight.bold)),
191
-                                LinearGradientText(
192
-                                  colors: const <Color>[
193
-                                    Color(0xFFFA7878),
194
-                                    Color(0xFFB61515),
195
-                                  ],
196
-                                  child:  Text(( (item.charges??0)/100).toString(),
197
-                                      style: TextStyle(
198
-                                          color: Color(0xffB61515),
199
-                                          fontSize: 16,
200
-                                          fontWeight: FontWeight.bold)),
201
-                                ),
202
-
228
+                                Text(orderStateText ?? '未支付',
229
+                                    style: TextStyle(
230
+                                        color: orderStateColor ?? Colors.black,
231
+                                        fontSize: 16,
232
+                                        fontWeight: FontWeight.bold)),
203 233
                               ],
204 234
                             ),
205
-                            Padding(
206
-                              padding: EdgeInsets.fromLTRB(0, 30, 0, 0),
207
-                              child: Row(
208
-                                mainAxisAlignment:
209
-                                MainAxisAlignment.spaceBetween,
210
-                                children:  [
211
-                                  Text('状态:',
212
-                                      style: TextStyle(
213
-                                          color: Color(0xff666666),
214
-                                          fontSize: 16,
215
-                                          fontWeight: FontWeight.bold)),
216
-                                  Text(orderStateText??'未支付',
217
-                                      style: TextStyle(
218
-                                          color: orderStateColor??Colors.black,
219
-                                          fontSize: 16,
220
-                                          fontWeight: FontWeight.bold)),
221
-                                ],
222
-                              ),
223
-                            ),
224
-                          ],
225
-                        )),
226
-                  ],
227
-                )),
228
-          ],
229
-        ),
230
-
235
+                          ),
236
+                        ],
237
+                      )),
238
+                ],
239
+              )),
240
+        ],
241
+      ),
231 242
     );
232 243
   }
233 244
 }

+ 67
- 91
lib/widgets/OrderListCard.dart Voir le fichier

@@ -8,9 +8,7 @@ import '../pages/orderInfo/index.dart';
8 8
 import 'package:intl/intl.dart';
9 9
 import 'LinearGradientText.dart';
10 10
 
11
-
12 11
 class OrderListCard extends StatefulWidget {
13
-
14 12
   final OrderListAll item;
15 13
   const OrderListCard({Key? key, required this.item}) : super(key: key);
16 14
 
@@ -18,77 +16,53 @@ class OrderListCard extends StatefulWidget {
18 16
   _OrderListCardPages createState() => _OrderListCardPages(item);
19 17
 }
20 18
 
21
-
22 19
 class StyleObj {
23 20
   String title;
24 21
   Color styleColor;
25
-  StyleObj ({ required this.title, required this.styleColor});
22
+  StyleObj({required this.title, required this.styleColor});
26 23
 }
27 24
 
28
-
29
-
30 25
 class _OrderListCardPages extends State<OrderListCard> {
31
-
32 26
   final OrderListAll item;
33 27
 
34
-
35 28
   _OrderListCardPages(this.item);
36 29
 
37
-
38
-  StyleObj  orderStates(){
30
+  StyleObj orderStates() {
39 31
     if (item.payStatus == 0) {
40
-      return StyleObj(
41
-          title: '待付款',
42
-          styleColor: Color(0xFF51D4FF)
43
-      );
44
-    } else if (item.payStatus == 1 && item.workStatus == 0 && item.dispatchStatus == 0) {
45
-      return StyleObj(
46
-          title: '已付款',
47
-          styleColor: Color(0xFFFF703B)
48
-      );
49
-    } else if (item.payStatus == 1 && item.dispatchStatus == 1 && item.workStatus == 0) {
50
-      return StyleObj(
51
-          title: '待作业',
52
-          styleColor: Color(0xFFFF703B)
53
-      );
54
-    } else if (item.payStatus == 1 && (item.workStatus == 1 || item.workStatus == 2)) {
55
-      return StyleObj(
56
-          title: '进行中',
57
-          styleColor: Color(0xFF44F68B)
58
-      );
32
+      return StyleObj(title: '待付款', styleColor: Color(0xFF51D4FF));
33
+    } else if (item.payStatus == 1 &&
34
+        item.workStatus == 0 &&
35
+        item.dispatchStatus == 0) {
36
+      return StyleObj(title: '已付款', styleColor: Color(0xFFFF703B));
37
+    } else if (item.payStatus == 1 &&
38
+        item.dispatchStatus == 1 &&
39
+        item.workStatus == 0) {
40
+      return StyleObj(title: '待作业', styleColor: Color(0xFFFF703B));
41
+    } else if (item.payStatus == 1 &&
42
+        (item.workStatus == 1 || item.workStatus == 2)) {
43
+      return StyleObj(title: '进行中', styleColor: Color(0xFF44F68B));
59 44
     } else if (item.workStatus == 3 && item.isEvaluated == 0) {
60
-      return StyleObj(
61
-          title: '待评价',
62
-          styleColor: Color(0xFF51D4FF)
63
-      );
64
-    } if (item.workStatus == 3 && item.isEvaluated == 1 && item.dispatchStatus == 1) {
65
-      return StyleObj(
66
-          title: '已完成',
67
-          styleColor: Color(0xFFFF703B)
68
-      );
69
-    } else if (item.payStatus == -1 && item.workStatus == 0 && item.isRefund == 1) {
70
-      return StyleObj(
71
-          title: '已退单',
72
-          styleColor: Color(0xFFFF703B)
73
-      );
74
-    } else if (item.payStatus == 3 && (item.dispatchStatus == 1 || item.dispatchStatus == 0)) {
75
-      return StyleObj(
76
-          title: '退单申请中',
77
-          styleColor: Color(0xFFFF703B)
78
-      );
45
+      return StyleObj(title: '待评价', styleColor: Color(0xFF51D4FF));
46
+    }
47
+    if (item.workStatus == 3 &&
48
+        item.isEvaluated == 1 &&
49
+        item.dispatchStatus == 1) {
50
+      return StyleObj(title: '已完成', styleColor: Color(0xFFFF703B));
51
+    } else if (item.payStatus == -1 &&
52
+        item.workStatus == 0 &&
53
+        item.isRefund == 1) {
54
+      return StyleObj(title: '已退单', styleColor: Color(0xFFFF703B));
55
+    } else if (item.payStatus == 3 &&
56
+        (item.dispatchStatus == 1 || item.dispatchStatus == 0)) {
57
+      return StyleObj(title: '退单申请中', styleColor: Color(0xFFFF703B));
79 58
     } else {
80
-      return StyleObj(
81
-          title: '异常',
82
-          styleColor: Color(0xFFFF0000)
83
-      );
59
+      return StyleObj(title: '异常', styleColor: Color(0xFFFF0000));
84 60
     }
85 61
   }
86 62
 
87
-
88 63
   @override
89 64
   Widget build(BuildContext context) {
90
-    return
91
-      Container(
65
+    return Container(
92 66
       width: 375.w,
93 67
       height: 345.h,
94 68
       margin: EdgeInsets.fromLTRB(0, 0, 0, 20),
@@ -131,7 +105,7 @@ class _OrderListCardPages extends State<OrderListCard> {
131 105
                     children: [
132 106
                       Container(
133 107
                         child: RichText(
134
-                          text:  TextSpan(children: <InlineSpan>[
108
+                          text: TextSpan(children: <InlineSpan>[
135 109
                             TextSpan(
136 110
                                 text: '订单编号:',
137 111
                                 style: TextStyle(
@@ -156,7 +130,11 @@ class _OrderListCardPages extends State<OrderListCard> {
156 130
                             )),
157 131
                         onTap: () {
158 132
                           print('进入详情');
159
-                          Get.toNamed('/orderPageInfo',arguments:{'id':item.orderId,'title':orderStates().title,'styleColor':orderStates().styleColor});
133
+                          Get.toNamed('/orderPageInfo', arguments: {
134
+                            'id': item.orderId,
135
+                            'title': orderStates().title,
136
+                            'styleColor': orderStates().styleColor
137
+                          });
160 138
                         },
161 139
                       )
162 140
                     ],
@@ -169,7 +147,7 @@ class _OrderListCardPages extends State<OrderListCard> {
169 147
                     Padding(
170 148
                       padding: EdgeInsets.fromLTRB(0, 0, 0, 15),
171 149
                       child: RichText(
172
-                        text:  TextSpan(children: <InlineSpan>[
150
+                        text: TextSpan(children: <InlineSpan>[
173 151
                           TextSpan(
174 152
                               text: '农机名称:',
175 153
                               style: TextStyle(
@@ -188,7 +166,7 @@ class _OrderListCardPages extends State<OrderListCard> {
188 166
                     Padding(
189 167
                       padding: EdgeInsets.fromLTRB(0, 0, 0, 15),
190 168
                       child: RichText(
191
-                        text:  TextSpan(children: <InlineSpan>[
169
+                        text: TextSpan(children: <InlineSpan>[
192 170
                           TextSpan(
193 171
                               text: '作业面积:',
194 172
                               style: TextStyle(
@@ -207,7 +185,7 @@ class _OrderListCardPages extends State<OrderListCard> {
207 185
                     Padding(
208 186
                       padding: EdgeInsets.fromLTRB(0, 0, 0, 15),
209 187
                       child: RichText(
210
-                        text:  TextSpan(children: <InlineSpan>[
188
+                        text: TextSpan(children: <InlineSpan>[
211 189
                           TextSpan(
212 190
                               text: '需求时间:',
213 191
                               style: TextStyle(
@@ -215,8 +193,9 @@ class _OrderListCardPages extends State<OrderListCard> {
215 193
                                   fontSize: 16,
216 194
                                   fontWeight: FontWeight.bold)),
217 195
                           TextSpan(
218
-                              text: DateFormat("yyyy-MM-dd").format(DateTime.parse(item.appointmentDate.toString())),
219
-
196
+                              text: DateFormat("yyyy-MM-dd").format(
197
+                                  DateTime.parse(
198
+                                      item.appointmentDate.toString())),
220 199
                               style: TextStyle(
221 200
                                   color: Color(0xff222222),
222 201
                                   fontSize: 16,
@@ -227,7 +206,7 @@ class _OrderListCardPages extends State<OrderListCard> {
227 206
                     Padding(
228 207
                       padding: EdgeInsets.fromLTRB(0, 0, 0, 4),
229 208
                       child: RichText(
230
-                        text:  TextSpan(children: <InlineSpan>[
209
+                        text: TextSpan(children: <InlineSpan>[
231 210
                           TextSpan(
232 211
                               text: '下单时间:',
233 212
                               style: TextStyle(
@@ -235,7 +214,8 @@ class _OrderListCardPages extends State<OrderListCard> {
235 214
                                   fontSize: 16,
236 215
                                   fontWeight: FontWeight.bold)),
237 216
                           TextSpan(
238
-                              text: DateFormat("yyyy-MM-dd").format(DateTime.parse(item.createDate.toString())),
217
+                              text: DateFormat("yyyy-MM-dd").format(
218
+                                  DateTime.parse(item.createDate.toString())),
239 219
                               style: TextStyle(
240 220
                                   color: Color(0xff222222),
241 221
                                   fontSize: 16,
@@ -257,17 +237,17 @@ class _OrderListCardPages extends State<OrderListCard> {
257 237
                     mainAxisAlignment: MainAxisAlignment.spaceBetween,
258 238
                     children: [
259 239
                       RichText(
260
-                        text:  TextSpan(children: <InlineSpan>[
240
+                        text: TextSpan(children: <InlineSpan>[
261 241
                           TextSpan(
262 242
                               text: '订单状态:',
263 243
                               style: TextStyle(
264
-                                  color:Color(0xff666666),
244
+                                  color: Color(0xff666666),
265 245
                                   fontSize: 16,
266 246
                                   fontWeight: FontWeight.bold)),
267 247
                           TextSpan(
268 248
                               text: orderStates().title,
269 249
                               style: TextStyle(
270
-                                  color:orderStates().styleColor,
250
+                                  color: orderStates().styleColor,
271 251
                                   fontSize: 16,
272 252
                                   fontWeight: FontWeight.bold)),
273 253
                         ]),
@@ -275,40 +255,37 @@ class _OrderListCardPages extends State<OrderListCard> {
275 255
                       Container(
276 256
                         child: Row(
277 257
                           children: [
278
-                            const Text('费用:',style: TextStyle(
279
-                                color: Color(0xff666666),
280
-                                fontSize: 16,
281
-                                fontWeight: FontWeight.bold)),
258
+                            const Text('费用:',
259
+                                style: TextStyle(
260
+                                    color: Color(0xff666666),
261
+                                    fontSize: 16,
262
+                                    fontWeight: FontWeight.bold)),
282 263
                             LinearGradientText(
283 264
                               colors: const <Color>[
284 265
                                 Color(0xFFFA7878),
285 266
                                 Color(0xFFB61515),
286 267
                               ],
287 268
                               child: RichText(
288
-                                text:  TextSpan(
289
-                                    children: <InlineSpan>[
290
-                                      TextSpan(
291
-                                          text:( (item.charges??0)/100).toString(),
292
-                                          style: TextStyle(
293
-                                            fontSize: 16,
294
-                                            fontWeight: FontWeight.bold,
295
-                                          )),
296
-                                      TextSpan(
297
-                                          text: "元",
298
-                                          style: TextStyle(
299
-                                            fontSize: 16,
300
-                                            fontWeight: FontWeight.bold,
301
-                                          )),
302
-
303
-                                    ]
304
-                                ),
269
+                                text: TextSpan(children: <InlineSpan>[
270
+                                  TextSpan(
271
+                                      text: ((item.charges ?? 0) / 100)
272
+                                          .toString(),
273
+                                      style: TextStyle(
274
+                                        fontSize: 16,
275
+                                        fontWeight: FontWeight.bold,
276
+                                      )),
277
+                                  TextSpan(
278
+                                      text: "元",
279
+                                      style: TextStyle(
280
+                                        fontSize: 16,
281
+                                        fontWeight: FontWeight.bold,
282
+                                      )),
283
+                                ]),
305 284
                               ),
306 285
                             ),
307
-
308 286
                           ],
309 287
                         ),
310 288
                       ),
311
-
312 289
                     ],
313 290
                   ),
314 291
                 ),
@@ -320,4 +297,3 @@ class _OrderListCardPages extends State<OrderListCard> {
320 297
     );
321 298
   }
322 299
 }
323
-

+ 4
- 9
lib/widgets/Refresher.dart Voir le fichier

@@ -1,4 +1,3 @@
1
-
2 1
 import 'package:farmer_client/models/entities/PagedResult.dart';
3 2
 import 'package:flutter/material.dart';
4 3
 
@@ -10,7 +9,7 @@ class RefreshBuilder extends StatefulWidget {
10 9
     required this.fetch,
11 10
     required this.useState,
12 11
     this.onError,
13
-  }): super(key: key);
12
+  }) : super(key: key);
14 13
 
15 14
   bool autoRerender;
16 15
   Future Function(Map param) fetch;
@@ -27,7 +26,6 @@ class RefreshBuilder extends StatefulWidget {
27 26
 }
28 27
 
29 28
 class _RefresherState extends State<RefreshBuilder> {
30
-
31 29
   PagedResult result = PagedResult(total: 0, size: 0, pages: 0, current: 0);
32 30
   List<dynamic> listData = [];
33 31
 
@@ -38,7 +36,7 @@ class _RefresherState extends State<RefreshBuilder> {
38 36
   }
39 37
 
40 38
   Future fetchData() {
41
-    return Future.value(widget.fetch({ "pageNum": 1 }).then((res) {
39
+    return Future.value(widget.fetch({"pageNum": 1}).then((res) {
42 40
       final pagedResult = PagedResult.fromJson(res);
43 41
       widget.useState(state: pagedResult);
44 42
 
@@ -62,10 +60,7 @@ class _RefresherState extends State<RefreshBuilder> {
62 60
     return RefreshIndicator(
63 61
       triggerMode: RefreshIndicatorTriggerMode.onEdge,
64 62
       onRefresh: fetchData,
65
-      child: widget.builder(
66
-          context: context,
67
-          toggle: toggle
68
-      ),
63
+      child: widget.builder(context: context, toggle: toggle),
69 64
     );
70 65
   }
71
-}
66
+}

+ 6
- 7
lib/widgets/amap/amap.dart Voir le fichier

@@ -10,7 +10,7 @@ class AMap extends StatelessWidget {
10 10
   final LatLng? position;
11 11
   final Map<String, Marker> _markers = Map<String, Marker>();
12 12
 
13
-  AMap({Key? key,  this.position }): super(key: key);
13
+  AMap({Key? key, this.position}) : super(key: key);
14 14
 
15 15
   void onMapCreated(AMapController controller) {
16 16
     _mapController = controller;
@@ -19,9 +19,8 @@ class AMap extends StatelessWidget {
19 19
   void _initMarkers() {
20 20
     if (null != position) {
21 21
       Marker marker = Marker(
22
-        position: position!,
23
-        icon: BitmapDescriptor.fromIconPath("images/locationImage.png")
24
-      );
22
+          position: position!,
23
+          icon: BitmapDescriptor.fromIconPath("images/locationImage.png"));
25 24
       _markers[marker.id] = marker;
26 25
     }
27 26
   }
@@ -35,8 +34,8 @@ class AMap extends StatelessWidget {
35 34
       apiKey: ConstConfig.amapApiKeys,
36 35
       markers: Set<Marker>.of(_markers.values),
37 36
       // 默认是邓州市中心
38
-      initialCameraPosition: const CameraPosition(target: LatLng(32.687732, 112.08745)),
37
+      initialCameraPosition:
38
+          const CameraPosition(target: LatLng(32.687732, 112.08745)),
39 39
     );
40 40
   }
41
-
42
-}
41
+}

+ 2
- 3
lib/widgets/amap/const_config.dart Voir le fichier

@@ -7,8 +7,7 @@ class ConstConfig {
7 7
   ///注意:使用[AMapWidget]的`apiKey`属性设置的key的优先级高于通过Native配置key的优先级,
8 8
   ///使用[AMapWidget]的`apiKey`属性配置后Native配置的key将失效,请根据实际情况选择使用
9 9
   static const AMapApiKey amapApiKeys = AMapApiKey(
10
-      androidKey: 'b481b4187e24e625fa0056fd0530e663',
11
-      iosKey: '您申请的iOS平台的key');
10
+      androidKey: 'b481b4187e24e625fa0056fd0530e663', iosKey: '您申请的iOS平台的key');
12 11
 
13 12
   ///高德隐私合规声明,这里只是示例,实际使用中请按照实际参数设置[AMapPrivacyStatement]的'hasContains''hasShow''hasAgree'这三个参数
14 13
   ///
@@ -18,5 +17,5 @@ class ConstConfig {
18 17
   ///
19 18
   /// 高德SDK合规使用方案请参考:https://lbs.amap.com/news/sdkhgsy
20 19
   static const AMapPrivacyStatement amapPrivacyStatement =
21
-  AMapPrivacyStatement(hasContains: true, hasShow: true, hasAgree: true);
20
+      AMapPrivacyStatement(hasContains: true, hasShow: true, hasAgree: true);
22 21
 }

+ 4
- 5
lib/widgets/layout/BasicPage.dart Voir le fichier

@@ -1,4 +1,3 @@
1
-
2 1
 import 'package:farmer_client/widgets/layout/bottomBar/BottomBar.dart';
3 2
 import 'package:flutter/material.dart';
4 3
 import 'package:flutter_screenutil/flutter_screenutil.dart';
@@ -22,7 +21,7 @@ abstract class BasicPage extends StatefulWidget {
22 21
   bool canScroll;
23 22
 
24 23
   //
25
-  BasicPage({Key? key, this.canScroll = true, this.tabIndex }) : super(key: key);
24
+  BasicPage({Key? key, this.canScroll = true, this.tabIndex}) : super(key: key);
26 25
 
27 26
   @protected
28 27
   Widget builder(BuildContext context);
@@ -60,7 +59,6 @@ abstract class BasicPage extends StatefulWidget {
60 59
 }
61 60
 
62 61
 class _BasicPageState extends State<BasicPage> {
63
-
64 62
   @override
65 63
   void initState() {
66 64
     super.initState();
@@ -106,8 +104,9 @@ class _BasicPageState extends State<BasicPage> {
106 104
       body: SafeArea(
107 105
         child: _buildChild(context),
108 106
       ),
109
-      bottomNavigationBar: widget.tabIndex == null ? null : BottomBar(list: BarList, current: widget.tabIndex!),
107
+      bottomNavigationBar: widget.tabIndex == null
108
+          ? null
109
+          : BottomBar(list: BarList, current: widget.tabIndex!),
110 110
     );
111 111
   }
112 112
 }
113
-

+ 32
- 9
lib/widgets/layout/barList.dart Voir le fichier

@@ -1,4 +1,3 @@
1
-
2 1
 import 'package:flutter/cupertino.dart';
3 2
 import 'package:flutter_screenutil/flutter_screenutil.dart';
4 3
 
@@ -8,25 +7,49 @@ final BarList = <BarItem>[
8 7
   BarItem(
9 8
     label: '首页',
10 9
     page: '/',
11
-    normal: Item (color: const Color(0xFF323232), fontSize: 15.sp, image: 'images/index/HomesOFFImgaes.png'),
12
-    selected: Item (color: const Color(0xFFFF703B), fontSize: 15.sp, image: 'images/index/HomesNOImgaes.png'),
10
+    normal: Item(
11
+        color: const Color(0xFF323232),
12
+        fontSize: 15.sp,
13
+        image: 'images/index/HomesOFFImgaes.png'),
14
+    selected: Item(
15
+        color: const Color(0xFFFF703B),
16
+        fontSize: 15.sp,
17
+        image: 'images/index/HomesNOImgaes.png'),
13 18
   ),
14 19
   BarItem(
15 20
     label: '订单',
16 21
     page: '/order',
17
-    normal: Item (color: const Color(0xFF323232), fontSize: 15.sp, image: 'images/index/OrdersOFFImgaes.png'),
18
-    selected: Item (color: const Color(0xFFFF703B), fontSize: 15.sp, image: 'images/index/OrdersNOImgaes.png'),
22
+    normal: Item(
23
+        color: const Color(0xFF323232),
24
+        fontSize: 15.sp,
25
+        image: 'images/index/OrdersOFFImgaes.png'),
26
+    selected: Item(
27
+        color: const Color(0xFFFF703B),
28
+        fontSize: 15.sp,
29
+        image: 'images/index/OrdersNOImgaes.png'),
19 30
   ),
20 31
   BarItem(
21 32
     label: '资讯',
22 33
     page: '/infomation',
23
-    normal: Item (color: const Color(0xFF323232), fontSize: 15.sp, image: 'images/index/newsOFFImages.png'),
24
-    selected: Item (color: const Color(0xFFFF703B), fontSize: 15.sp, image: 'images/index/newsONImages.png'),
34
+    normal: Item(
35
+        color: const Color(0xFF323232),
36
+        fontSize: 15.sp,
37
+        image: 'images/index/newsOFFImages.png'),
38
+    selected: Item(
39
+        color: const Color(0xFFFF703B),
40
+        fontSize: 15.sp,
41
+        image: 'images/index/newsONImages.png'),
25 42
   ),
26 43
   BarItem(
27 44
     label: '我的',
28 45
     page: '/main',
29
-    normal: Item (color: const Color(0xFF323232), fontSize: 15.sp, image: 'images/index/MineOFFImgaes.png'),
30
-    selected: Item (color: const Color(0xFFFF703B), fontSize: 15.sp, image: 'images/index/MineNOImgaes.png'),
46
+    normal: Item(
47
+        color: const Color(0xFF323232),
48
+        fontSize: 15.sp,
49
+        image: 'images/index/MineOFFImgaes.png'),
50
+    selected: Item(
51
+        color: const Color(0xFFFF703B),
52
+        fontSize: 15.sp,
53
+        image: 'images/index/MineNOImgaes.png'),
31 54
   ),
32 55
 ];

+ 8
- 10
lib/widgets/layout/bottomBar/BottomBar.dart Voir le fichier

@@ -1,16 +1,14 @@
1
-
2 1
 import 'package:farmer_client/widgets/layout/bottomBar/item.dart';
3 2
 import 'package:flutter/widgets.dart';
4 3
 import 'package:flutter_screenutil/flutter_screenutil.dart';
5 4
 import 'package:get/get.dart';
6 5
 
7
-
8 6
 class BottomBarItem extends StatelessWidget {
9
-
10 7
   final bool selected;
11 8
   final BarItem data;
12 9
 
13
-  BottomBarItem({Key? key, required this.selected, required this.data }) : super(key: key);
10
+  BottomBarItem({Key? key, required this.selected, required this.data})
11
+      : super(key: key);
14 12
 
15 13
   @override
16 14
   Widget build(BuildContext context) {
@@ -18,7 +16,8 @@ class BottomBarItem extends StatelessWidget {
18 16
     final color = selected ? data.selected.color : data.normal.color;
19 17
     final fontSize = selected ? data.selected.fontSize : data.normal.fontSize;
20 18
 
21
-    final textStyle = TextStyle(color: color, fontSize: fontSize, fontWeight: FontWeight.bold);
19
+    final textStyle = TextStyle(
20
+        color: color, fontSize: fontSize, fontWeight: FontWeight.bold);
22 21
 
23 22
     return GestureDetector(
24 23
       onTap: () {
@@ -45,11 +44,11 @@ class BottomBarItem extends StatelessWidget {
45 44
 }
46 45
 
47 46
 class BottomBar extends StatelessWidget {
48
-
49 47
   final int current;
50 48
   List<BarItem> list;
51 49
 
52
-  BottomBar({ Key? key , required this.list, required this.current }) : super(key: key);
50
+  BottomBar({Key? key, required this.list, required this.current})
51
+      : super(key: key);
53 52
 
54 53
   @override
55 54
   Widget build(BuildContext context) {
@@ -74,8 +73,8 @@ class BottomBar extends StatelessWidget {
74 73
               int index = list.indexOf(item);
75 74
 
76 75
               return Expanded(
77
-                  flex: 1,
78
-                  child: BottomBarItem(data: item, selected: current == index ),
76
+                flex: 1,
77
+                child: BottomBarItem(data: item, selected: current == index),
79 78
               );
80 79
             })
81 80
           ],
@@ -83,5 +82,4 @@ class BottomBar extends StatelessWidget {
83 82
       ),
84 83
     );
85 84
   }
86
-
87 85
 }

+ 6
- 3
lib/widgets/layout/bottomBar/item.dart Voir le fichier

@@ -1,4 +1,3 @@
1
-
2 1
 import 'dart:ui';
3 2
 
4 3
 class Item {
@@ -6,7 +5,7 @@ class Item {
6 5
   Color color;
7 6
   String image;
8 7
 
9
-  Item({ required this.fontSize, required this.color, required this.image });
8
+  Item({required this.fontSize, required this.color, required this.image});
10 9
 }
11 10
 
12 11
 class BarItem {
@@ -15,5 +14,9 @@ class BarItem {
15 14
   Item normal;
16 15
   Item selected;
17 16
 
18
-  BarItem ({ required this.label, required this.page, required this.normal, required this.selected });
17
+  BarItem(
18
+      {required this.label,
19
+      required this.page,
20
+      required this.normal,
21
+      required this.selected});
19 22
 }

+ 1
- 0
lib/widgets/layout/widgets/index.dart Voir le fichier

@@ -0,0 +1 @@
1
+

+ 14
- 0
pubspec.lock Voir le fichier

@@ -181,6 +181,13 @@ packages:
181 181
     description: flutter
182 182
     source: sdk
183 183
     version: "0.0.0"
184
+  flutter_easyloading:
185
+    dependency: "direct main"
186
+    description:
187
+      name: flutter_easyloading
188
+      url: "https://pub.dartlang.org"
189
+    source: hosted
190
+    version: "3.0.3"
184 191
   flutter_lints:
185 192
     dependency: "direct dev"
186 193
     description:
@@ -207,6 +214,13 @@ packages:
207 214
       url: "https://pub.dartlang.org"
208 215
     source: hosted
209 216
     version: "5.4.0+1"
217
+  flutter_spinkit:
218
+    dependency: transitive
219
+    description:
220
+      name: flutter_spinkit
221
+      url: "https://pub.dartlang.org"
222
+    source: hosted
223
+    version: "5.1.0"
210 224
   flutter_test:
211 225
     dependency: "direct dev"
212 226
     description: flutter

+ 1
- 0
pubspec.yaml Voir le fichier

@@ -50,6 +50,7 @@ dependencies:
50 50
   carousel_slider: ^4.0.0
51 51
   permission_handler: ^9.2.0
52 52
   ff_stars: ^1.0.0
53
+  flutter_easyloading: ^3.0.3
53 54
 
54 55
 #  flutter_bmflocation: ^3.1.0+1
55 56