Pārlūkot izejas kodu

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

张延森 3 gadus atpakaļ
vecāks
revīzija
1e20c89190
61 mainītis faili ar 1792 papildinājumiem un 386 dzēšanām
  1. Binārs
      .gradle/6.8/fileChanges/last-build.bin
  2. Binārs
      .gradle/6.8/fileHashes/fileHashes.lock
  3. 0
    0
      .gradle/6.8/gc.properties
  4. Binārs
      .gradle/buildOutputCleanup/buildOutputCleanup.lock
  5. 0
    2
      .gradle/buildOutputCleanup/cache.properties
  6. Binārs
      .gradle/checksums/checksums.lock
  7. 0
    0
      .gradle/configuration-cache/gc.properties
  8. 0
    0
      .gradle/vcs-1/gc.properties
  9. 6
    0
      android/app/src/main/java/com/example/farmer_client/MainActivity.java
  10. 1
    1
      android/app/src/main/res/drawable/launch_background.xml
  11. Binārs
      images/cars.png
  12. 1
    0
      lib/models/Store.dart
  13. 15
    0
      lib/models/User.dart
  14. 11
    7
      lib/models/app.dart
  15. 20
    1
      lib/models/entities/Address.dart
  16. 72
    5
      lib/models/entities/CardInfo.dart
  17. 69
    0
      lib/models/entities/CardListModel.dart
  18. 78
    0
      lib/models/entities/NewsInformationInfoTextModel.dart
  19. 28
    0
      lib/models/entities/banner.dart
  20. 21
    17
      lib/models/entities/person.dart
  21. 73
    35
      lib/pages/ArticleInfo/ArticleInfo.dart
  22. 62
    0
      lib/pages/Information/ArticleInfo.dart
  23. 141
    0
      lib/pages/Information/index.dart
  24. 77
    16
      lib/pages/OrderConfirmation/index.dart
  25. 21
    6
      lib/pages/addAddress/index.dart
  26. 42
    19
      lib/pages/addressList/index.dart
  27. 15
    4
      lib/pages/feedback/index.dart
  28. 1
    0
      lib/pages/home.dart
  29. 1
    4
      lib/pages/home/index.dart
  30. 8
    5
      lib/pages/home/widgets/home/index.dart
  31. 26
    7
      lib/pages/infomation/index.dart
  32. 60
    54
      lib/pages/infomation/widgets/Information/index.dart
  33. 1
    1
      lib/pages/login/login.dart
  34. 22
    4
      lib/pages/machinery/detail/index.dart
  35. 25
    16
      lib/pages/machinery/detail/widgets/detail.dart
  36. 20
    3
      lib/pages/machinery/map/index.dart
  37. 12
    7
      lib/pages/machinery/map/widgets/detail.dart
  38. 1
    1
      lib/pages/machinery/widgets/DefLayout.dart
  39. 15
    11
      lib/pages/machinery/widgets/summary.dart
  40. 25
    1
      lib/pages/main/index.dart
  41. 155
    0
      lib/pages/main/widgets/OtherColumn.dart
  42. 98
    0
      lib/pages/main/widgets/UserAddress.dart
  43. 111
    0
      lib/pages/main/widgets/UserInfo.dart
  44. 11
    8
      lib/pages/main/widgets/main/index.dart
  45. 6
    3
      lib/pages/main/widgets/main/widgets/UserAddress.dart
  46. 27
    15
      lib/pages/main/widgets/main/widgets/UserInfo.dart
  47. 10
    4
      lib/pages/order/widgets/order/index.dart
  48. 61
    35
      lib/pages/orderInfo/index.dart
  49. 63
    25
      lib/pages/userInfo/index.dart
  50. 73
    0
      lib/services/address.dart
  51. 20
    28
      lib/services/homeAPI.dart
  52. 21
    0
      lib/services/main.dart
  53. 28
    0
      lib/services/orderAPI.dart
  54. 14
    0
      lib/services/user.dart
  55. 5
    3
      lib/utils/Request.dart
  56. 44
    9
      lib/widgets/CarsCard.dart
  57. 38
    16
      lib/widgets/ExtendContentList.dart
  58. 11
    9
      lib/widgets/OrderInfoCard.dart
  59. 1
    1
      lib/widgets/OrderListCard.dart
  60. 22
    0
      lib/widgets/amap/const_config.dart
  61. 3
    3
      pubspec.lock

Binārs
.gradle/6.8/fileChanges/last-build.bin Parādīt failu


Binārs
.gradle/6.8/fileHashes/fileHashes.lock Parādīt failu


+ 0
- 0
.gradle/6.8/gc.properties Parādīt failu


Binārs
.gradle/buildOutputCleanup/buildOutputCleanup.lock Parādīt failu


+ 0
- 2
.gradle/buildOutputCleanup/cache.properties Parādīt failu

@@ -1,2 +0,0 @@
1
-#Wed Apr 20 15:13:32 CST 2022
2
-gradle.version=6.8

Binārs
.gradle/checksums/checksums.lock Parādīt failu


+ 0
- 0
.gradle/configuration-cache/gc.properties Parādīt failu


+ 0
- 0
.gradle/vcs-1/gc.properties Parādīt failu


+ 6
- 0
android/app/src/main/java/com/example/farmer_client/MainActivity.java Parādīt failu

@@ -0,0 +1,6 @@
1
+package com.example.farmer_client;
2
+
3
+import io.flutter.embedding.android.FlutterActivity;
4
+
5
+public class MainActivity extends FlutterActivity {
6
+}

+ 1
- 1
android/app/src/main/res/drawable/launch_background.xml Parādīt failu

@@ -5,7 +5,7 @@
5 5
     <!-- You can insert your own image images here -->
6 6
 <!--    <item>-->
7 7
 <!--        <bitmap-->
8
-<!--            android:gravity="fill"-->
8
+<!--            android:gravity="center"-->
9 9
 <!--            android:src="@drawable/launch_image" />-->
10 10
 <!--    </item>-->
11 11
 </layer-list>

Binārs
images/cars.png Parādīt failu


+ 1
- 0
lib/models/Store.dart Parādīt failu

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

+ 15
- 0
lib/models/User.dart Parādīt failu

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

+ 11
- 7
lib/models/app.dart Parādīt failu

@@ -5,6 +5,7 @@ import 'package:amap_flutter_location/amap_flutter_location.dart';
5 5
 import 'package:farmer_client/models/entities/person.dart';
6 6
 import 'package:farmer_client/widgets/Modal.dart';
7 7
 import 'package:get/get.dart';
8
+import '../services/user.dart';
8 9
 import '../utils/location.dart';
9 10
 
10 11
 class AppController extends GetxController {
@@ -18,7 +19,7 @@ class AppController extends GetxController {
18 19
   AMapFlutterLocation? _location;
19 20
 
20 21
   get locationStr {
21
-    if (null == location.value) return null;
22
+    if (null == location) return null;
22 23
 
23 24
     double longitude = location.value!['longitude'] as double;
24 25
     double latitude = location.value!['latitude'] as double;
@@ -47,12 +48,15 @@ class AppController extends GetxController {
47 48
       );
48 49
     });
49 50
 
50
-    // // 尝试获取一次人员信息
51
-    // getCurrent().then((person) {
52
-    //   user(person);
53
-    // }).catchError((e) {
54
-    //   print(e);
55
-    // });
51
+
52
+    // 尝试获取一次人员信息
53
+    getCurrent().then((person) {
54
+      print('9personpersonpersonperson+$person');
55
+      user(Person.fromJson(person));
56
+
57
+    }).catchError((e) {
58
+      print(e);
59
+    });
56 60
   }
57 61
 
58 62
   @override

+ 20
- 1
lib/models/entities/Address.dart Parādīt failu

@@ -1,14 +1,33 @@
1 1
 class Address {
2 2
   String? address;
3 3
   bool? isDefault;
4
+  String? addressId;
5
+  String? ownerType;
6
+  String? ownerId;
7
+  num? sortNo;
8
+  String? orgId;
9
+  num? status;
10
+
4 11
   Address();
5 12
 
6 13
   Address.fromJson(Map<String, dynamic> json)
7 14
       : address = json["address"],
8
-        isDefault = json["isDefault"];
15
+        isDefault = json["isDefault"],
16
+        addressId = json["addressId"],
17
+        ownerType = json["ownerType"],
18
+        ownerId = json["ownerId"],
19
+        sortNo = json["sortNo"],
20
+        orgId = json["orgId"],
21
+        status = json["status"];
9 22
 
10 23
   Map<String, dynamic> toJson() => {
11 24
         'address': address,
12 25
         'isDefault': isDefault,
26
+        'addressId': addressId,
27
+        'ownerType': ownerType,
28
+        'ownerId': ownerId,
29
+        'sortNo': sortNo,
30
+        'orgId': orgId,
31
+        'status': status,
13 32
       };
14 33
 }

+ 72
- 5
lib/models/entities/CardInfo.dart Parādīt failu

@@ -1,4 +1,18 @@
1
+List<ContentImageList> jsonToContentList(list) {
2
+  List<ContentImageList> contList = [];
3
+  list.forEach((item) {
4
+    contList.add(ContentImageList.fromJson(item));
5
+  });
6
+  return contList;
7
+}
1 8
 
9
+List<BannerImageList> jsonToImagesList(list) {
10
+  List<BannerImageList> contList = [];
11
+  list.forEach((item) {
12
+    contList.add(BannerImageList.fromJson(item));
13
+  });
14
+  return contList;
15
+}
2 16
 
3 17
 class CardInfo {
4 18
   // @ApiModelProperty(value = "农机Id")
@@ -33,10 +47,9 @@ class CardInfo {
33 47
   int? status;
34 48
 
35 49
   // @ApiModelProperty(value = "内容详情")
36
-  late List<dynamic>? contentList;
37
-
50
+   List<ContentImageList>? contentList=[];
38 51
   // @ApiModelProperty(value = "图片列表")
39
-  late List<dynamic>? imagesList;
52
+   List<BannerImageList>? imagesList=[];
40 53
 
41 54
   CardInfo();
42 55
 
@@ -53,8 +66,8 @@ class CardInfo {
53 66
         orgName = json["orgName"],
54 67
         jobStatus = json["jobStatus"],
55 68
         status = json["status"],
56
-        contentList = json["contentList"],
57
-        imagesList = json["imagesList"];
69
+        contentList = jsonToContentList(json["contentList"]),
70
+        imagesList = jsonToImagesList(json["imagesList"]);
58 71
   Map<String, dynamic> toJson() => {
59 72
         'machineryId': machineryId,
60 73
         'name': name,
@@ -72,3 +85,57 @@ class CardInfo {
72 85
         'imagesList': imagesList,
73 86
       };
74 87
 }
88
+
89
+class ContentImageList {
90
+  String? content;
91
+  String? contentType;
92
+  String? createDate;
93
+  String? extId;
94
+  num? sort;
95
+  String? targetId;
96
+  String? targetType;
97
+  ContentImageList();
98
+
99
+  ContentImageList.fromJson(Map<String, dynamic> json)
100
+      : content = json["content"],
101
+        contentType = json["contentType"],
102
+        createDate = json["createDate"],
103
+        extId = json["extId"],
104
+        sort = json["sort"],
105
+        targetId = json["targetId"],
106
+        targetType = json["targetType"];
107
+  Map<String, dynamic> toJson() => {
108
+        'content': content,
109
+        'contentType': contentType,
110
+        'createDate': createDate,
111
+        'extId': extId,
112
+        'sort': sort,
113
+        'targetId': targetId,
114
+        'targetType': targetType,
115
+      };
116
+}
117
+
118
+class BannerImageList {
119
+  String? createDate;
120
+  String? imageId;
121
+  num? status;
122
+  String? targetId;
123
+  String? targetType;
124
+  String? url;
125
+  BannerImageList();
126
+  BannerImageList.fromJson(Map<String, dynamic> json)
127
+      : createDate = json["createDate"],
128
+        imageId = json["imageId"],
129
+        status = json["status"],
130
+        targetId = json["targetId"],
131
+        targetType = json["targetType"],
132
+        url = json["url"];
133
+  Map<String, dynamic> toJson() => {
134
+        'createDate': createDate,
135
+        'imageId': imageId,
136
+        'status': status,
137
+        'targetId': targetId,
138
+        'targetType': targetType,
139
+        'url': url,
140
+      };
141
+}

+ 69
- 0
lib/models/entities/CardListModel.dart Parādīt failu

@@ -0,0 +1,69 @@
1
+class CardListModel {
2
+  // @ApiModelProperty(value = "农机Id")
3
+  String? machineryId;
4
+  // @ApiModelProperty(value = "名称")
5
+  String? name;
6
+  // @ApiModelProperty(value = "农机类型")
7
+  String? typeId;
8
+  // @ApiModelProperty(value = "类型名称")
9
+  String? typeName;
10
+  // @ApiModelProperty(value = "农机价格")
11
+  num? price;
12
+  // @ApiModelProperty(value = "主图")
13
+  String? thumb;
14
+
15
+  // @ApiModelProperty(value = "当前位置")
16
+  String? location;
17
+
18
+  // @ApiModelProperty(value = "距离")
19
+  double? distance;
20
+
21
+  // @ApiModelProperty(value = "机构ID")
22
+  String? orgId;
23
+
24
+  // @ApiModelProperty(value = "机构名称")
25
+  String? orgName;
26
+
27
+  // @ApiModelProperty(value = "工作状态")
28
+  String? jobStatus;
29
+
30
+  // @ApiModelProperty(value = "状态")
31
+  int? status;
32
+
33
+  // @ApiModelProperty(value = "内容详情")
34
+  List<dynamic>? contentList;
35
+  // @ApiModelProperty(value = "图片列表")
36
+  List<dynamic>? imagesList;
37
+  CardListModel();
38
+  CardListModel.fromJson(Map<String, dynamic> json)
39
+      : machineryId = json["machineryId"],
40
+        name = json["name"],
41
+        typeId = json["typeId"],
42
+        typeName = json["typeName"],
43
+        price = json["price"],
44
+        thumb = json["thumb"],
45
+        location = json["location"],
46
+        distance = json["distance"],
47
+        orgId = json["orgId"],
48
+        orgName = json["orgName"],
49
+        jobStatus = json["jobStatus"],
50
+        status = json["status"],
51
+        contentList = json["contentList"],
52
+        imagesList = json["imagesList"];
53
+  Map<String, dynamic> toJson() => {
54
+        'machineryId': machineryId,
55
+        'name': name,
56
+        'typeId': typeId,
57
+        'typeName': typeName,
58
+        'price': price,
59
+        'thumb': thumb,
60
+        'location': location,
61
+        'distance': distance,
62
+        'orgId': orgId,
63
+        'orgName': orgName,
64
+        'jobStatus': jobStatus,
65
+        'status': status,
66
+        'contentList': contentList,
67
+        'imagesList': imagesList,
68
+      };
69
+}

+ 78
- 0
lib/models/entities/NewsInformationInfoTextModel.dart Parādīt failu

@@ -0,0 +1,78 @@
1
+
2
+List<ExtendContent> jsonToList(list){
3
+  List<ExtendContent> contList=[];
4
+  list.forEach((item){
5
+    contList.add(ExtendContent.fromJson(item));
6
+  });
7
+  return contList;
8
+}
9
+
10
+
11
+class NewsInformationInfoTextModel {
12
+  String? createDate;
13
+  String? newsId;
14
+  num? status;
15
+  String? thumb;
16
+  String? title;
17
+  String? typeId;
18
+  String? typeName;
19
+  num? weight;
20
+   List<ExtendContent>? contentList=[];
21
+
22
+  NewsInformationInfoTextModel();
23
+
24
+  NewsInformationInfoTextModel.fromJson(Map<String, dynamic> json)
25
+      : newsId = json["newsId"],
26
+        title = json["title"],
27
+        typeId = json["typeId"],
28
+        typeName = json["typeName"],
29
+        thumb = json["thumb"],
30
+        weight = json["weight"],
31
+        status = json["status"],
32
+        createDate = json["createDate"],
33
+        contentList= jsonToList(json["contentList"]);
34
+
35
+
36
+  Map<String, dynamic> toJson() => {
37
+        'newsId': newsId,
38
+        'title': title,
39
+        'typeId': typeId,
40
+        'typeName': typeName,
41
+        'thumb': thumb,
42
+        'weight': weight,
43
+        'status': status,
44
+        'createDate': createDate,
45
+
46
+
47
+      };
48
+}
49
+
50
+class ExtendContent {
51
+  String? content;
52
+  String? contentType;
53
+  String? createDate;
54
+  String? extId;
55
+  num? sort;
56
+  String? targetId;
57
+  String? targetType;
58
+  ExtendContent();
59
+
60
+  ExtendContent.fromJson(Map<String, dynamic> json)
61
+      : content = json["content"],
62
+        contentType = json["contentType"],
63
+        createDate = json["createDate"],
64
+        extId = json["extId"],
65
+        sort = json["sort"],
66
+        targetId = json["targetId"],
67
+        targetType = json["targetType;"];
68
+
69
+  Map<String, dynamic> toJson() => {
70
+        'content': content,
71
+        'contentType': contentType,
72
+        'createDate': createDate,
73
+        'extId': extId,
74
+        'sort': sort,
75
+        'targetId': targetId,
76
+        'targetType': targetType,
77
+      };
78
+}

+ 28
- 0
lib/models/entities/banner.dart Parādīt failu

@@ -0,0 +1,28 @@
1
+class banner {
2
+  String? bannerId;
3
+  String? title;
4
+  String? thumb;
5
+  String? position;
6
+  num? sortNo;
7
+  num? status;
8
+  String? createDat;
9
+  banner();
10
+
11
+  banner.fromJson(Map<String, dynamic> json)
12
+      : bannerId = json["bannerId"],
13
+        title = json["title"],
14
+        thumb = json["thumb"],
15
+        position = json["position"],
16
+        sortNo = json["sortNo"],
17
+        status = json["status"],
18
+        createDat = json["createDat"];
19
+  Map<String, dynamic> toJson() => {
20
+        "bannerId": bannerId,
21
+        "title": title,
22
+        "thumb": thumb,
23
+        "position": position,
24
+        "sortNo": sortNo,
25
+        "status": status,
26
+        "createDat": createDat,
27
+      };
28
+}

+ 21
- 17
lib/models/entities/person.dart Parādīt failu

@@ -1,17 +1,18 @@
1
-
2 1
 class Person {
3 2
   String? personId;
4 3
   String? appId;
5 4
   String? openid;
6 5
   String? nickName;
7 6
   String? avatar;
8
-  int? sex;
7
+  num? sex;
9 8
   String? phone;
10 9
   String? userId;
11
-  int? status;
10
+  num? status;
12 11
   String? createDate;
12
+  String? identity;
13
+  String? isOrgManager;
13 14
 
14
-  Person ();
15
+  Person();
15 16
 
16 17
   Person.fromJson(Map<String, dynamic> json)
17 18
       : personId = json["personId"],
@@ -23,20 +24,23 @@ class Person {
23 24
         phone = json["phone"],
24 25
         userId = json["userId"],
25 26
         status = json["status"],
26
-        createDate = json["createDate"];
27
+        createDate = json["createDate"],
28
+        isOrgManager = json["isOrgManager"],
29
+        identity = json["identity"];
27 30
 
28 31
   Map<String, dynamic> toJson() => {
29
-    'personId' : personId,
30
-    'appId' : appId,
31
-    'openid' : openid,
32
-    'nickName' : nickName,
33
-    'avatar' : avatar,
34
-    'sex' : sex,
35
-    'phone' : phone,
36
-    'userId' : userId,
37
-    'status' : status,
38
-    'createDate' : createDate,
32
+        'personId': personId,
33
+        'appId': appId,
34
+        'openid': openid,
35
+        'nickName': nickName,
36
+        'avatar': avatar,
37
+        'sex': sex,
38
+        'phone': phone,
39
+        'userId': userId,
40
+        'status': status,
41
+        'createDate': createDate,
42
+        'isOrgManager': isOrgManager,
43
+         'identity': identity,
44
+
39 45
   };
40 46
 }
41
-
42
-

+ 73
- 35
lib/pages/ArticleInfo/ArticleInfo.dart Parādīt failu

@@ -1,52 +1,90 @@
1
+import 'package:farmer_client/services/news.dart';
1 2
 import 'package:flutter/material.dart';
2 3
 import 'package:flutter_screenutil/flutter_screenutil.dart';
4
+import 'package:get/get.dart';
5
+import 'package:get/get_core/src/get_main.dart';
3 6
 
7
+import '../../models/entities/NewsInformationInfoTextModel.dart';
8
+import '../../models/entities/NewsInformationModel.dart';
4 9
 import '../../widgets/layout/BasicPage.dart';
5 10
 
6 11
 class ArticleInfo extends BasicPage {
12
+  String newsId = '';
13
+  final newsInfoContent = Rx<NewsInformationInfoTextModel>(NewsInformationInfoTextModel());
14
+  final newsList = Rx<List<ExtendContent>>([]);
7 15
 
8 16
   @override
9
-  Widget builder(BuildContext context) {
10
-    naviTitle='资讯详情';
11
-    return  Container(
12
-          padding: EdgeInsets.fromLTRB(15, 30, 15, 50),
17
+  void beforeShow() {
18
+    // TODO: implement beforeShow
19
+    super.beforeShow();
20
+    if (Get.arguments['newsId'] != null) {
21
+      newsId = Get.arguments['newsId'];
22
+
23
+      getNewsInfo(newsId).then((value) {
24
+        newsInfoContent.value = NewsInformationInfoTextModel.fromJson(value);
25
+        newsList.value =  newsInfoContent.value.contentList!;
13 26
 
14
-          child: Column(
15
-            children: [
16
-              Container(
17
-                alignment: Alignment.center,
18
-                child:  Row(
19
-                  mainAxisAlignment: MainAxisAlignment.center,
20
-                  children: [
21
-                    Image(image: AssetImage('images/icons/decorate.png'),width: 17,),
22
-                    Text('我是22222222222标题',
23
-                    style: TextStyle(
24
-                      fontSize: 17.sp,
25
-                      fontWeight: FontWeight.bold,
27
+      });
26 28
 
27
-                    ),
28
-                    ),
29
-                    Image(image: AssetImage('images/icons/decorate.png'),width: 17),
29
+    }
30
+  }
30 31
 
31
-                  ],
32
+  @override
33
+  Widget builder(BuildContext context) {
34
+    naviTitle = '资讯详情';
35
+    return Container(
36
+      padding: EdgeInsets.fromLTRB(15, 30, 15, 50),
37
+      child: Column(
38
+        children: [
39
+          Container(
40
+            alignment: Alignment.center,
41
+            child: Row(
42
+              mainAxisAlignment: MainAxisAlignment.center,
43
+              children: [
44
+                Image(
45
+                  image: AssetImage('images/icons/decorate.png'),
46
+                  width: 17,
32 47
                 ),
33
-              ),
34
-              Container(
35
-                padding: EdgeInsets.fromLTRB(0, 20, 0, 10),
36
-                width: 344.w,
37
-                child: Text('gr一年之计在于春,连日来,农业生产工作正在热火朝天的进行着:农技人员走村串户指导农户春耕生产,大型拖拉机忙着翻垦农田,植保无人机 ',
38
-                style: TextStyle(
39
-                  fontSize: 14.sp
48
+                Obx(()=>
49
+                    Text(
50
+                      newsInfoContent.value.title.toString(),
51
+                      style: TextStyle(
52
+                        fontSize: 17.sp,
53
+                        fontWeight: FontWeight.bold,
54
+                      ),
55
+                    )
40 56
                 ),
41
-                ) ,
42
-              ),
43
-              Container(
44
-                padding: EdgeInsets.fromLTRB(0, 10, 0,10),
45
-                child: Image(image: AssetImage('images/cars.png'),width:320.w,height:260.w,fit: BoxFit.fill,),
46
-              )
47
-            ],
57
+                Image(
58
+                    image: AssetImage('images/icons/decorate.png'), width: 17),
59
+              ],
60
+            ),
48 61
           ),
62
+          Obx(() => Column(
63
+                children:  newsList.value.map((item) {
64
+                  if (item.contentType != 'image') {
65
+                    return Container(
66
+                      padding: EdgeInsets.fromLTRB(0, 20, 0, 10),
67
+                      width: 344.w,
68
+                      child: Text(
69
+                        item.content.toString(),
70
+                        style: TextStyle(fontSize: 14.sp),
71
+                      ),
72
+                    );
73
+                  } else {
74
+                    return Container(
75
+                      padding: EdgeInsets.fromLTRB(0, 10, 0, 10),
76
+                      child: Image(
77
+                        image: NetworkImage(item.content.toString()),
78
+                        width: 320.w,
79
+                        height: 260.w,
80
+                        fit: BoxFit.fill,
81
+                      ),
82
+                    );
83
+                  }
84
+                }).toList(),
85
+              )),
86
+        ],
87
+      ),
49 88
     );
50
-
51 89
   }
52 90
 }

+ 62
- 0
lib/pages/Information/ArticleInfo.dart Parādīt failu

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

+ 141
- 0
lib/pages/Information/index.dart Parādīt failu

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

+ 77
- 16
lib/pages/OrderConfirmation/index.dart Parādīt failu

@@ -1,18 +1,79 @@
1 1
 import 'package:farmer_client/models/addressController.dart';
2
+import 'package:farmer_client/models/entities/CardInfo.dart';
2 3
 import 'package:farmer_client/widgets/layout/BasicPage.dart';
3 4
 import 'package:flutter/material.dart';
4 5
 import 'package:flutter/services.dart';
5 6
 import 'package:flutter_screenutil/flutter_screenutil.dart';
7
+import 'package:fluttertoast/fluttertoast.dart';
6 8
 import 'package:get/get.dart';
7 9
 import 'package:intl/intl.dart';
8 10
 
11
+import '../../models/entities/CardListModel.dart';
12
+import '../../models/entities/OrderInfoModel.dart';
13
+import '../../services/homeAPI.dart';
14
+import '../../services/orderAPI.dart';
15
+
9 16
 class OrderConfirmation extends BasicPage {
10 17
   TextEditingController _unameController = TextEditingController();
11 18
   GlobalKey _formKey = GlobalKey<FormState>();
12
-
19
+  String markId = '';
13 20
   final selectDate = Rx<DateTime>(DateTime.now()); //选择的时间
14
-  final workingArea = Rxn(0);
21
+  final workingArea = Rx<int>(0);
15 22
   AddressController addressController = AddressController.t;
23
+  final item = Rx<CardInfo>(CardInfo());//全部详情
24
+  final orderInfo = Rx<OrderInfoModel>(OrderInfoModel());//全部详情
25
+
26
+  @override
27
+  void beforeShow() {
28
+    // TODO: implement beforeShow
29
+    super.beforeShow();
30
+    if(Get.arguments['item']!=null){
31
+      item(Get.arguments['item']);
32
+    }else{
33
+      markId=Get.arguments['id'];
34
+      getMachineryInfo(markId, '122.08400000000002,37.421998333333335', true).then((value) {
35
+        item(CardInfo.fromJson(value));
36
+
37
+      });
38
+
39
+      // item(CardInfo.fromJson(Get.arguments['item']));
40
+
41
+      return;
42
+    }
43
+  }
44
+
45
+
46
+  Map<String, dynamic> data = {
47
+
48
+  };
49
+
50
+  void _orderSubmit (){
51
+
52
+    if ((_formKey.currentState as FormState).validate()) {
53
+          data = {
54
+        'charges': item.value.price! * workingArea.value,
55
+        'price':  item.value.price,
56
+        'amount': workingArea.value,
57
+        'machineryId':  item.value.machineryId,
58
+        'machineryName':  item.value.name,
59
+        'machineryType':  item.value.typeId,
60
+        'typeName':  item.value.typeName,
61
+        'address': addressController.address.value.address,
62
+        'orgId':  item.value.orgId,
63
+        'appointmentDate': '${DateFormat("yyyy-MM-dd").format(selectDate.value)} 08:00:00',
64
+      };
65
+      generateOrder(data).then((value) {
66
+        orderInfo(OrderInfoModel.fromJson(value));
67
+        Fluttertoast.showToast(
68
+            msg: '预约成功'
69
+        );
70
+        Get.offNamed('/orderPageInfo',arguments: {'id':orderInfo().orderId});
71
+
72
+      });
73
+      //验证通过提交数据
74
+    }
75
+
76
+  }
16 77
 
17 78
   @override
18 79
   Widget builder(BuildContext context) {
@@ -36,7 +97,7 @@ class OrderConfirmation extends BasicPage {
36 97
               ),
37 98
             ),
38 99
             TextFormField(
39
-              // autofocus: true,
100
+              autofocus: false,
40 101
               keyboardType: TextInputType.number,
41 102
               controller: _unameController,
42 103
               decoration: const InputDecoration(
@@ -56,7 +117,7 @@ class OrderConfirmation extends BasicPage {
56 117
                 hintText: "请输入具体面积(公顷)",
57 118
               ),
58 119
               onChanged: (e) {
59
-                workingArea.value = e as int?;
120
+                workingArea(int.parse(e));
60 121
               },
61 122
               // 校验用户名
62 123
               validator: (v) {
@@ -100,18 +161,21 @@ class OrderConfirmation extends BasicPage {
100 161
                             helpText: '请选择作业开始时间',
101 162
                             cancelText: '取消',
102 163
                             confirmText: '确定',
103
-                            initialDate: selectDate.value == null
164
+                            initialDate: selectDate() == null
104 165
                                 ? DateTime.now()
105
-                                : selectDate.value,
166
+                                : selectDate(),
106 167
                             firstDate: DateTime.now(),
107 168
                             lastDate: DateTime(2030),
108 169
                           );
109
-                          selectDate.value = handleChnage!;
170
+                          selectDate(handleChnage!);
110 171
                           print('${selectDate}+');
111 172
                         },
112
-                        child: Text(selectDate == null
113
-                            ? '请选择日期'
114
-                            : '${DateFormat("yyyy-MM-dd").format(selectDate.value)}'),
173
+                        child: Obx(()=>
174
+                            Text(selectDate == null
175
+                                ? '请选择日期'
176
+                                : '${DateFormat("yyyy-MM-dd").format(selectDate())}'),
177
+                        )
178
+
115 179
                       ),
116 180
                     )
117 181
                   ],
@@ -175,12 +239,9 @@ class OrderConfirmation extends BasicPage {
175 239
                 height: 49.h,
176 240
                 child: ElevatedButton(
177 241
                   onPressed: () {
178
-                    if ((_formKey.currentState as FormState).validate()) {
179
-                      var a = {selectDate, workingArea};
180
-                      print('我确定了$a');
181
-                      //验证通过提交数据
182
-                      Get.toNamed('/orderPageInfo');
183
-                    }
242
+                    _orderSubmit();
243
+
244
+
184 245
                   },
185 246
                   child: const Text(
186 247
                     "确定",

+ 21
- 6
lib/pages/addAddress/index.dart Parādīt failu

@@ -1,4 +1,5 @@
1 1
 import 'package:farmer_client/models/entities/Address.dart';
2
+import 'package:farmer_client/services/address.dart';
2 3
 import 'package:farmer_client/widgets/DefaultButton.dart';
3 4
 import 'package:farmer_client/widgets/layout/BasicPage.dart';
4 5
 import 'package:flutter/material.dart';
@@ -10,13 +11,16 @@ class AddAddress extends BasicPage {
10 11
 
11 12
   final address =Rx<Address>(Address());
12 13
   late String text = '';
14
+  late String id = '';
13 15
 
14 16
   @override
15 17
   void beforeShow() {
16 18
     super.beforeShow();
17 19
     if (Get.arguments != null) {
18
-      address.value = Get.arguments['item'];
19
-      text = address.value.address.toString();
20
+      print( Get.arguments['item']);
21
+      // address(Get.arguments['item']);
22
+      text = Get.arguments['item'];
23
+      id = Get.arguments['id'];
20 24
     }
21 25
   }
22 26
 
@@ -58,7 +62,7 @@ class AddAddress extends BasicPage {
58 62
                 floatingLabelBehavior: FloatingLabelBehavior.never,
59 63
               ),
60 64
               onChanged: (e) {
61
-                  address.value.address = e;
65
+                  address().address=e;
62 66
               },
63 67
             ),
64 68
           ),
@@ -73,9 +77,20 @@ class AddAddress extends BasicPage {
73 77
                 Fluttertoast.showToast(
74 78
                     msg: '请输入地址!');
75 79
               } else{
76
-                Fluttertoast.showToast(
77
-                    msg: '保存成功!');
78
-                Get.back();
80
+                if(text==''){
81
+                  addressSave(address().address.toString()).then((value){
82
+                    Fluttertoast.showToast(
83
+                        msg: '添加地址成功!');
84
+                    Get.back();
85
+                  });
86
+
87
+                }else{
88
+                  addressUpdate(id,address().address.toString()).then((value) {
89
+                    Fluttertoast.showToast(
90
+                        msg: '修改地址成功!');
91
+                    Get.back();
92
+                  });
93
+                }
79 94
               }
80 95
             },
81 96
             margin: const EdgeInsets.all(0),

+ 42
- 19
lib/pages/addressList/index.dart Parādīt failu

@@ -8,35 +8,56 @@ import 'package:flutter_screenutil/flutter_screenutil.dart';
8 8
 import 'package:fluttertoast/fluttertoast.dart';
9 9
 import 'package:get/get.dart';
10 10
 
11
+import '../../services/address.dart';
12
+
11 13
 class AddressList extends BasicPage {
12 14
   bool isBack = false;
13 15
   AddressController addressController=AddressController.t;
16
+  final addressList = Rx<List<Address>>([]);
17
+
14 18
 
15 19
   @override
16 20
   void beforeShow() {
17 21
     super.beforeShow();
22
+    getAddress().then((value) {
23
+      final list = <Address>[];
24
+      value['records'].forEach((item) {
25
+        list.add(Address.fromJson(item));
26
+      });
27
+      addressList(list);
28
+    });
18 29
     if (Get.arguments != null) {
19 30
       isBack = Get.arguments['isBack'];
20 31
     }
21 32
   }
22 33
 
23
-  final addressList = Rx<List<Address>>([
24
-    Address.fromJson({'address': '777', 'isDefault': false}),
25
-    Address.fromJson({'address': '999', 'isDefault': false}),
26
-    Address.fromJson({'address': '这是一个正经的地址', 'isDefault': false}),
27
-  ]);
28 34
 
29
-  void onChange(index) {
30
-    for (var element in addressList.value) {
31
-      if (element.isDefault == true) {
32
-        element.isDefault = false;
35
+  void onChange(id) {
36
+    print(id);
37
+    addressDefault(id.toString()).then((value){
38
+      final defaultlist = [...addressList()];
39
+      for (var element in addressList()) {
40
+        if (element.isDefault == true) {
41
+          element.isDefault = false;
42
+        }
33 43
       }
34
-    }
35
-    addressList.value[index].isDefault = true;
44
+      addressList(defaultlist);
45
+    });
46
+
36 47
   }
48
+  void onDelete(id) {
49
+    print(id);
37 50
 
38
-  void onDelete(index) {
39
-    Fluttertoast.showToast(msg: '删除成功!');
51
+    addressDelete(id).then((value) {
52
+      final newslist = [...addressList()];
53
+      for (var item in addressList()) {
54
+        if (item.addressId == id) {
55
+          newslist.remove(item);
56
+        }
57
+      }
58
+      addressList(newslist);
59
+      Fluttertoast.showToast(msg: '删除成功!');
60
+    });
40 61
   }
41 62
 
42 63
   @override
@@ -50,8 +71,8 @@ class AddressList extends BasicPage {
50 71
             //左对齐
51 72
             crossAxisAlignment: CrossAxisAlignment.start,
52 73
             children: [
53
-              Column(
54
-                  children: addressList.value
74
+              Obx(()=>Column(
75
+                  children: addressList()
55 76
                       .asMap()
56 77
                       .keys
57 78
                       .map(
@@ -60,22 +81,23 @@ class AddressList extends BasicPage {
60 81
                           item: addressList.value[e],
61 82
                           isBack: isBack,
62 83
                           onChange: () {
63
-                            onChange(e);
84
+                            onChange(addressList()[e].addressId);
64 85
                           },
65 86
                           onEdit: () {
66 87
                             Get.toNamed('/addAddress',
67
-                                arguments: {'item': addressList.value[e]});
88
+                                arguments: {'id':addressList.value[e].addressId,'item': addressList.value[e].address.toString()});
68 89
                           },
69 90
                           onDelete: () {
70
-                            onDelete(e);
91
+                            onDelete(addressList.value[e].addressId);
71 92
                           },
72 93
                           onBack: () {
94
+                            //选择地址
73 95
                             addressController.address.value=addressList.value[e];
74 96
                             Get.back();
75 97
                           },
76 98
                         ),
77 99
                       )
78
-                      .toList()),
100
+                      .toList()),),
79 101
               DefaultButton(
80 102
                 color: const Color(0xffffffff),
81 103
                 backColor: const Color(0xFFFF703B),
@@ -96,3 +118,4 @@ class AddressList extends BasicPage {
96 118
     );
97 119
   }
98 120
 }
121
+

+ 15
- 4
lib/pages/feedback/index.dart Parādīt failu

@@ -5,6 +5,8 @@ import 'package:flutter_screenutil/flutter_screenutil.dart';
5 5
 import 'package:fluttertoast/fluttertoast.dart';
6 6
 import 'package:get/get.dart';
7 7
 
8
+import '../../services/main.dart';
9
+
8 10
 class Feedback extends BasicPage {
9 11
   final text=Rx<String>('');
10 12
   final isEdit=Rx<bool>(false);
@@ -45,7 +47,11 @@ class Feedback extends BasicPage {
45 47
               },
46 48
             ),
47 49
           ),
48
-          if(!isEdit.value) Positioned(
50
+          Obx(()=>
51
+          Visibility(
52
+          visible:!isEdit(),
53
+            child:
54
+          Positioned(
49 55
             left: 20.w,
50 56
             top: 5.w,
51 57
             child: Row(
@@ -64,6 +70,8 @@ class Feedback extends BasicPage {
64 70
               ],
65 71
             ),
66 72
           ),
73
+          ),
74
+          ),
67 75
           Positioned(
68 76
             bottom: 25.h,
69 77
             child: DefaultButton(
@@ -73,11 +81,14 @@ class Feedback extends BasicPage {
73 81
               height: 49.h,
74 82
               text: '提交',
75 83
               onPressed: () {
76
-                if (text.value == '') {
84
+                if (text() == '') {
77 85
                   Fluttertoast.showToast(msg: '请输入内容哦');
78 86
                 } else {
79
-                  Fluttertoast.showToast(msg: '提交成功!');
80
-                  Get.back();
87
+                  feedback(text()).then((value) {
88
+                    Fluttertoast.showToast(msg: '提交成功!');
89
+                    Get.back();
90
+                  });
91
+
81 92
                 }
82 93
               },
83 94
               margin: const EdgeInsets.all(0),

+ 1
- 0
lib/pages/home.dart Parādīt failu

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

+ 1
- 4
lib/pages/home/index.dart Parādīt failu

@@ -1,11 +1,9 @@
1 1
 import 'package:farmer_client/widgets/Modal.dart' as modal;
2 2
 import 'package:farmer_client/widgets/layout/BasicPage.dart';
3 3
 import 'package:flutter/material.dart';
4
-import 'package:get/get.dart';
5 4
 import '../../utils/timer.dart';
6 5
 import './widgets/home/index.dart';
7 6
 
8
-
9 7
 class Home extends BasicPage {
10 8
   Home({Key? key}) : super(key: key) {
11 9
     tabIndex = 0;
@@ -14,7 +12,6 @@ class Home extends BasicPage {
14 12
 
15 13
   @override
16 14
   Widget builder(BuildContext context) {
17
-
18 15
     setTimeout(() {
19 16
       // showDialog(context: Get.overlayContext!, builder: (BuildContext c) {
20 17
       //   return Modal(type: 'dialog', title: '测试', message: '这是一段 message !', onConfirm: () => print('hahahaha'),);
@@ -22,7 +19,7 @@ class Home extends BasicPage {
22 19
       // Get.dialog(Modal(type: 'dialog', title: '测试', message: '这是一段 message !', onConfirm: () => print('hahahaha'),));
23 20
       // modal.showDialog(title: '测试', content: SizedBox(width: 400, height: 300,), onConfirm: () => false);
24 21
     }, 2000);
25
-    
22
+
26 23
     return const HomePage();
27 24
   }
28 25
 }

+ 8
- 5
lib/pages/home/widgets/home/index.dart Parādīt failu

@@ -4,7 +4,9 @@ import 'package:farmer_client/widgets/NullCard.dart';
4 4
 import 'package:flutter/material.dart';
5 5
 import 'package:flutter_screenutil/flutter_screenutil.dart';
6 6
 import 'package:get/get.dart';
7
+import '../../../../models/app.dart';
7 8
 import '../../../../models/entities/CardInfo.dart';
9
+import '../../../../models/entities/CardListModel.dart';
8 10
 import '../../../../services/homeAPI.dart';
9 11
 import '../../../../widgets/CarsCard.dart';
10 12
 import 'package:farmer_client/models/entities/Banners.dart';
@@ -23,13 +25,14 @@ class _HomePageState extends State<HomePage> {
23 25
   final CarouselController _controller = CarouselController();
24 26
   List<Banners> bannerList = [];
25 27
 
26
-  List<CardInfo> machineryLists = [];
28
+  List<CardListModel> machineryLists = [];
27 29
 
28 30
   @override
29 31
   void initState() {
30 32
     super.initState();
31
-    // final location = AppController.t.location;
32
-    // print('location+$location');
33
+   //  final location = AppController.t.location;
34
+   // final long=   location.value!['longitude'].toString() + "," + location.value!['latitude'].toString();
35
+   //  print('location+$location,lolongglongng+$long');
33 36
 
34 37
     getHomeBanner('banner').then((value) {
35 38
       setState(() {
@@ -39,10 +42,10 @@ class _HomePageState extends State<HomePage> {
39 42
       });
40 43
     });
41 44
 
42
-    getMachinery('112.087433,32.687692').then((value) {
45
+    getMachinery('122.08400000000002,37.421998333333335').then((value) {
43 46
       setState(() {
44 47
         value['records'].forEach((item) {
45
-          machineryLists.add(CardInfo.fromJson(item));
48
+          machineryLists.add(CardListModel.fromJson(item));
46 49
         });
47 50
       });
48 51
     });

+ 26
- 7
lib/pages/infomation/index.dart Parādīt failu

@@ -1,37 +1,56 @@
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:get/get_rx/src/rx_types/rx_types.dart';
5
+import 'package:get/get_state_manager/get_state_manager.dart';
4 6
 
5 7
 import '../../models/entities/NewsInformationModel.dart';
6 8
 import '../../services/news.dart';
7 9
 
8 10
 class Infomation extends BasicPage {
11
+  // List<NewsInformationModel> newsListItem=[];
12
+
9 13
   Infomation({Key? key}) : super(key: key) {
10 14
     tabIndex = 2;
11 15
     naviTitle = '资讯';
12 16
   }
13
-  List<NewsInformationModel> newsListItem = [];
14 17
 
18
+  final newsListItem = Rx<List<NewsInformationModel>>([]);
15 19
 
16 20
 @override
17 21
   void beforeShow() {
22
+
18 23
     // TODO: implement beforeShow
19 24
     super.beforeShow();
20 25
   getNewsList().then((value) {
26
+    final list = <NewsInformationModel>[];
27
+
21 28
      value['records'].forEach((item) {
22
-       newsListItem.add(NewsInformationModel.fromJson(item));
23
-      });
24
-  });
29
+       list.add(NewsInformationModel.fromJson(item));
30
+       print('newsListItem');
31
+
32
+       print(newsListItem.value);
25 33
 
34
+     });
35
+    newsListItem.value=list;
36
+
37
+  });
26 38
 }
27 39
 
28 40
   @override
29 41
   Widget builder(BuildContext context) {
30 42
 
43
+    return Container(
44
+        child:
45
+            Obx(()=>
46
+          Column(
47
+            mainAxisSize: MainAxisSize.min,
48
+            children:newsListItem.value.map((item) => Information(item: item,)).toList(),
49
+          )
31 50
 
32
-    return  Column(
33
-      mainAxisSize: MainAxisSize.min,
34
-      children: newsListItem.map((item) => Information(item: item)).toList(),
51
+            )
35 52
     );
53
+
54
+
36 55
   }
37 56
 }

+ 60
- 54
lib/pages/infomation/widgets/Information/index.dart Parādīt failu

@@ -13,71 +13,77 @@ class Information extends StatefulWidget {
13 13
   const Information({Key? key, required this.item}) : super(key: key);
14 14
 
15 15
   @override
16
-  State<Information> createState() => _InformationState();
17
-
16
+  State<Information> createState() => _InformationState(item);
18 17
   // getNewsList
19 18
 }
20 19
 
21 20
 class _InformationState extends State<Information> {
22
-  late final NewsInformationModel item;
21
+  final NewsInformationModel item;
22
+
23
+
24
+  _InformationState(this.item);
23 25
 
24 26
 
25 27
   @override
26 28
   Widget build(BuildContext context) {
27
-    return Column(
28
-      children: [
29
-        // ListTile用不好
30
-        GestureDetector(
31
-          child: Container(
32
-              padding: EdgeInsets.fromLTRB(0, 30, 0, 30),
33
-              decoration: const BoxDecoration(
34
-                  border: Border(
35
-                      bottom: BorderSide(width: 0.5, color: Color(0x20000000)
29
+    return Container(
30
+      child:   Column(
31
+        children: [
32
+          // ListTile用不好
33
+          GestureDetector(
34
+            child: Container(
35
+                padding: EdgeInsets.fromLTRB(0, 30, 0, 30),
36
+                decoration: const BoxDecoration(
37
+                    border: Border(
38
+                        bottom: BorderSide(width: 0.5, color: Color(0x20000000)
36 39
                           // 0x17000000
37
-                          ))),
38
-              child: Row(
39
-                children: [
40
-                  Container(
41
-                    margin: EdgeInsets.fromLTRB(15, 0, 11, 0),
42
-                    width: 100,
43
-                    height: 100,
44
-                    decoration: BoxDecoration(
45
-                      image: DecorationImage(
46
-                        image: AssetImage('images/cars.png'),
47
-                        fit: BoxFit.cover,
40
+                        ))),
41
+                child: Row(
42
+                  children: [
43
+                    Container(
44
+                      margin: EdgeInsets.fromLTRB(15, 0, 11, 0),
45
+                      width: 100,
46
+                      height: 100,
47
+                      decoration: BoxDecoration(
48
+                        image: DecorationImage(
49
+                          image: NetworkImage(item.thumb.toString()),
50
+                          fit: BoxFit.cover,
51
+                        ),
52
+                        borderRadius: BorderRadius.circular(12),
48 53
                       ),
49
-                      borderRadius: BorderRadius.circular(12),
50 54
                     ),
51
-                  ),
52
-                  Column(
53
-                    crossAxisAlignment: CrossAxisAlignment.start,
54
-                    children: [
55
-                      Container(
56
-                        width: 240.w,
57
-                        padding: EdgeInsets.fromLTRB(0, 0, 0, 30),
58
-                        child: Text('',
59
-                            softWrap: true,
60
-                            maxLines: 2,
61
-                            textAlign: TextAlign.left,
62
-                            overflow: TextOverflow.ellipsis,
63
-                            style: TextStyle(
64
-                              fontSize: 17.sp,
65
-                              fontWeight: FontWeight.bold,
66
-                            )),
67
-                      ),
68
-                      Container(
69
-
70
-                        child: Text(''),
71
-                      )
72
-                    ],
73
-                  )
74
-                ],
75
-              )),
76
-          onTap: () {
77
-            Get.to(ArticleInfo());
78
-          },
79
-        ),
80
-      ],
55
+                    Column(
56
+                      crossAxisAlignment: CrossAxisAlignment.start,
57
+                      children: [
58
+                        Container(
59
+                          width: 240.w,
60
+                          padding: EdgeInsets.fromLTRB(0, 0, 0, 30),
61
+                          child: Text(item.title!.toString(),
62
+                              softWrap: true,
63
+                              maxLines: 2,
64
+                              textAlign: TextAlign.left,
65
+                              overflow: TextOverflow.ellipsis,
66
+                              style: TextStyle(
67
+                                fontSize: 17.sp,
68
+                                fontWeight: FontWeight.bold,
69
+                              )),
70
+                        ),
71
+                        Container(
72
+                          child: Text(
73
+                              item.createDate!=null? DateFormat("yyyy-MM-dd").format(DateTime.parse(item.createDate.toString())):item.createDate.toString(),),
74
+                        )
75
+                      ],
76
+                    )
77
+                  ],
78
+                )),
79
+            onTap: () {
80
+              Get.to(ArticleInfo(),arguments: {'newsId':item.newsId});
81
+            },
82
+          ),
83
+        ],
84
+      ),
81 85
     );
86
+
87
+
82 88
   }
83 89
 }

+ 1
- 1
lib/pages/login/login.dart Parādīt failu

@@ -100,7 +100,7 @@ class _RouteLogin extends State<MyRouteLogin> {
100 100
       if (_newValue) {
101 101
         userLogin(handlePhones, handleCodes).then((value) {
102 102
           userInfo(Person.fromJson(value['person']));
103
-          print('已同意协议');
103
+
104 104
 
105 105
           Get.off(Home());
106 106
         });

+ 22
- 4
lib/pages/machinery/detail/index.dart Parādīt failu

@@ -1,19 +1,38 @@
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 4
 import 'package:get/get.dart';
5
+import '../../../services/homeAPI.dart';
5 6
 import 'widgets/detail.dart';
6 7
 
7 8
 class MachineryDetailPage extends BasicPage {
9
+  String markId = '';
10
+  String marKm = '';
11
+  final machineryInfoContent = Rx<CardInfo>(CardInfo());//全部详情
12
+  final machineryListBanner = Rx<List<BannerImageList>>([]);//banner轮播
13
+  final machineryListContent= Rx<List<ContentImageList>>([]);//图文详情
8 14
   // 响应预约事件
9 15
   void handleClick() {
10
-    Get.toNamed('/orderConfirmation');
16
+    Get.toNamed('/orderConfirmation',arguments: {'item':machineryInfoContent()});
11 17
   }
12 18
 
19
+
13 20
   @override
14 21
   void beforeShow() {
15 22
     // TODO: implement onMounted
16 23
     super.beforeShow();
24
+    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) {
29
+        machineryInfoContent(CardInfo.fromJson(value));
30
+        machineryListBanner(machineryInfoContent().imagesList!);
31
+        machineryListContent(machineryInfoContent().contentList!);
32
+
33
+      });
34
+
35
+    }
17 36
     print("----show----detail page--------------");
18 37
   }
19 38
 
@@ -27,7 +46,6 @@ class MachineryDetailPage extends BasicPage {
27 46
   @override
28 47
   Widget builder(BuildContext context) {
29 48
     naviTitle = "查看详情";
30
-    return page(context: context, handleClick: handleClick);
49
+    return Obx(()=>page(context: context, handleClick: handleClick,km:marKm,item:machineryInfoContent.value,bnnerItem:machineryListBanner.value,contentItem:machineryListContent.value));
31 50
   }
32
-
33 51
 }

+ 25
- 16
lib/pages/machinery/detail/widgets/detail.dart Parādīt failu

@@ -1,4 +1,5 @@
1 1
 
2
+import 'package:carousel_slider/carousel_slider.dart';
2 3
 import 'package:farmer_client/pages/machinery/widgets/DefLayout.dart';
3 4
 import 'package:farmer_client/pages/machinery/widgets/RoundButton.dart';
4 5
 import 'package:flutter/widgets.dart';
@@ -6,39 +7,47 @@ import 'package:flutter/material.dart';
6 7
 import 'package:flutter_screenutil/flutter_screenutil.dart';
7 8
 import 'package:farmer_client/widgets/ExtendContentList.dart';
8 9
 import 'package:farmer_client/models/entities/ExtendContent.dart';
10
+import 'package:get/get.dart';
11
+import '../../../../models/entities/CardInfo.dart';
9 12
 import '../../widgets/summary.dart';
10 13
 
11
-Widget page({ required BuildContext context, VoidCallback? handleClick}) {
12
-  final img = 'https://yz-websit.oss-cn-hangzhou.aliyuncs.com/xlk/index-icon19.jpg';
14
+Widget page({ required BuildContext context, VoidCallback? handleClick,required String km,required CardInfo item,required List<BannerImageList> bnnerItem,required List<ContentImageList> contentItem}) {
13 15
 
14
-  final list = <ExtendContent>[
15
-    ExtendContent.simple(content: img, contentType: "image" ),
16
-    ExtendContent.simple(content: "有时,你可能想要创建一个水平滑动(而不是竖直滑动)的列表。 ListView widget 本身就支持水平列表的创建。我们将会使用标准的 ListView 构造方法,通过指定 scrollDirection 的值为水平方向,来覆盖默认的竖直方向。", contentType: "text" ),
17
-    ExtendContent.simple(content: img, contentType: "image" ),
18
-    ExtendContent.simple(content: "有时,你可能想要创建一个水平滑动(而不是竖直滑动)的列表。 ListView widget 本身就支持水平列表的创建。我们将会使用标准的 ListView 构造方法,通过指定 scrollDirection 的值为水平方向,来覆盖默认的竖直方向。", contentType: "text" ),
19
-    ExtendContent.simple(content: img, contentType: "image" ),
20
-    ExtendContent.simple(content: "有时,你可能想要创建一个水平滑动(而不是竖直滑动)的列表。 ListView widget 本身就支持水平列表的创建。我们将会使用标准的 ListView 构造方法,通过指定 scrollDirection 的值为水平方向,来覆盖默认的竖直方向。", contentType: "text" ),
21
-    ExtendContent.simple(content: img, contentType: "image" ),
22
-  ];
23 16
 
24 17
   return DefLayout(
25
-      head: Image.network(img, fit: BoxFit.cover),
18
+      head: CarouselSlider(
19
+        items: bnnerItem
20
+            .map((item) => Container(
21
+          child: Center(
22
+              child: Image.network(item.url.toString(),
23
+                  fit: BoxFit.fitWidth, width: 370.w)),
24
+        ))
25
+            .toList(),
26
+        options: CarouselOptions(
27
+          autoPlay: true,
28
+          enlargeCenterPage: false, //图片中心放大
29
+          viewportFraction: 1, //每个页面应占据的视口部分。默认为 0.8,这意味着每个页面填充 80% 的轮播。
30
+          // aspectRatio: 1.6,//纵横比
31
+          height: 214.w,
32
+          initialPage: 1, //初始页
33
+        ),
34
+      ),
26 35
       children: [
27 36
         DefLayout.card(
28 37
           top: DefLayout.headHeight - DefLayout.offset,
29 38
           padding: EdgeInsets.only(top: 45.w, left: 15.w, right: 15.w, bottom: 20.w),
30
-          child: _content(context, list, handleClick),
39
+          child: _content(context, handleClick,item,contentItem,km),
31 40
         )
32 41
       ]
33 42
   );
34 43
 }
35 44
 
36
-Widget _content(BuildContext context, List<ExtendContent> list, VoidCallback? handleClick) {
45
+Widget _content(BuildContext context, VoidCallback? handleClick, CardInfo item,List<ContentImageList> contentItem, String km) {
37 46
   return Column(
38 47
     children: [
39
-      summary(),
48
+     summary(item: item,km:km),
40 49
       _sectionHead('农机详情'),
41
-      ExtendContentList(list: list),
50
+      ExtendContentList(item: contentItem,),
42 51
       SizedBox(height: 20.w,),
43 52
       RoundButton(text: "预约", onPressed: handleClick,)
44 53
     ],

+ 20
- 3
lib/pages/machinery/map/index.dart Parādīt failu

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

+ 12
- 7
lib/pages/machinery/map/widgets/detail.dart Parādīt failu

@@ -7,16 +7,16 @@ import 'package:flutter_screenutil/flutter_screenutil.dart';
7 7
 import 'package:amap_flutter_base/amap_flutter_base.dart';
8 8
 import 'package:farmer_client/widgets/amap/amap.dart';
9 9
 
10
+import '../../../../models/entities/CardInfo.dart';
10 11
 import '../../widgets/summary.dart';
11 12
 
12
-Widget page({ required BuildContext context, VoidCallback? handleClick}) {
13
+Widget page({required CardInfo item,required String km, required BuildContext context, VoidCallback? handleClick}) {
13 14
   final _offset = 20.w;
14 15
   final width = MediaQuery.of(context).size.width;
15 16
   final mapHeight = 226.5.w;
16 17
   final cardHeight = 250.w;
17 18
 
18 19
 
19
-  final img = 'https://yz-websit.oss-cn-hangzhou.aliyuncs.com/xlk/index-icon19.jpg';
20 20
   final LatLng position = LatLng(32.690712, 112.091892);
21 21
 
22 22
   return DefLayout(
@@ -25,21 +25,26 @@ Widget page({ required BuildContext context, VoidCallback? handleClick}) {
25 25
         DefLayout.card(
26 26
             top: DefLayout.headHeight - DefLayout.offset,
27 27
             height: DefLayout.headHeight,
28
-            child: Image.network(img, fit: BoxFit.cover)
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
+            ),
29 33
         ),
30 34
         DefLayout.card(
31 35
             top: (DefLayout.headHeight - DefLayout.offset) * 2,
32 36
             padding: EdgeInsets.only(top: 45.w, left: 15.w, right: 15.w, bottom: 20.w),
33
-            child: _content(context, handleClick)
37
+            child: _content(context, handleClick,item,km)
34 38
         ),
35 39
       ]
36 40
   );
37 41
 }
38 42
 
39
-Widget _content(BuildContext context, VoidCallback? handleClick) {
40
-  return Column(
43
+Widget _content(BuildContext context, VoidCallback? handleClick,CardInfo item,String km) {
44
+  return
45
+    Column(
41 46
     children: [
42
-      summary(),
47
+      summary(item: item,km:km),
43 48
       RoundButton(text: "预约", onPressed: handleClick,),
44 49
     ],
45 50
   );

+ 1
- 1
lib/pages/machinery/widgets/DefLayout.dart Parādīt failu

@@ -8,7 +8,7 @@ class DefLayout extends StatelessWidget {
8 8
 
9 9
   DefLayout({Key? key, required this.head, required this.children}): super(key: key);
10 10
 
11
-  static double headHeight = 250.w;
11
+  static double headHeight = 214.w;
12 12
   static double offset = 20.w;
13 13
 
14 14
   static Widget card({required double top, required Widget child, double? height, EdgeInsetsGeometry? padding}) {

+ 15
- 11
lib/pages/machinery/widgets/summary.dart Parādīt failu

@@ -4,24 +4,28 @@ import 'package:flutter_screenutil/flutter_screenutil.dart';
4 4
 
5 5
 import 'package:farmer_client/widgets/LinearGradientText.dart';
6 6
 
7
-Widget summary() {
7
+import '../../../models/entities/CardInfo.dart';
8
+
9
+Widget summary({required CardInfo item,required String km}) {
10
+
8 11
   return Column(
9 12
     children: [
10
-      _title(),
13
+      _title(item: item),
11 14
       SizedBox(height: 20.w,),
12
-      _desc(),
15
+      _desc(item: item,km: km),
13 16
       SizedBox(height: 20.w,),
14
-      _detail(),
17
+      _detail(item: item),
15 18
       SizedBox(height: 20.w,),
16 19
     ],
17 20
   );
18 21
 }
19 22
 
20
-Widget _title() {
23
+Widget _title({required CardInfo item}) {
24
+
21 25
   return Row(
22 26
     children: [
23 27
       Expanded(
24
-          child: Text("收割机001--S001",
28
+          child: Text(item.name.toString(),
25 29
               style: TextStyle(
26 30
                 color: const Color(0xFF222222),
27 31
                 fontSize: 18.sp,
@@ -40,7 +44,7 @@ Widget _title() {
40 44
             text: TextSpan(
41 45
                 children: <InlineSpan>[
42 46
                   TextSpan(
43
-                      text: "450",
47
+                      text: ((item.price??0)/100).toString(),
44 48
                       style: TextStyle(
45 49
                         fontSize: 22.sp,
46 50
                         fontWeight: FontWeight.bold,
@@ -66,21 +70,21 @@ Widget _title() {
66 70
   );
67 71
 }
68 72
 
69
-Widget _desc() {
73
+Widget _desc({required CardInfo item,required String km}) {
70 74
   return Row(
71 75
     children: [
72 76
       Icon(Icons.location_on_outlined, size: 16.sp,),
73 77
       Expanded(
74 78
         flex: 1,
75
-        child: Text("距离当前位置2.3公里 >>", style: TextStyle(color: const Color(0xFF222222), fontSize: 15.sp),),
79
+        child: Text("距离当前位置$km >>", style: TextStyle(color: const Color(0xFF222222), fontSize: 15.sp),),
76 80
       ),
77 81
     ],
78 82
   );
79 83
 }
80 84
 
81
-Widget _detail() {
85
+Widget _detail({required CardInfo item}) {
82 86
   return Container(
83 87
     alignment: Alignment.centerLeft,
84
-    child: Text("农机手1的收割机", style: TextStyle(color: const Color(0xFF222222), fontSize: 15.sp),),
88
+    child: Text(item.orgName.toString(), style: TextStyle(color: const Color(0xFF222222), fontSize: 15.sp),),
85 89
   );
86 90
 }

+ 25
- 1
lib/pages/main/index.dart Parādīt failu

@@ -1,15 +1,39 @@
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:get/get.dart';
5
+import 'package:get/get_rx/src/rx_types/rx_types.dart';
6
+
7
+import '../../models/entities/Address.dart';
8
+import '../../services/address.dart';
4 9
 
5 10
 class Main extends BasicPage {
6 11
   Main({Key? key}) : super(key: key) {
7 12
     tabIndex = 3;
8 13
     naviTitle = '我的';
9 14
   }
15
+  final addressListInfo = Rx<List<Address>>([]);
16
+  final addressInfoContent = Rx<Address>(Address());
17
+
18
+
19
+
20
+
21
+  @override
22
+  void beforeShow() {
23
+    // TODO: implement beforeShow
24
+    super.beforeShow();
25
+    getAddress().then((value) {
26
+      List<Address> list = [];
27
+      value['records'].forEach((item) {
28
+        list.add(Address.fromJson(item));
29
+      });
30
+      addressListInfo(list);
31
+      addressInfoContent(addressListInfo()[0]);
32
+    });
33
+  }
10 34
 
11 35
   @override
12 36
   Widget builder(BuildContext context) {
13
-    return const MainPage();
37
+    return Obx(()=>MainPage( item: addressInfoContent(),));
14 38
   }
15 39
 }

+ 155
- 0
lib/pages/main/widgets/OtherColumn.dart Parādīt failu

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

+ 98
- 0
lib/pages/main/widgets/UserAddress.dart Parādīt failu

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

+ 111
- 0
lib/pages/main/widgets/UserInfo.dart Parādīt failu

@@ -0,0 +1,111 @@
1
+import 'package:flutter/material.dart';
2
+import 'package:flutter_screenutil/flutter_screenutil.dart';
3
+
4
+class UserInfo extends StatelessWidget {
5
+  const UserInfo({Key? key}) : super(key: key);
6
+
7
+  @override
8
+  Widget build(BuildContext context) {
9
+    return Container(
10
+      margin: EdgeInsets.only(top: 20.0, bottom: 0.0),
11
+
12
+      alignment: Alignment.center,
13
+      height: 173.w,
14
+      width: 345.w,
15
+      decoration: BoxDecoration(
16
+        image: const DecorationImage(
17
+          image: AssetImage("images/mineBack.png"),
18
+          fit: BoxFit.cover,
19
+        ),
20
+        borderRadius: BorderRadius.circular(10),
21
+      ),
22
+      child: Stack(
23
+        fit: StackFit.expand,
24
+        children: [
25
+          Positioned(
26
+            top: 0,
27
+            right: 0,
28
+            child: Container(
29
+                alignment: Alignment.center,
30
+                height: 24.w,
31
+                width: 93.w,
32
+                decoration: const BoxDecoration(
33
+                  borderRadius: BorderRadius.only(
34
+                      bottomLeft: Radius.circular(20),
35
+                      topRight: Radius.circular(20)),
36
+                  color: Color(0x30000000),
37
+                ),
38
+                child: GestureDetector(
39
+                  child: const Text(
40
+                    '修改个人信息',
41
+                    style: TextStyle(color: Colors.white),
42
+                  ),
43
+                  onTap: () {
44
+                    print('修改个人信息');
45
+                  },
46
+                )),
47
+          ),
48
+          Row(
49
+            children: [
50
+              Column(
51
+                mainAxisAlignment: MainAxisAlignment.center,
52
+                children: [
53
+                  Container(
54
+                    decoration: BoxDecoration(
55
+                      shape: BoxShape.circle,
56
+                      border: Border.all(
57
+                        color: Colors.white,
58
+                        width: 2,
59
+                      ),
60
+                    ),
61
+                    margin: EdgeInsets.fromLTRB(30, 0, 15, 0),
62
+                    alignment: Alignment.center,
63
+                    child: Image.asset(
64
+                      "images/userMoren.png",
65
+                      width: 63.w,
66
+                    ),
67
+                  ),
68
+                ],
69
+              ),
70
+              Container(
71
+                child: Column(
72
+                  mainAxisAlignment: MainAxisAlignment.center,
73
+                  crossAxisAlignment: CrossAxisAlignment.start,
74
+                  children: [
75
+                    Container(
76
+                      margin: EdgeInsets.fromLTRB(0, 0, 0, 10),
77
+                      child: Text(
78
+                        '符西西',
79
+                        style: TextStyle(
80
+                          color: Colors.white,
81
+                          fontSize: 17,
82
+                        ),
83
+                      ),
84
+                    ),
85
+                    Container(
86
+                      margin: EdgeInsets.fromLTRB(0, 10, 0, 0),
87
+                      child: Text(
88
+                        '17775000245',
89
+                        style: TextStyle(
90
+                          color: Colors.white,
91
+                          fontSize: 17,
92
+                        ),
93
+                      ),
94
+                    ),
95
+                    // const Text(
96
+                    //      '点击登陆',
97
+                    //      style: TextStyle(
98
+                    //        color: Colors.white,
99
+                    //        fontSize: 17,
100
+                    //      ),
101
+                    //    ),
102
+                  ],
103
+                ),
104
+              ),
105
+            ],
106
+          ),
107
+        ],
108
+      ),
109
+    );
110
+  }
111
+}

+ 11
- 8
lib/pages/main/widgets/main/index.dart Parādīt failu

@@ -1,23 +1,26 @@
1
+import 'package:farmer_client/models/entities/Address.dart';
1 2
 import 'package:get/get.dart';
2 3
 import 'package:get_storage/get_storage.dart';
3
-
4 4
 import './widgets/OtherColumn.dart';
5 5
 import './widgets/UserAddress.dart';
6 6
 import './widgets/UserInfo.dart';
7 7
 import 'package:flutter/material.dart';
8 8
 import 'package:flutter_screenutil/flutter_screenutil.dart';
9 9
 
10
-class MainPage extends StatefulWidget {
11
-  const MainPage({Key? key}) : super(key: key);
10
+class MainPage extends StatelessWidget {
11
+  final Address item;
12
+
12 13
 
13
-  @override
14
-  State<MainPage> createState() => _MainPageState();
15
-}
16 14
 
17
-class _MainPageState extends State<MainPage> {
15
+  MainPage({Key? key, required this.item}) : super(key: key);
16
+
18 17
   GetStorage box = GetStorage();
18
+
19
+
19 20
   @override
20 21
   Widget build(BuildContext context) {
22
+    print('644444444444444+$item');
23
+
21 24
     return Container(
22 25
       alignment: Alignment.center,
23 26
       child: Column(
@@ -25,7 +28,7 @@ class _MainPageState extends State<MainPage> {
25 28
           Column(
26 29
             children: [
27 30
               UserInfo(), //头部,头像手机号姓名
28
-              UserAddress(), //用户地址
31
+              UserAddress(item:item),//用户地址
29 32
               OtherColumn(), //功能菜单栏
30 33
               Container(
31 34
                 height: 70.h,

+ 6
- 3
lib/pages/main/widgets/main/widgets/UserAddress.dart Parādīt failu

@@ -2,8 +2,12 @@ import 'package:flutter/material.dart';
2 2
 import 'package:flutter_screenutil/flutter_screenutil.dart';
3 3
 import 'package:get/get.dart';
4 4
 
5
+import '../../../../../models/entities/Address.dart';
6
+
5 7
 class UserAddress extends StatelessWidget {
6
-  const UserAddress({Key? key}) : super(key: key);
8
+  final Address item;
9
+
10
+  const UserAddress({Key? key, required this.item}) : super(key: key);
7 11
 
8 12
   @override
9 13
   Widget build(BuildContext context) {
@@ -61,8 +65,7 @@ class UserAddress extends StatelessWidget {
61 65
                         ),
62 66
                         Container(
63 67
                           width: 260,
64
-                          child: Text(
65
-                            '请填写详细地址请填写详细地址请填写详细地址',
68
+                          child:  Text(item!=null?item.address.toString():'请设置详细地址!',
66 69
                             softWrap: true,
67 70
                             maxLines: 1,
68 71
                             textAlign: TextAlign.left,

+ 27
- 15
lib/pages/main/widgets/main/widgets/UserInfo.dart Parādīt failu

@@ -2,14 +2,19 @@ import 'package:flutter/material.dart';
2 2
 import 'package:flutter_screenutil/flutter_screenutil.dart';
3 3
 import 'package:get/get.dart';
4 4
 
5
+import '../../../../../models/app.dart';
6
+
5 7
 class UserInfo extends StatelessWidget {
6
-  const UserInfo({Key? key}) : super(key: key);
8
+  AppController userInfo = AppController.t;
9
+
10
+   UserInfo({Key? key}) : super(key: key);
7 11
 
8 12
   @override
9 13
   Widget build(BuildContext context) {
14
+    print(userInfo.user().phone);
15
+
10 16
     return Container(
11 17
       margin: EdgeInsets.only(top: 20.0, bottom: 0.0),
12
-
13 18
       alignment: Alignment.center,
14 19
       height: 173.w,
15 20
       width: 345.w,
@@ -52,19 +57,23 @@ class UserInfo extends StatelessWidget {
52 57
                 mainAxisAlignment: MainAxisAlignment.center,
53 58
                 children: [
54 59
                   Container(
60
+                    width: 63.w,
61
+                    height: 63.w,
55 62
                     decoration: BoxDecoration(
56 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
+                      ),
57 71
                       border: Border.all(
58 72
                         color: Colors.white,
59 73
                         width: 2,
60 74
                       ),
61 75
                     ),
62 76
                     margin: EdgeInsets.fromLTRB(30, 0, 15, 0),
63
-                    alignment: Alignment.center,
64
-                    child: Image.asset(
65
-                      "images/userMoren.png",
66
-                      width: 63.w,
67
-                    ),
68 77
                   ),
69 78
                 ],
70 79
               ),
@@ -75,8 +84,9 @@ class UserInfo extends StatelessWidget {
75 84
                   children: [
76 85
                     Container(
77 86
                       margin: EdgeInsets.fromLTRB(0, 0, 0, 10),
78
-                      child: Text(
79
-                        '符西西',
87
+                      child:
88
+                      Text(
89
+                        userInfo.user().nickName!=null?userInfo.user().nickName.toString():'请修改个人信息!',
80 90
                         style: TextStyle(
81 91
                           color: Colors.white,
82 92
                           fontSize: 17,
@@ -85,12 +95,14 @@ class UserInfo extends StatelessWidget {
85 95
                     ),
86 96
                     Container(
87 97
                       margin: EdgeInsets.fromLTRB(0, 10, 0, 0),
88
-                      child: Text(
89
-                        '17775000245',
90
-                        style: TextStyle(
91
-                          color: Colors.white,
92
-                          fontSize: 17,
93
-                        ),
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
+
94 106
                       ),
95 107
                     ),
96 108
                     // const Text(

+ 10
- 4
lib/pages/order/widgets/order/index.dart Parādīt failu

@@ -1,6 +1,7 @@
1 1
 import 'package:farmer_client/widgets/NullCard.dart';
2 2
 import 'package:flutter/material.dart';
3 3
 import 'package:flutter_screenutil/flutter_screenutil.dart';
4
+import 'package:get/get_rx/src/rx_types/rx_types.dart';
4 5
 
5 6
 import '../../../../models/entities/OrderListAll.dart';
6 7
 import '../../../../services/orderAPI.dart';
@@ -15,7 +16,7 @@ class OrderPage extends StatefulWidget {
15 16
 }
16 17
 
17 18
 class _OrderPageState extends State<OrderPage> {
18
-  List<OrderListAll> orderListItem = [];
19
+  final orderListItem = Rx<List<OrderListAll>>([]);
19 20
 
20 21
   @override
21 22
   void initState() {
@@ -23,17 +24,22 @@ class _OrderPageState extends State<OrderPage> {
23 24
     super.initState();
24 25
 
25 26
     getOrderList(true).then((value) {
27
+      final list = <OrderListAll>[];
28
+
26 29
       setState(() {
27 30
         value['records'].forEach((item) {
28
-          orderListItem.add(OrderListAll.fromJson(item));
31
+          list.add(OrderListAll.fromJson(item));
32
+
29 33
         });
30 34
       });
35
+      orderListItem(list);
36
+
31 37
     });
32 38
   }
33 39
 
34 40
   @override
35 41
   Widget build(BuildContext context) {
36
-    return orderListItem.length >= 0?
42
+    return orderListItem.value.length >= 0?
37 43
       Column(
38 44
       children: [
39 45
         Container(
@@ -68,7 +74,7 @@ class _OrderPageState extends State<OrderPage> {
68 74
         Column(
69 75
           mainAxisSize: MainAxisSize.min,
70 76
           children:
71
-          orderListItem.map((item) => OrderListCard(item: item)).toList(),
77
+          orderListItem.value.map((item) => OrderListCard(item: item)).toList(),
72 78
         ),
73 79
       ],
74 80
     ):NullCard(text: '您还没有新的订单!');

+ 61
- 35
lib/pages/orderInfo/index.dart Parādīt failu

@@ -3,6 +3,7 @@ import 'package:flutter/material.dart';
3 3
 import 'package:flutter_screenutil/flutter_screenutil.dart';
4 4
 import 'package:fluttertoast/fluttertoast.dart';
5 5
 import 'package:get/get.dart';
6
+import 'package:farmer_client/widgets/Modal.dart' as modal;
6 7
 
7 8
 import '../../models/entities/OrderInfoModel.dart';
8 9
 import '../../services/orderAPI.dart';
@@ -18,10 +19,9 @@ import '../../widgets/layout/BasicPage.dart';
18 19
 
19 20
 
20 21
 class OrderPageInfo extends BasicPage {
21
-  String id = '';
22
-  String orderStateText = '';
23
-  late Color orderStateColor;
24
-
22
+  final id=Rx<String>('');
23
+  final orderStateText=Rx<String>('待支付');
24
+  final orderStateColor=Rx<Color>(Colors.black);
25 25
   final orderInfoContent = Rx<OrderInfoModel>(OrderInfoModel());
26 26
 
27 27
   // orderStates
@@ -31,17 +31,18 @@ class OrderPageInfo extends BasicPage {
31 31
     // TODO: implement beforeShow
32 32
     super.beforeShow();
33 33
     if (Get.arguments['id'] != null) {
34
-      id = Get.arguments['id'];
34
+      id(Get.arguments['id']);
35 35
 
36
-      orderStateText = Get.arguments['title'];
37
-      orderStateColor = Get.arguments['styleColor'];
36
+      orderStateText(Get.arguments['title']);
37
+      orderStateColor(Get.arguments['styleColor']);
38 38
 
39
-      orderInfo(id).then((value) {
40
-        orderInfoContent.value = OrderInfoModel.fromJson(value);
39
+      orderInfo(id()).then((value) {
40
+        orderInfoContent(OrderInfoModel.fromJson(value));
41 41
       });
42 42
     }
43 43
   }
44 44
 
45
+
45 46
   @override
46 47
   Widget builder(BuildContext context) {
47 48
     naviTitle = '订单详情';
@@ -50,12 +51,12 @@ class OrderPageInfo extends BasicPage {
50 51
       children: [
51 52
         Obx(() =>
52 53
             OrderInfoCard(
53
-                item: orderInfoContent.value,
54
-                orderStateText: orderStateText,
55
-                orderStateColor: orderStateColor
54
+                item: orderInfoContent(),
55
+                orderStateText: orderStateText(),
56
+                orderStateColor: orderStateColor()
56 57
             ),
57 58
         ),
58
-        _BottomWidget()
59
+        Obx(()=>_BottomWidget(id: id()))
59 60
         // orderStateText=='已完成'?  Text('')
60 61
         //     :orderStateText== '进行中' ?Text('')
61 62
         //     :orderStateText=='待评价'? DefaultButton(
@@ -110,7 +111,21 @@ class OrderPageInfo extends BasicPage {
110 111
 }
111 112
 
112 113
 class _BottomWidget extends StatelessWidget {
113
-  const _BottomWidget({Key? key}) : super(key: key);
114
+  final id;
115
+  const _BottomWidget({Key? key, required this.id}) : super(key: key);
116
+
117
+
118
+  void _orderDeletels (){
119
+    modal.showDialog(title: '测试', content: SizedBox(width: 400, height: 300,), onConfirm: () => true);
120
+    // orderDelete(id).then((value) {
121
+    //   Fluttertoast.showToast(
122
+    //       msg: '订单取消成功!'
123
+    //   );
124
+    //   Get.offNamed('/order');
125
+    // });
126
+  }
127
+
128
+
114 129
 
115 130
   @override
116 131
   Widget build(BuildContext context) {
@@ -122,33 +137,43 @@ class _BottomWidget extends StatelessWidget {
122 137
       child: Row(
123 138
         mainAxisAlignment: MainAxisAlignment.spaceBetween,
124 139
         children: [
125
-          GestureDetector(
126
-            onTap: () {
127
-              // onCancel();
128
-            },
129
-            child: Container(
130
-              width: 150.w,
131
-              height: 49.h,
132
-              decoration: BoxDecoration(
133
-                  color: const Color(0xffffffff),
134
-                  border: Border.all(
135
-                      color: const Color(0xFFFF703B),
136
-                      width: 1.w,
137
-                      style: BorderStyle.solid),
138
-                  borderRadius:
139
-                  BorderRadius.all(Radius.circular(24.5.w))),
140
-              child: Center(
141
-                child: Text(
142
-                  '取消',
140
+          Container(
141
+            width: 150.w,
142
+            height: 49.h,
143
+            margin: EdgeInsets.fromLTRB(0, 30.w, 0, 30.w),
144
+            alignment: Alignment.bottomCenter,
145
+            child: SizedBox(
146
+                  width: 150.w,
147
+                  height: 49.h,
148
+              child: ElevatedButton(
149
+                onPressed: () {
150
+                  _orderDeletels();
151
+                },
152
+                child: const Text(
153
+                  "取消",
143 154
                   style: TextStyle(
144
-                      fontSize: 20.sp,
145
-                      color: const Color(0xFFFF703B),
155
+                      fontSize: 18,
156
+                      color: Color(0xFFFF703B),
146 157
                       fontWeight: FontWeight.bold),
147 158
                 ),
159
+                style: ButtonStyle(
160
+                  side: MaterialStateProperty.all(
161
+                      BorderSide(width: 1, color: Color(0xFFFF703B))), //边框
162
+                  elevation: MaterialStateProperty.all(0),
163
+                  backgroundColor: MaterialStateProperty.all(Colors.white),
164
+                  shape: MaterialStateProperty.all(
165
+                    RoundedRectangleBorder(
166
+                        borderRadius:
167
+                        BorderRadius.all(Radius.circular(24.4))),
168
+                  ),
169
+                ),
148 170
               ),
149 171
             ),
150 172
           ),
151
-          DefaultButton(
173
+      Container(
174
+        margin: EdgeInsets.fromLTRB(0, 30.w, 0, 30.w),
175
+        alignment: Alignment.bottomCenter,
176
+        child: DefaultButton(
152 177
             color: const Color(0xffffffff),
153 178
             backColor: const Color(0xFFFF703B),
154 179
             width: 150.w,
@@ -162,6 +187,7 @@ class _BottomWidget extends StatelessWidget {
162 187
             fontSize: 20.sp,
163 188
             radius: 24.5.w,
164 189
           ),
190
+      ),
165 191
         ],
166 192
       ),
167 193
     );

+ 63
- 25
lib/pages/userInfo/index.dart Parādīt failu

@@ -5,29 +5,63 @@ import 'package:flutter_screenutil/flutter_screenutil.dart';
5 5
 import 'package:fluttertoast/fluttertoast.dart';
6 6
 import 'package:get/get.dart';
7 7
 
8
+import '../../models/app.dart';
9
+import '../../models/entities/person.dart';
10
+import '../../services/user.dart';
11
+
8 12
 class UserInfo extends BasicPage {
9
-  final name =Rx<String>('');
10
-  final phone =Rx<String>('');
13
+  late String name ;
14
+  late String phone;
11 15
   late TextEditingController _cName;
12 16
   late TextEditingController _cPhone;
17
+  AppController userInfo = AppController.t;
18
+
19
+
13 20
   @override
14 21
   void beforeShow() {
15 22
     super.beforeShow();
16
-    _cName = TextEditingController(text: name.value);
17
-    _cPhone = TextEditingController(text: phone.value);
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();
18 27
   }
19 28
 
20 29
   bool disableLogin = false;
21 30
   RegExp exp = RegExp(r'^1[3456789]\d{9}$');
22 31
 
32
+  Map<String, dynamic> data = {
33
+
34
+  };
35
+
36
+
23 37
   void handleOk() {
24
-    if (name.value == '' && phone.value == '') {
25
-      Fluttertoast.showToast(msg: '请输入您的信息');
26
-    } else if (phone.value!=''&&!exp.hasMatch(phone.value)) {
38
+    if (name == '' && phone == '') {
39
+      Fluttertoast.showToast(msg: '请输入正确的信息');
40
+      return;
41
+
42
+    } else if (phone==''&&!exp.hasMatch(phone)) {
27 43
       Fluttertoast.showToast(msg: '请输入正确的手机号');
44
+      return;
28 45
     } else {
29
-      Fluttertoast.showToast(msg: '保存成功');
30
-      Get.back();
46
+      data={
47
+        ...userInfo.user().toJson(),
48
+        'avatar':userInfo.user().avatar ?? '',
49
+        'nickName': name,
50
+        'phone': phone
51
+      };
52
+      updateInfo(userInfo.user().personId.toString(),data).then((value) {
53
+        // 尝试获取一次人员信息
54
+        getCurrent().then((person) {
55
+          userInfo.user(Person.fromJson(person));
56
+          Fluttertoast.showToast(msg: '保存成功');
57
+
58
+          Get.back();
59
+
60
+        }).catchError((e) {
61
+          print(e);
62
+        });
63
+
64
+      });
31 65
     }
32 66
   }
33 67
 
@@ -59,19 +93,21 @@ class UserInfo extends BasicPage {
59 93
             child: Row(
60 94
                 mainAxisAlignment: MainAxisAlignment.spaceBetween,
61 95
                 children: [
62
-                  Image.asset(
63
-                    'images/userMoren.png',
64
-                    width: 62.w,
65
-                    height: 62.w,
66
-                  ),
67
-                  Text(
68
-                    '更换头像',
69
-                    style: TextStyle(
70
-                        fontSize: 17.sp,
71
-                        color: Color(0xFF333333),
72
-                        letterSpacing: 2,
73
-                        fontWeight: FontWeight.w500),
96
+                  Container(
97
+                    width: 63.w,
98
+                    height: 63.w,
99
+                    decoration: BoxDecoration(
100
+                      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
+                      ),
108
+                    ),
74 109
                   ),
110
+
75 111
                 ]),
76 112
           ),
77 113
           Text(
@@ -119,13 +155,15 @@ class UserInfo extends BasicPage {
119 155
                               FloatingLabelBehavior.never,
120 156
                             ),
121 157
                             onChanged: (e) {
122
-                                name.value = e;
158
+
159
+                                name = e;
160
+                                print(name);
123 161
                             },
124 162
                           ),
125 163
                         ),
126 164
                         GestureDetector(
127 165
                           onTap: () {
128
-                              name.value = '';
166
+                              name = '';
129 167
                             _cName.clear();
130 168
                           },
131 169
                           child: Image.asset(
@@ -184,13 +222,13 @@ class UserInfo extends BasicPage {
184 222
                               FloatingLabelBehavior.never,
185 223
                             ),
186 224
                             onChanged: (e) {
187
-                                phone.value = e;
225
+                                phone = e;
188 226
                             },
189 227
                           ),
190 228
                         ),
191 229
                         GestureDetector(
192 230
                           onTap: () {
193
-                              phone.value = '';
231
+                              phone = '';
194 232
                             _cPhone.clear();
195 233
                           },
196 234
                           child: Image.asset(

+ 73
- 0
lib/services/address.dart Parādīt failu

@@ -0,0 +1,73 @@
1
+
2
+import 'package:dio/dio.dart';
3
+import 'package:farmer_client/utils/Request.dart';
4
+import 'package:fluttertoast/fluttertoast.dart';
5
+
6
+/**
7
+ * 地址列表
8
+ * @param {*} data
9
+ * @returns
10
+ */
11
+Future getAddress() async {
12
+  return request('/address',
13
+      options: Options(method: 'GET')).catchError((error) => {
14
+    Fluttertoast.showToast(msg: error.error['message']),
15
+  });
16
+}
17
+
18
+
19
+/**
20
+ * 地址保存
21
+ * @param {*} data
22
+ * @returns
23
+ */
24
+Future addressSave(String address) async {
25
+  return request('/address',
26
+      options: Options(method: 'POST'), data: {'address': address})
27
+      .catchError((error) => {
28
+    Fluttertoast.showToast(msg: error.error['message']),
29
+  });
30
+}
31
+
32
+
33
+
34
+/**
35
+ * 地址删除
36
+ * @param {*} data
37
+ * @returns
38
+ */
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
+
45
+}
46
+
47
+
48
+/**
49
+ * 地址修改更新
50
+ * @param {*} data
51
+ * @returns
52
+ */
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
+
59
+}
60
+
61
+
62
+/**
63
+ * 地址是否默认
64
+ * @param {*} data
65
+ * @returns
66
+ */
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
+
73
+}

+ 20
- 28
lib/services/homeAPI.dart Parādīt failu

@@ -1,52 +1,47 @@
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
-
9 5
 /**
10 6
  * banner轮播图
11 7
  * @param {*} data
12 8
  * @returns
13 9
  */
14
-Future getHomeBanner(String position)async{
15
-  return request('/banner',options: Options(method: 'GET'),data: { 'position': position}).catchError((error) =>
16
-  { Fluttertoast.showToast(
17
-      msg: error.error['message']
18
-  ),});
19
-  
20
-}
21
-
22 10
 
11
+Future getHomeBanner(String position) async {
12
+  return request('/banner',
13
+          options: Options(method: 'GET'), data: {'position': position})
14
+      .catchError((error) => {
15
+            Fluttertoast.showToast(msg: error.error['message']),
16
+          });
17
+}
23 18
 
24 19
 /**
25 20
  * 农机列表
26 21
  * @param {*} data
27 22
  * @returns
28 23
  */
29
-Future getMachinery(String location)async{
30
-  return request('/machinery',options: Options(method: 'GET'),queryParameters: { 'location': location}).catchError((error) =>
31
-  { Fluttertoast.showToast(
32
-      msg: error.error['message']
33
-  ),});
34
-
24
+Future getMachinery(String location) async {
25
+  return request('/machinery', options: Options(method: 'GET'), queryParameters: {
26
+    'location': location
27
+  }).catchError((error) => {
28
+        Fluttertoast.showToast(msg: error.error['message']),
29
+      });
35 30
 }
36 31
 
37
-
38
-
39 32
 /**
40 33
  * 农机详情
41 34
  * @param {*} data
42 35
  * @returns
43 36
  */
44
-Future getMachineryInfo(String id,String location ,bool attached)async{
45
-  return request('/machinery-summary',options: Options(method: 'GET'),queryParameters: { 'id': id},data: {'location': location,'attached': attached}).catchError((error) =>
37
+
38
+Future getMachineryInfo(String id,String location ,bool attached)async {
39
+  return request('/machinery-summary/$id', options: Options(method: 'GET'),
40
+      queryParameters: { 'location': location, 'attached': attached})
41
+      .catchError((error) =>
46 42
   { Fluttertoast.showToast(
47 43
       msg: error.error['message']
48 44
   ),});
49
-
50 45
 }
51 46
 
52 47
 
@@ -55,9 +50,6 @@ Future getMachineryInfo(String id,String location ,bool attached)async{
55 50
  * @param {*} data
56 51
  * @returns
57 52
  */
58
-Future getMachineryType()async{
59
-  return request('/machinery-type',options: Options(method: 'GET'));
53
+Future getMachineryType() async {
54
+  return request('/machinery-type', options: Options(method: 'GET'));
60 55
 }
61
-
62
-
63
-

+ 21
- 0
lib/services/main.dart Parādīt failu

@@ -0,0 +1,21 @@
1
+import 'package:dio/dio.dart';
2
+import 'package:farmer_client/utils/Request.dart';
3
+import 'package:fluttertoast/fluttertoast.dart';
4
+
5
+/**
6
+ * 意见反馈
7
+ * @param {*} data
8
+ * @returns
9
+ */
10
+
11
+Future feedback(String content) async {
12
+  return request('/feedback',
13
+      options: Options(method: 'POST'), data: {'content': content})
14
+      .catchError((error) => {
15
+    Fluttertoast.showToast(msg: error.error['message']),
16
+  });
17
+}
18
+
19
+
20
+
21
+

+ 28
- 0
lib/services/orderAPI.dart Parādīt failu

@@ -33,3 +33,31 @@ Future orderInfo(String id)async{
33 33
 }
34 34
 
35 35
 
36
+/**
37
+ * 生成订单
38
+ * @param {*} data
39
+ * @returns
40
+ */
41
+
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
+
48
+}
49
+
50
+
51
+
52
+/**
53
+ * 删除订单
54
+ * @param {*} data
55
+ * @returns
56
+ */
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
+  ),});
62
+
63
+}

+ 14
- 0
lib/services/user.dart Parādīt failu

@@ -30,3 +30,17 @@ Future userLogin(String userName,String password) async {
30 30
 Future getCurrent() async {
31 31
   return request('/person/current');
32 32
 }
33
+
34
+
35
+
36
+/**
37
+ * 修改个人信息
38
+ * @param {*}
39
+ * @returns
40
+ */
41
+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
+  ),});
46
+}

+ 5
- 3
lib/utils/Request.dart Parādīt failu

@@ -37,7 +37,7 @@ Dio createRequest() {
37 37
   var dio = Dio(options);
38 38
   dio.interceptors.add(InterceptorsWrapper(onRequest: (options, handler) {
39 39
     // Do something before request is sent
40
-    options.headers['Authorization'] =  GetStorage().read("token");
40
+    options.headers['Authorization'] = GetStorage().read("token");
41 41
     return handler.next(options); //continue
42 42
     // If you want to resolve the request with some custom data,
43 43
     // you can resolve a `Response` object eg: `handler.resolve(response)`.
@@ -59,7 +59,10 @@ Dio createRequest() {
59 59
 
60 60
       return handler.next(response);
61 61
     } else {
62
-      DioError error = DioError(requestOptions: response.requestOptions, error: response.data, response: response);
62
+      DioError error = DioError(
63
+          requestOptions: response.requestOptions,
64
+          error: response.data,
65
+          response: response);
63 66
       return handler.reject(error);
64 67
     }
65 68
   }, onError: (DioError e, handler) {
@@ -81,7 +84,6 @@ Future request(String path,
81 84
     Options? options,
82 85
     ProgressCallback? onSendProgress,
83 86
     ProgressCallback? onReceiveProgress}) async {
84
-
85 87
   var resp = await instance.request(path,
86 88
       data: data,
87 89
       queryParameters: queryParameters,

+ 44
- 9
lib/widgets/CarsCard.dart Parādīt failu

@@ -5,13 +5,14 @@ import 'package:get/get.dart';
5 5
 import 'package:get/get_core/src/get_main.dart';
6 6
 
7 7
 import '../models/entities/CardInfo.dart';
8
+import '../models/entities/CardListModel.dart';
8 9
 import '../pages/OrderConfirmation/index.dart';
9 10
 import '../pages/machinery/detail/index.dart';
10 11
 import '../pages/machinery/map/index.dart';
11 12
 import 'LinearGradientText.dart';
12 13
 
13 14
 class CarsCard extends StatefulWidget {
14
-  final CardInfo item;
15
+  final CardListModel item;
15 16
 
16 17
   const CarsCard({Key? key, required this.item}) : super(key: key);
17 18
 
@@ -19,9 +20,24 @@ class CarsCard extends StatefulWidget {
19 20
   _CarsCardPage createState() => _CarsCardPage(item);
20 21
 }
21 22
 
23
+
22 24
 class _CarsCardPage extends State<CarsCard> {
23
-  final CardInfo item;
25
+  final CardListModel item;
24 26
   _CarsCardPage(this.item);
27
+  setMorKm () {
28
+    String n = '';
29
+
30
+    if (item.distance !=null) {
31
+      if ((item.distance??0) >= 1000) {
32
+        n = ((item.distance??0) / 1000).toStringAsFixed(2).toString() + '公里';
33
+      } else {
34
+        n = item.distance.toString() + '米';
35
+      }
36
+    } else {
37
+      n = '0m';
38
+    }
39
+    return n;
40
+}
25 41
 
26 42
   @override
27 43
   Widget build(BuildContext context) {
@@ -36,7 +52,7 @@ class _CarsCardPage extends State<CarsCard> {
36 52
         children: [
37 53
           GestureDetector(
38 54
             onTap: () {
39
-              Get.to(MachineryDetailPage());
55
+              Get.to(MachineryDetailPage(),arguments: {'id':item.machineryId,'km':setMorKm().toString()});
40 56
             },
41 57
             child: Image.network(
42 58
               item.thumb.toString(),
@@ -53,8 +69,12 @@ class _CarsCardPage extends State<CarsCard> {
53 69
               verticalDirection: VerticalDirection.up,
54 70
               children: <Widget>[
55 71
                 Container(
72
+                  width: 210.w,
56 73
                   child: Text(
57 74
                     item.name.toString(),
75
+                    softWrap: true,
76
+                    textAlign: TextAlign.left,
77
+                    overflow: TextOverflow.ellipsis,
58 78
                     style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold),
59 79
                   ),
60 80
                 ),
@@ -109,7 +129,7 @@ class _CarsCardPage extends State<CarsCard> {
109 129
                     child: ElevatedButton(
110 130
                       onPressed: () {
111 131
                         Get.toNamed('/orderConfirmation',
112
-                            arguments: {'machineryId': item.machineryId});
132
+                            arguments: {'id':item.machineryId});
113 133
                       },
114 134
                       child: const Text(
115 135
                         "预约",
@@ -150,11 +170,24 @@ class _CarsCardPage extends State<CarsCard> {
150 170
                       child: Row(
151 171
                         mainAxisAlignment: MainAxisAlignment.spaceBetween,
152 172
                         children: [
153
-                          Text(
154
-                            '距离当前位置2.6公里',
155
-                            style: TextStyle(
156
-                                fontSize: 15, fontWeight: FontWeight.bold),
173
+                          Container(
174
+                            child: Row(
175
+                              children: [
176
+                                Text(
177
+                                  '距离当前位置',
178
+                                  style: TextStyle(
179
+                                      fontSize: 15, fontWeight: FontWeight.bold),
180
+                                ),
181
+                                Text(
182
+                                  setMorKm().toString(),
183
+                                  style: TextStyle(
184
+                                      fontSize: 15, fontWeight: FontWeight.bold),
185
+                                ),
186
+
187
+                              ],
188
+                            ),
157 189
                           ),
190
+
158 191
                           GestureDetector(
159 192
                             child: Text(
160 193
                               '进入地图 >>',
@@ -164,7 +197,7 @@ class _CarsCardPage extends State<CarsCard> {
164 197
                             onTap: () {
165 198
                               print('进入地图');
166 199
                               Get.toNamed('/machineryMap',
167
-                                  arguments: {'machineryId': item.machineryId});
200
+                                  arguments: {'id':item.machineryId,'km':setMorKm().toString()});
168 201
                             },
169 202
                           )
170 203
                         ],
@@ -176,3 +209,5 @@ class _CarsCardPage extends State<CarsCard> {
176 209
     );
177 210
   }
178 211
 }
212
+
213
+

+ 38
- 16
lib/widgets/ExtendContentList.dart Parādīt failu

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

+ 11
- 9
lib/widgets/OrderInfoCard.dart Parādīt failu

@@ -1,4 +1,5 @@
1 1
 import 'package:farmer_client/models/entities/OrderInfoModel.dart';
2
+import 'package:farmer_client/pages/index.dart';
2 3
 import 'package:flutter/material.dart';
3 4
 import 'package:flutter_screenutil/flutter_screenutil.dart';
4 5
 import 'package:get/get.dart';
@@ -8,8 +9,8 @@ import 'LinearGradientText.dart';
8 9
 
9 10
 class OrderInfoCard extends StatelessWidget {
10 11
   final OrderInfoModel item;
11
-  final String orderStateText;
12
-  final Color orderStateColor;
12
+  final String? orderStateText;
13
+  final Color? orderStateColor;
13 14
 
14 15
  // final  DateTime timeNew=item.appointmentDate;
15 16
 
@@ -120,7 +121,7 @@ class OrderInfoCard extends StatelessWidget {
120 121
                                   fontWeight: FontWeight.bold)),
121 122
                           TextSpan(
122 123
                           // '${DateFormat("yyyy-MM-dd").format(item.appointmentDate.toString())}'
123
-                              text: DateFormat("yyyy-MM-dd").format(DateTime.parse(item.appointmentDate.toString())),
124
+                              text:item.appointmentDate!=null? DateFormat("yyyy-MM-dd").format(DateTime.parse(item.appointmentDate.toString())):item.appointmentDate.toString(),
124 125
                               style: TextStyle(
125 126
                                   color: Color(0xff222222),
126 127
                                   fontSize: 16,
@@ -139,7 +140,8 @@ class OrderInfoCard extends StatelessWidget {
139 140
                                   fontSize: 16,
140 141
                                   fontWeight: FontWeight.bold)),
141 142
                           TextSpan(
142
-                              text: DateFormat("yyyy-MM-dd").format(DateTime.parse(item.createDate.toString())),
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(),
143 145
 
144 146
                               style: TextStyle(
145 147
                                   color: Color(0xff222222),
@@ -159,9 +161,9 @@ class OrderInfoCard extends StatelessWidget {
159 161
                                   fontSize: 16,
160 162
                                   fontWeight: FontWeight.bold)),
161 163
                           TextSpan(
162
-                              text: orderStateText,
164
+                              text: orderStateText??'未支付',
163 165
                               style: TextStyle(
164
-                                  color:orderStateColor,
166
+                                  color:orderStateColor??Colors.black,
165 167
                                   fontSize: 16,
166 168
                                   fontWeight: FontWeight.bold)),
167 169
                         ]),
@@ -191,7 +193,7 @@ class OrderInfoCard extends StatelessWidget {
191 193
                                     Color(0xFFFA7878),
192 194
                                     Color(0xFFB61515),
193 195
                                   ],
194
-                                  child: const Text('8880',
196
+                                  child:  Text(( (item.charges??0)/100).toString(),
195 197
                                       style: TextStyle(
196 198
                                           color: Color(0xffB61515),
197 199
                                           fontSize: 16,
@@ -211,9 +213,9 @@ class OrderInfoCard extends StatelessWidget {
211 213
                                           color: Color(0xff666666),
212 214
                                           fontSize: 16,
213 215
                                           fontWeight: FontWeight.bold)),
214
-                                  Text(orderStateText,
216
+                                  Text(orderStateText??'未支付',
215 217
                                       style: TextStyle(
216
-                                          color: orderStateColor,
218
+                                          color: orderStateColor??Colors.black,
217 219
                                           fontSize: 16,
218 220
                                           fontWeight: FontWeight.bold)),
219 221
                                 ],

+ 1
- 1
lib/widgets/OrderListCard.dart Parādīt failu

@@ -288,7 +288,7 @@ class _OrderListCardPages extends State<OrderListCard> {
288 288
                                 text:  TextSpan(
289 289
                                     children: <InlineSpan>[
290 290
                                       TextSpan(
291
-                                          text:( item.charges!/100).toString(),
291
+                                          text:( (item.charges??0)/100).toString(),
292 292
                                           style: TextStyle(
293 293
                                             fontSize: 16,
294 294
                                             fontWeight: FontWeight.bold,

+ 22
- 0
lib/widgets/amap/const_config.dart Parādīt failu

@@ -0,0 +1,22 @@
1
+import 'package:amap_flutter_base/amap_flutter_base.dart';
2
+import 'package:amap_flutter_map/amap_flutter_map.dart';
3
+
4
+class ConstConfig {
5
+  ///配置您申请的apikey,在此处配置之后,可以在初始化[AMapWidget]时,通过`apiKey`属性设置
6
+  ///
7
+  ///注意:使用[AMapWidget]的`apiKey`属性设置的key的优先级高于通过Native配置key的优先级,
8
+  ///使用[AMapWidget]的`apiKey`属性配置后Native配置的key将失效,请根据实际情况选择使用
9
+  static const AMapApiKey amapApiKeys = AMapApiKey(
10
+      androidKey: 'b481b4187e24e625fa0056fd0530e663',
11
+      iosKey: '您申请的iOS平台的key');
12
+
13
+  ///高德隐私合规声明,这里只是示例,实际使用中请按照实际参数设置[AMapPrivacyStatement]的'hasContains''hasShow''hasAgree'这三个参数
14
+  ///
15
+  /// 注意:[AMapPrivacyStatement]的'hasContains''hasShow''hasAgree'这三个参数中有一个为false,高德SDK均不会工作,会造成地图白屏等现象
16
+  ///
17
+  /// 高德开发者合规指南请参考:https://lbs.amap.com/agreement/compliance
18
+  ///
19
+  /// 高德SDK合规使用方案请参考:https://lbs.amap.com/news/sdkhgsy
20
+  static const AMapPrivacyStatement amapPrivacyStatement =
21
+  AMapPrivacyStatement(hasContains: true, hasShow: true, hasAgree: true);
22
+}

+ 3
- 3
pubspec.lock Parādīt failu

@@ -335,7 +335,7 @@ packages:
335 335
       name: path_provider_android
336 336
       url: "https://pub.dartlang.org"
337 337
     source: hosted
338
-    version: "2.0.12"
338
+    version: "2.0.13"
339 339
   path_provider_ios:
340 340
     dependency: transitive
341 341
     description:
@@ -536,7 +536,7 @@ packages:
536 536
       name: win32
537 537
       url: "https://pub.dartlang.org"
538 538
     source: hosted
539
-    version: "2.5.1"
539
+    version: "2.5.2"
540 540
   xdg_directories:
541 541
     dependency: transitive
542 542
     description:
@@ -553,4 +553,4 @@ packages:
553 553
     version: "3.1.0"
554 554
 sdks:
555 555
   dart: ">=2.16.1 <3.0.0"
556
-  flutter: ">=2.8.0"
556
+  flutter: ">=2.8.1"