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
-#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

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

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


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

1
+// TODO Implement this library.

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

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
 import 'package:farmer_client/models/entities/person.dart';
5
 import 'package:farmer_client/models/entities/person.dart';
6
 import 'package:farmer_client/widgets/Modal.dart';
6
 import 'package:farmer_client/widgets/Modal.dart';
7
 import 'package:get/get.dart';
7
 import 'package:get/get.dart';
8
+import '../services/user.dart';
8
 import '../utils/location.dart';
9
 import '../utils/location.dart';
9
 
10
 
10
 class AppController extends GetxController {
11
 class AppController extends GetxController {
18
   AMapFlutterLocation? _location;
19
   AMapFlutterLocation? _location;
19
 
20
 
20
   get locationStr {
21
   get locationStr {
21
-    if (null == location.value) return null;
22
+    if (null == location) return null;
22
 
23
 
23
     double longitude = location.value!['longitude'] as double;
24
     double longitude = location.value!['longitude'] as double;
24
     double latitude = location.value!['latitude'] as double;
25
     double latitude = location.value!['latitude'] as double;
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
   @override
62
   @override

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

1
 class Address {
1
 class Address {
2
   String? address;
2
   String? address;
3
   bool? isDefault;
3
   bool? isDefault;
4
+  String? addressId;
5
+  String? ownerType;
6
+  String? ownerId;
7
+  num? sortNo;
8
+  String? orgId;
9
+  num? status;
10
+
4
   Address();
11
   Address();
5
 
12
 
6
   Address.fromJson(Map<String, dynamic> json)
13
   Address.fromJson(Map<String, dynamic> json)
7
       : address = json["address"],
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
   Map<String, dynamic> toJson() => {
23
   Map<String, dynamic> toJson() => {
11
         'address': address,
24
         'address': address,
12
         'isDefault': isDefault,
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
+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
 class CardInfo {
17
 class CardInfo {
4
   // @ApiModelProperty(value = "农机Id")
18
   // @ApiModelProperty(value = "农机Id")
33
   int? status;
47
   int? status;
34
 
48
 
35
   // @ApiModelProperty(value = "内容详情")
49
   // @ApiModelProperty(value = "内容详情")
36
-  late List<dynamic>? contentList;
37
-
50
+   List<ContentImageList>? contentList=[];
38
   // @ApiModelProperty(value = "图片列表")
51
   // @ApiModelProperty(value = "图片列表")
39
-  late List<dynamic>? imagesList;
52
+   List<BannerImageList>? imagesList=[];
40
 
53
 
41
   CardInfo();
54
   CardInfo();
42
 
55
 
53
         orgName = json["orgName"],
66
         orgName = json["orgName"],
54
         jobStatus = json["jobStatus"],
67
         jobStatus = json["jobStatus"],
55
         status = json["status"],
68
         status = json["status"],
56
-        contentList = json["contentList"],
57
-        imagesList = json["imagesList"];
69
+        contentList = jsonToContentList(json["contentList"]),
70
+        imagesList = jsonToImagesList(json["imagesList"]);
58
   Map<String, dynamic> toJson() => {
71
   Map<String, dynamic> toJson() => {
59
         'machineryId': machineryId,
72
         'machineryId': machineryId,
60
         'name': name,
73
         'name': name,
72
         'imagesList': imagesList,
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

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

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

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
-
2
 class Person {
1
 class Person {
3
   String? personId;
2
   String? personId;
4
   String? appId;
3
   String? appId;
5
   String? openid;
4
   String? openid;
6
   String? nickName;
5
   String? nickName;
7
   String? avatar;
6
   String? avatar;
8
-  int? sex;
7
+  num? sex;
9
   String? phone;
8
   String? phone;
10
   String? userId;
9
   String? userId;
11
-  int? status;
10
+  num? status;
12
   String? createDate;
11
   String? createDate;
12
+  String? identity;
13
+  String? isOrgManager;
13
 
14
 
14
-  Person ();
15
+  Person();
15
 
16
 
16
   Person.fromJson(Map<String, dynamic> json)
17
   Person.fromJson(Map<String, dynamic> json)
17
       : personId = json["personId"],
18
       : personId = json["personId"],
23
         phone = json["phone"],
24
         phone = json["phone"],
24
         userId = json["userId"],
25
         userId = json["userId"],
25
         status = json["status"],
26
         status = json["status"],
26
-        createDate = json["createDate"];
27
+        createDate = json["createDate"],
28
+        isOrgManager = json["isOrgManager"],
29
+        identity = json["identity"];
27
 
30
 
28
   Map<String, dynamic> toJson() => {
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
+import 'package:farmer_client/services/news.dart';
1
 import 'package:flutter/material.dart';
2
 import 'package:flutter/material.dart';
2
 import 'package:flutter_screenutil/flutter_screenutil.dart';
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
 import '../../widgets/layout/BasicPage.dart';
9
 import '../../widgets/layout/BasicPage.dart';
5
 
10
 
6
 class ArticleInfo extends BasicPage {
11
 class ArticleInfo extends BasicPage {
12
+  String newsId = '';
13
+  final newsInfoContent = Rx<NewsInformationInfoTextModel>(NewsInformationInfoTextModel());
14
+  final newsList = Rx<List<ExtendContent>>([]);
7
 
15
 
8
   @override
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

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

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
 import 'package:farmer_client/models/addressController.dart';
1
 import 'package:farmer_client/models/addressController.dart';
2
+import 'package:farmer_client/models/entities/CardInfo.dart';
2
 import 'package:farmer_client/widgets/layout/BasicPage.dart';
3
 import 'package:farmer_client/widgets/layout/BasicPage.dart';
3
 import 'package:flutter/material.dart';
4
 import 'package:flutter/material.dart';
4
 import 'package:flutter/services.dart';
5
 import 'package:flutter/services.dart';
5
 import 'package:flutter_screenutil/flutter_screenutil.dart';
6
 import 'package:flutter_screenutil/flutter_screenutil.dart';
7
+import 'package:fluttertoast/fluttertoast.dart';
6
 import 'package:get/get.dart';
8
 import 'package:get/get.dart';
7
 import 'package:intl/intl.dart';
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
 class OrderConfirmation extends BasicPage {
16
 class OrderConfirmation extends BasicPage {
10
   TextEditingController _unameController = TextEditingController();
17
   TextEditingController _unameController = TextEditingController();
11
   GlobalKey _formKey = GlobalKey<FormState>();
18
   GlobalKey _formKey = GlobalKey<FormState>();
12
-
19
+  String markId = '';
13
   final selectDate = Rx<DateTime>(DateTime.now()); //选择的时间
20
   final selectDate = Rx<DateTime>(DateTime.now()); //选择的时间
14
-  final workingArea = Rxn(0);
21
+  final workingArea = Rx<int>(0);
15
   AddressController addressController = AddressController.t;
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
   @override
78
   @override
18
   Widget builder(BuildContext context) {
79
   Widget builder(BuildContext context) {
36
               ),
97
               ),
37
             ),
98
             ),
38
             TextFormField(
99
             TextFormField(
39
-              // autofocus: true,
100
+              autofocus: false,
40
               keyboardType: TextInputType.number,
101
               keyboardType: TextInputType.number,
41
               controller: _unameController,
102
               controller: _unameController,
42
               decoration: const InputDecoration(
103
               decoration: const InputDecoration(
56
                 hintText: "请输入具体面积(公顷)",
117
                 hintText: "请输入具体面积(公顷)",
57
               ),
118
               ),
58
               onChanged: (e) {
119
               onChanged: (e) {
59
-                workingArea.value = e as int?;
120
+                workingArea(int.parse(e));
60
               },
121
               },
61
               // 校验用户名
122
               // 校验用户名
62
               validator: (v) {
123
               validator: (v) {
100
                             helpText: '请选择作业开始时间',
161
                             helpText: '请选择作业开始时间',
101
                             cancelText: '取消',
162
                             cancelText: '取消',
102
                             confirmText: '确定',
163
                             confirmText: '确定',
103
-                            initialDate: selectDate.value == null
164
+                            initialDate: selectDate() == null
104
                                 ? DateTime.now()
165
                                 ? DateTime.now()
105
-                                : selectDate.value,
166
+                                : selectDate(),
106
                             firstDate: DateTime.now(),
167
                             firstDate: DateTime.now(),
107
                             lastDate: DateTime(2030),
168
                             lastDate: DateTime(2030),
108
                           );
169
                           );
109
-                          selectDate.value = handleChnage!;
170
+                          selectDate(handleChnage!);
110
                           print('${selectDate}+');
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
                 height: 49.h,
239
                 height: 49.h,
176
                 child: ElevatedButton(
240
                 child: ElevatedButton(
177
                   onPressed: () {
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
                   child: const Text(
246
                   child: const Text(
186
                     "确定",
247
                     "确定",

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

1
 import 'package:farmer_client/models/entities/Address.dart';
1
 import 'package:farmer_client/models/entities/Address.dart';
2
+import 'package:farmer_client/services/address.dart';
2
 import 'package:farmer_client/widgets/DefaultButton.dart';
3
 import 'package:farmer_client/widgets/DefaultButton.dart';
3
 import 'package:farmer_client/widgets/layout/BasicPage.dart';
4
 import 'package:farmer_client/widgets/layout/BasicPage.dart';
4
 import 'package:flutter/material.dart';
5
 import 'package:flutter/material.dart';
10
 
11
 
11
   final address =Rx<Address>(Address());
12
   final address =Rx<Address>(Address());
12
   late String text = '';
13
   late String text = '';
14
+  late String id = '';
13
 
15
 
14
   @override
16
   @override
15
   void beforeShow() {
17
   void beforeShow() {
16
     super.beforeShow();
18
     super.beforeShow();
17
     if (Get.arguments != null) {
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
                 floatingLabelBehavior: FloatingLabelBehavior.never,
62
                 floatingLabelBehavior: FloatingLabelBehavior.never,
59
               ),
63
               ),
60
               onChanged: (e) {
64
               onChanged: (e) {
61
-                  address.value.address = e;
65
+                  address().address=e;
62
               },
66
               },
63
             ),
67
             ),
64
           ),
68
           ),
73
                 Fluttertoast.showToast(
77
                 Fluttertoast.showToast(
74
                     msg: '请输入地址!');
78
                     msg: '请输入地址!');
75
               } else{
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
             margin: const EdgeInsets.all(0),
96
             margin: const EdgeInsets.all(0),

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

8
 import 'package:fluttertoast/fluttertoast.dart';
8
 import 'package:fluttertoast/fluttertoast.dart';
9
 import 'package:get/get.dart';
9
 import 'package:get/get.dart';
10
 
10
 
11
+import '../../services/address.dart';
12
+
11
 class AddressList extends BasicPage {
13
 class AddressList extends BasicPage {
12
   bool isBack = false;
14
   bool isBack = false;
13
   AddressController addressController=AddressController.t;
15
   AddressController addressController=AddressController.t;
16
+  final addressList = Rx<List<Address>>([]);
17
+
14
 
18
 
15
   @override
19
   @override
16
   void beforeShow() {
20
   void beforeShow() {
17
     super.beforeShow();
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
     if (Get.arguments != null) {
29
     if (Get.arguments != null) {
19
       isBack = Get.arguments['isBack'];
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
   @override
63
   @override
50
             //左对齐
71
             //左对齐
51
             crossAxisAlignment: CrossAxisAlignment.start,
72
             crossAxisAlignment: CrossAxisAlignment.start,
52
             children: [
73
             children: [
53
-              Column(
54
-                  children: addressList.value
74
+              Obx(()=>Column(
75
+                  children: addressList()
55
                       .asMap()
76
                       .asMap()
56
                       .keys
77
                       .keys
57
                       .map(
78
                       .map(
60
                           item: addressList.value[e],
81
                           item: addressList.value[e],
61
                           isBack: isBack,
82
                           isBack: isBack,
62
                           onChange: () {
83
                           onChange: () {
63
-                            onChange(e);
84
+                            onChange(addressList()[e].addressId);
64
                           },
85
                           },
65
                           onEdit: () {
86
                           onEdit: () {
66
                             Get.toNamed('/addAddress',
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
                           onDelete: () {
90
                           onDelete: () {
70
-                            onDelete(e);
91
+                            onDelete(addressList.value[e].addressId);
71
                           },
92
                           },
72
                           onBack: () {
93
                           onBack: () {
94
+                            //选择地址
73
                             addressController.address.value=addressList.value[e];
95
                             addressController.address.value=addressList.value[e];
74
                             Get.back();
96
                             Get.back();
75
                           },
97
                           },
76
                         ),
98
                         ),
77
                       )
99
                       )
78
-                      .toList()),
100
+                      .toList()),),
79
               DefaultButton(
101
               DefaultButton(
80
                 color: const Color(0xffffffff),
102
                 color: const Color(0xffffffff),
81
                 backColor: const Color(0xFFFF703B),
103
                 backColor: const Color(0xFFFF703B),
96
     );
118
     );
97
   }
119
   }
98
 }
120
 }
121
+

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

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

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

1
+// TODO Implement this library.

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

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

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

4
 import 'package:flutter/material.dart';
4
 import 'package:flutter/material.dart';
5
 import 'package:flutter_screenutil/flutter_screenutil.dart';
5
 import 'package:flutter_screenutil/flutter_screenutil.dart';
6
 import 'package:get/get.dart';
6
 import 'package:get/get.dart';
7
+import '../../../../models/app.dart';
7
 import '../../../../models/entities/CardInfo.dart';
8
 import '../../../../models/entities/CardInfo.dart';
9
+import '../../../../models/entities/CardListModel.dart';
8
 import '../../../../services/homeAPI.dart';
10
 import '../../../../services/homeAPI.dart';
9
 import '../../../../widgets/CarsCard.dart';
11
 import '../../../../widgets/CarsCard.dart';
10
 import 'package:farmer_client/models/entities/Banners.dart';
12
 import 'package:farmer_client/models/entities/Banners.dart';
23
   final CarouselController _controller = CarouselController();
25
   final CarouselController _controller = CarouselController();
24
   List<Banners> bannerList = [];
26
   List<Banners> bannerList = [];
25
 
27
 
26
-  List<CardInfo> machineryLists = [];
28
+  List<CardListModel> machineryLists = [];
27
 
29
 
28
   @override
30
   @override
29
   void initState() {
31
   void initState() {
30
     super.initState();
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
     getHomeBanner('banner').then((value) {
37
     getHomeBanner('banner').then((value) {
35
       setState(() {
38
       setState(() {
39
       });
42
       });
40
     });
43
     });
41
 
44
 
42
-    getMachinery('112.087433,32.687692').then((value) {
45
+    getMachinery('122.08400000000002,37.421998333333335').then((value) {
43
       setState(() {
46
       setState(() {
44
         value['records'].forEach((item) {
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
 import 'package:farmer_client/pages/infomation/widgets/Information/index.dart';
1
 import 'package:farmer_client/pages/infomation/widgets/Information/index.dart';
2
 import 'package:farmer_client/widgets/layout/BasicPage.dart';
2
 import 'package:farmer_client/widgets/layout/BasicPage.dart';
3
 import 'package:flutter/material.dart';
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
 import '../../models/entities/NewsInformationModel.dart';
7
 import '../../models/entities/NewsInformationModel.dart';
6
 import '../../services/news.dart';
8
 import '../../services/news.dart';
7
 
9
 
8
 class Infomation extends BasicPage {
10
 class Infomation extends BasicPage {
11
+  // List<NewsInformationModel> newsListItem=[];
12
+
9
   Infomation({Key? key}) : super(key: key) {
13
   Infomation({Key? key}) : super(key: key) {
10
     tabIndex = 2;
14
     tabIndex = 2;
11
     naviTitle = '资讯';
15
     naviTitle = '资讯';
12
   }
16
   }
13
-  List<NewsInformationModel> newsListItem = [];
14
 
17
 
18
+  final newsListItem = Rx<List<NewsInformationModel>>([]);
15
 
19
 
16
 @override
20
 @override
17
   void beforeShow() {
21
   void beforeShow() {
22
+
18
     // TODO: implement beforeShow
23
     // TODO: implement beforeShow
19
     super.beforeShow();
24
     super.beforeShow();
20
   getNewsList().then((value) {
25
   getNewsList().then((value) {
26
+    final list = <NewsInformationModel>[];
27
+
21
      value['records'].forEach((item) {
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
   @override
40
   @override
29
   Widget builder(BuildContext context) {
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
   const Information({Key? key, required this.item}) : super(key: key);
13
   const Information({Key? key, required this.item}) : super(key: key);
14
 
14
 
15
   @override
15
   @override
16
-  State<Information> createState() => _InformationState();
17
-
16
+  State<Information> createState() => _InformationState(item);
18
   // getNewsList
17
   // getNewsList
19
 }
18
 }
20
 
19
 
21
 class _InformationState extends State<Information> {
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
   @override
27
   @override
26
   Widget build(BuildContext context) {
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
                           // 0x17000000
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
       if (_newValue) {
100
       if (_newValue) {
101
         userLogin(handlePhones, handleCodes).then((value) {
101
         userLogin(handlePhones, handleCodes).then((value) {
102
           userInfo(Person.fromJson(value['person']));
102
           userInfo(Person.fromJson(value['person']));
103
-          print('已同意协议');
103
+
104
 
104
 
105
           Get.off(Home());
105
           Get.off(Home());
106
         });
106
         });

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

1
-
1
+import 'package:farmer_client/models/entities/CardInfo.dart';
2
 import 'package:farmer_client/widgets/layout/BasicPage.dart';
2
 import 'package:farmer_client/widgets/layout/BasicPage.dart';
3
 import 'package:flutter/material.dart';
3
 import 'package:flutter/material.dart';
4
 import 'package:get/get.dart';
4
 import 'package:get/get.dart';
5
+import '../../../services/homeAPI.dart';
5
 import 'widgets/detail.dart';
6
 import 'widgets/detail.dart';
6
 
7
 
7
 class MachineryDetailPage extends BasicPage {
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
   void handleClick() {
15
   void handleClick() {
10
-    Get.toNamed('/orderConfirmation');
16
+    Get.toNamed('/orderConfirmation',arguments: {'item':machineryInfoContent()});
11
   }
17
   }
12
 
18
 
19
+
13
   @override
20
   @override
14
   void beforeShow() {
21
   void beforeShow() {
15
     // TODO: implement onMounted
22
     // TODO: implement onMounted
16
     super.beforeShow();
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
     print("----show----detail page--------------");
36
     print("----show----detail page--------------");
18
   }
37
   }
19
 
38
 
27
   @override
46
   @override
28
   Widget builder(BuildContext context) {
47
   Widget builder(BuildContext context) {
29
     naviTitle = "查看详情";
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
 
1
 
2
+import 'package:carousel_slider/carousel_slider.dart';
2
 import 'package:farmer_client/pages/machinery/widgets/DefLayout.dart';
3
 import 'package:farmer_client/pages/machinery/widgets/DefLayout.dart';
3
 import 'package:farmer_client/pages/machinery/widgets/RoundButton.dart';
4
 import 'package:farmer_client/pages/machinery/widgets/RoundButton.dart';
4
 import 'package:flutter/widgets.dart';
5
 import 'package:flutter/widgets.dart';
6
 import 'package:flutter_screenutil/flutter_screenutil.dart';
7
 import 'package:flutter_screenutil/flutter_screenutil.dart';
7
 import 'package:farmer_client/widgets/ExtendContentList.dart';
8
 import 'package:farmer_client/widgets/ExtendContentList.dart';
8
 import 'package:farmer_client/models/entities/ExtendContent.dart';
9
 import 'package:farmer_client/models/entities/ExtendContent.dart';
10
+import 'package:get/get.dart';
11
+import '../../../../models/entities/CardInfo.dart';
9
 import '../../widgets/summary.dart';
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
   return DefLayout(
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
       children: [
35
       children: [
27
         DefLayout.card(
36
         DefLayout.card(
28
           top: DefLayout.headHeight - DefLayout.offset,
37
           top: DefLayout.headHeight - DefLayout.offset,
29
           padding: EdgeInsets.only(top: 45.w, left: 15.w, right: 15.w, bottom: 20.w),
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
   return Column(
46
   return Column(
38
     children: [
47
     children: [
39
-      summary(),
48
+     summary(item: item,km:km),
40
       _sectionHead('农机详情'),
49
       _sectionHead('农机详情'),
41
-      ExtendContentList(list: list),
50
+      ExtendContentList(item: contentItem,),
42
       SizedBox(height: 20.w,),
51
       SizedBox(height: 20.w,),
43
       RoundButton(text: "预约", onPressed: handleClick,)
52
       RoundButton(text: "预约", onPressed: handleClick,)
44
     ],
53
     ],

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

4
 import 'package:flutter/material.dart';
4
 import 'package:flutter/material.dart';
5
 import 'package:get/get.dart';
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
   void handleClick() {
15
   void handleClick() {
11
-    Get.toNamed("/machineryDetail");
16
+    // Get.toNamed("/machineryDetail");
17
+    Get.toNamed('/orderConfirmation',arguments: {'item':machineryInfoContent()});
18
+
12
   }
19
   }
13
 
20
 
14
   @override
21
   @override
15
   void beforeShow() {
22
   void beforeShow() {
16
     // TODO: implement onMounted
23
     // TODO: implement onMounted
17
     super.beforeShow();
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
     print("----show----map page--------------");
35
     print("----show----map page--------------");
19
   }
36
   }
20
 
37
 
28
   @override
45
   @override
29
   Widget builder(BuildContext context) {
46
   Widget builder(BuildContext context) {
30
     naviTitle = "查看地图";
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
 import 'package:amap_flutter_base/amap_flutter_base.dart';
7
 import 'package:amap_flutter_base/amap_flutter_base.dart';
8
 import 'package:farmer_client/widgets/amap/amap.dart';
8
 import 'package:farmer_client/widgets/amap/amap.dart';
9
 
9
 
10
+import '../../../../models/entities/CardInfo.dart';
10
 import '../../widgets/summary.dart';
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
   final _offset = 20.w;
14
   final _offset = 20.w;
14
   final width = MediaQuery.of(context).size.width;
15
   final width = MediaQuery.of(context).size.width;
15
   final mapHeight = 226.5.w;
16
   final mapHeight = 226.5.w;
16
   final cardHeight = 250.w;
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
   final LatLng position = LatLng(32.690712, 112.091892);
20
   final LatLng position = LatLng(32.690712, 112.091892);
21
 
21
 
22
   return DefLayout(
22
   return DefLayout(
25
         DefLayout.card(
25
         DefLayout.card(
26
             top: DefLayout.headHeight - DefLayout.offset,
26
             top: DefLayout.headHeight - DefLayout.offset,
27
             height: DefLayout.headHeight,
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
         DefLayout.card(
34
         DefLayout.card(
31
             top: (DefLayout.headHeight - DefLayout.offset) * 2,
35
             top: (DefLayout.headHeight - DefLayout.offset) * 2,
32
             padding: EdgeInsets.only(top: 45.w, left: 15.w, right: 15.w, bottom: 20.w),
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
     children: [
46
     children: [
42
-      summary(),
47
+      summary(item: item,km:km),
43
       RoundButton(text: "预约", onPressed: handleClick,),
48
       RoundButton(text: "预约", onPressed: handleClick,),
44
     ],
49
     ],
45
   );
50
   );

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

8
 
8
 
9
   DefLayout({Key? key, required this.head, required this.children}): super(key: key);
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
   static double offset = 20.w;
12
   static double offset = 20.w;
13
 
13
 
14
   static Widget card({required double top, required Widget child, double? height, EdgeInsetsGeometry? padding}) {
14
   static Widget card({required double top, required Widget child, double? height, EdgeInsetsGeometry? padding}) {

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

4
 
4
 
5
 import 'package:farmer_client/widgets/LinearGradientText.dart';
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
   return Column(
11
   return Column(
9
     children: [
12
     children: [
10
-      _title(),
13
+      _title(item: item),
11
       SizedBox(height: 20.w,),
14
       SizedBox(height: 20.w,),
12
-      _desc(),
15
+      _desc(item: item,km: km),
13
       SizedBox(height: 20.w,),
16
       SizedBox(height: 20.w,),
14
-      _detail(),
17
+      _detail(item: item),
15
       SizedBox(height: 20.w,),
18
       SizedBox(height: 20.w,),
16
     ],
19
     ],
17
   );
20
   );
18
 }
21
 }
19
 
22
 
20
-Widget _title() {
23
+Widget _title({required CardInfo item}) {
24
+
21
   return Row(
25
   return Row(
22
     children: [
26
     children: [
23
       Expanded(
27
       Expanded(
24
-          child: Text("收割机001--S001",
28
+          child: Text(item.name.toString(),
25
               style: TextStyle(
29
               style: TextStyle(
26
                 color: const Color(0xFF222222),
30
                 color: const Color(0xFF222222),
27
                 fontSize: 18.sp,
31
                 fontSize: 18.sp,
40
             text: TextSpan(
44
             text: TextSpan(
41
                 children: <InlineSpan>[
45
                 children: <InlineSpan>[
42
                   TextSpan(
46
                   TextSpan(
43
-                      text: "450",
47
+                      text: ((item.price??0)/100).toString(),
44
                       style: TextStyle(
48
                       style: TextStyle(
45
                         fontSize: 22.sp,
49
                         fontSize: 22.sp,
46
                         fontWeight: FontWeight.bold,
50
                         fontWeight: FontWeight.bold,
66
   );
70
   );
67
 }
71
 }
68
 
72
 
69
-Widget _desc() {
73
+Widget _desc({required CardInfo item,required String km}) {
70
   return Row(
74
   return Row(
71
     children: [
75
     children: [
72
       Icon(Icons.location_on_outlined, size: 16.sp,),
76
       Icon(Icons.location_on_outlined, size: 16.sp,),
73
       Expanded(
77
       Expanded(
74
         flex: 1,
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
   return Container(
86
   return Container(
83
     alignment: Alignment.centerLeft,
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
 import 'package:farmer_client/pages/main/widgets/main/index.dart';
1
 import 'package:farmer_client/pages/main/widgets/main/index.dart';
2
 import 'package:farmer_client/widgets/layout/BasicPage.dart';
2
 import 'package:farmer_client/widgets/layout/BasicPage.dart';
3
 import 'package:flutter/material.dart';
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
 class Main extends BasicPage {
10
 class Main extends BasicPage {
6
   Main({Key? key}) : super(key: key) {
11
   Main({Key? key}) : super(key: key) {
7
     tabIndex = 3;
12
     tabIndex = 3;
8
     naviTitle = '我的';
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
   @override
35
   @override
12
   Widget builder(BuildContext context) {
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

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

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

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
+import 'package:farmer_client/models/entities/Address.dart';
1
 import 'package:get/get.dart';
2
 import 'package:get/get.dart';
2
 import 'package:get_storage/get_storage.dart';
3
 import 'package:get_storage/get_storage.dart';
3
-
4
 import './widgets/OtherColumn.dart';
4
 import './widgets/OtherColumn.dart';
5
 import './widgets/UserAddress.dart';
5
 import './widgets/UserAddress.dart';
6
 import './widgets/UserInfo.dart';
6
 import './widgets/UserInfo.dart';
7
 import 'package:flutter/material.dart';
7
 import 'package:flutter/material.dart';
8
 import 'package:flutter_screenutil/flutter_screenutil.dart';
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
   GetStorage box = GetStorage();
17
   GetStorage box = GetStorage();
18
+
19
+
19
   @override
20
   @override
20
   Widget build(BuildContext context) {
21
   Widget build(BuildContext context) {
22
+    print('644444444444444+$item');
23
+
21
     return Container(
24
     return Container(
22
       alignment: Alignment.center,
25
       alignment: Alignment.center,
23
       child: Column(
26
       child: Column(
25
           Column(
28
           Column(
26
             children: [
29
             children: [
27
               UserInfo(), //头部,头像手机号姓名
30
               UserInfo(), //头部,头像手机号姓名
28
-              UserAddress(), //用户地址
31
+              UserAddress(item:item),//用户地址
29
               OtherColumn(), //功能菜单栏
32
               OtherColumn(), //功能菜单栏
30
               Container(
33
               Container(
31
                 height: 70.h,
34
                 height: 70.h,

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

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

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

2
 import 'package:flutter_screenutil/flutter_screenutil.dart';
2
 import 'package:flutter_screenutil/flutter_screenutil.dart';
3
 import 'package:get/get.dart';
3
 import 'package:get/get.dart';
4
 
4
 
5
+import '../../../../../models/app.dart';
6
+
5
 class UserInfo extends StatelessWidget {
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
   @override
12
   @override
9
   Widget build(BuildContext context) {
13
   Widget build(BuildContext context) {
14
+    print(userInfo.user().phone);
15
+
10
     return Container(
16
     return Container(
11
       margin: EdgeInsets.only(top: 20.0, bottom: 0.0),
17
       margin: EdgeInsets.only(top: 20.0, bottom: 0.0),
12
-
13
       alignment: Alignment.center,
18
       alignment: Alignment.center,
14
       height: 173.w,
19
       height: 173.w,
15
       width: 345.w,
20
       width: 345.w,
52
                 mainAxisAlignment: MainAxisAlignment.center,
57
                 mainAxisAlignment: MainAxisAlignment.center,
53
                 children: [
58
                 children: [
54
                   Container(
59
                   Container(
60
+                    width: 63.w,
61
+                    height: 63.w,
55
                     decoration: BoxDecoration(
62
                     decoration: BoxDecoration(
56
                       shape: BoxShape.circle,
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
                       border: Border.all(
71
                       border: Border.all(
58
                         color: Colors.white,
72
                         color: Colors.white,
59
                         width: 2,
73
                         width: 2,
60
                       ),
74
                       ),
61
                     ),
75
                     ),
62
                     margin: EdgeInsets.fromLTRB(30, 0, 15, 0),
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
                   children: [
84
                   children: [
76
                     Container(
85
                     Container(
77
                       margin: EdgeInsets.fromLTRB(0, 0, 0, 10),
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
                         style: TextStyle(
90
                         style: TextStyle(
81
                           color: Colors.white,
91
                           color: Colors.white,
82
                           fontSize: 17,
92
                           fontSize: 17,
85
                     ),
95
                     ),
86
                     Container(
96
                     Container(
87
                       margin: EdgeInsets.fromLTRB(0, 10, 0, 0),
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
                     // const Text(
108
                     // const Text(

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

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

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

3
 import 'package:flutter_screenutil/flutter_screenutil.dart';
3
 import 'package:flutter_screenutil/flutter_screenutil.dart';
4
 import 'package:fluttertoast/fluttertoast.dart';
4
 import 'package:fluttertoast/fluttertoast.dart';
5
 import 'package:get/get.dart';
5
 import 'package:get/get.dart';
6
+import 'package:farmer_client/widgets/Modal.dart' as modal;
6
 
7
 
7
 import '../../models/entities/OrderInfoModel.dart';
8
 import '../../models/entities/OrderInfoModel.dart';
8
 import '../../services/orderAPI.dart';
9
 import '../../services/orderAPI.dart';
18
 
19
 
19
 
20
 
20
 class OrderPageInfo extends BasicPage {
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
   final orderInfoContent = Rx<OrderInfoModel>(OrderInfoModel());
25
   final orderInfoContent = Rx<OrderInfoModel>(OrderInfoModel());
26
 
26
 
27
   // orderStates
27
   // orderStates
31
     // TODO: implement beforeShow
31
     // TODO: implement beforeShow
32
     super.beforeShow();
32
     super.beforeShow();
33
     if (Get.arguments['id'] != null) {
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
   @override
46
   @override
46
   Widget builder(BuildContext context) {
47
   Widget builder(BuildContext context) {
47
     naviTitle = '订单详情';
48
     naviTitle = '订单详情';
50
       children: [
51
       children: [
51
         Obx(() =>
52
         Obx(() =>
52
             OrderInfoCard(
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
         // orderStateText=='已完成'?  Text('')
60
         // orderStateText=='已完成'?  Text('')
60
         //     :orderStateText== '进行中' ?Text('')
61
         //     :orderStateText== '进行中' ?Text('')
61
         //     :orderStateText=='待评价'? DefaultButton(
62
         //     :orderStateText=='待评价'? DefaultButton(
110
 }
111
 }
111
 
112
 
112
 class _BottomWidget extends StatelessWidget {
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
   @override
130
   @override
116
   Widget build(BuildContext context) {
131
   Widget build(BuildContext context) {
122
       child: Row(
137
       child: Row(
123
         mainAxisAlignment: MainAxisAlignment.spaceBetween,
138
         mainAxisAlignment: MainAxisAlignment.spaceBetween,
124
         children: [
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
                   style: TextStyle(
154
                   style: TextStyle(
144
-                      fontSize: 20.sp,
145
-                      color: const Color(0xFFFF703B),
155
+                      fontSize: 18,
156
+                      color: Color(0xFFFF703B),
146
                       fontWeight: FontWeight.bold),
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
             color: const Color(0xffffffff),
177
             color: const Color(0xffffffff),
153
             backColor: const Color(0xFFFF703B),
178
             backColor: const Color(0xFFFF703B),
154
             width: 150.w,
179
             width: 150.w,
162
             fontSize: 20.sp,
187
             fontSize: 20.sp,
163
             radius: 24.5.w,
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
 import 'package:fluttertoast/fluttertoast.dart';
5
 import 'package:fluttertoast/fluttertoast.dart';
6
 import 'package:get/get.dart';
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
 class UserInfo extends BasicPage {
12
 class UserInfo extends BasicPage {
9
-  final name =Rx<String>('');
10
-  final phone =Rx<String>('');
13
+  late String name ;
14
+  late String phone;
11
   late TextEditingController _cName;
15
   late TextEditingController _cName;
12
   late TextEditingController _cPhone;
16
   late TextEditingController _cPhone;
17
+  AppController userInfo = AppController.t;
18
+
19
+
13
   @override
20
   @override
14
   void beforeShow() {
21
   void beforeShow() {
15
     super.beforeShow();
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
   bool disableLogin = false;
29
   bool disableLogin = false;
21
   RegExp exp = RegExp(r'^1[3456789]\d{9}$');
30
   RegExp exp = RegExp(r'^1[3456789]\d{9}$');
22
 
31
 
32
+  Map<String, dynamic> data = {
33
+
34
+  };
35
+
36
+
23
   void handleOk() {
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
       Fluttertoast.showToast(msg: '请输入正确的手机号');
43
       Fluttertoast.showToast(msg: '请输入正确的手机号');
44
+      return;
28
     } else {
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
             child: Row(
93
             child: Row(
60
                 mainAxisAlignment: MainAxisAlignment.spaceBetween,
94
                 mainAxisAlignment: MainAxisAlignment.spaceBetween,
61
                 children: [
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
           Text(
113
           Text(
119
                               FloatingLabelBehavior.never,
155
                               FloatingLabelBehavior.never,
120
                             ),
156
                             ),
121
                             onChanged: (e) {
157
                             onChanged: (e) {
122
-                                name.value = e;
158
+
159
+                                name = e;
160
+                                print(name);
123
                             },
161
                             },
124
                           ),
162
                           ),
125
                         ),
163
                         ),
126
                         GestureDetector(
164
                         GestureDetector(
127
                           onTap: () {
165
                           onTap: () {
128
-                              name.value = '';
166
+                              name = '';
129
                             _cName.clear();
167
                             _cName.clear();
130
                           },
168
                           },
131
                           child: Image.asset(
169
                           child: Image.asset(
184
                               FloatingLabelBehavior.never,
222
                               FloatingLabelBehavior.never,
185
                             ),
223
                             ),
186
                             onChanged: (e) {
224
                             onChanged: (e) {
187
-                                phone.value = e;
225
+                                phone = e;
188
                             },
226
                             },
189
                           ),
227
                           ),
190
                         ),
228
                         ),
191
                         GestureDetector(
229
                         GestureDetector(
192
                           onTap: () {
230
                           onTap: () {
193
-                              phone.value = '';
231
+                              phone = '';
194
                             _cPhone.clear();
232
                             _cPhone.clear();
195
                           },
233
                           },
196
                           child: Image.asset(
234
                           child: Image.asset(

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

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
-
2
-
3
 import 'package:dio/dio.dart';
1
 import 'package:dio/dio.dart';
4
 import 'package:farmer_client/utils/Request.dart';
2
 import 'package:farmer_client/utils/Request.dart';
5
 import 'package:fluttertoast/fluttertoast.dart';
3
 import 'package:fluttertoast/fluttertoast.dart';
6
 
4
 
7
-
8
-
9
 /**
5
 /**
10
  * banner轮播图
6
  * banner轮播图
11
  * @param {*} data
7
  * @param {*} data
12
  * @returns
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
  * @param {*} data
21
  * @param {*} data
27
  * @returns
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
  * @param {*} data
34
  * @param {*} data
42
  * @returns
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
   { Fluttertoast.showToast(
42
   { Fluttertoast.showToast(
47
       msg: error.error['message']
43
       msg: error.error['message']
48
   ),});
44
   ),});
49
-
50
 }
45
 }
51
 
46
 
52
 
47
 
55
  * @param {*} data
50
  * @param {*} data
56
  * @returns
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

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

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

5
 import 'package:get/get_core/src/get_main.dart';
5
 import 'package:get/get_core/src/get_main.dart';
6
 
6
 
7
 import '../models/entities/CardInfo.dart';
7
 import '../models/entities/CardInfo.dart';
8
+import '../models/entities/CardListModel.dart';
8
 import '../pages/OrderConfirmation/index.dart';
9
 import '../pages/OrderConfirmation/index.dart';
9
 import '../pages/machinery/detail/index.dart';
10
 import '../pages/machinery/detail/index.dart';
10
 import '../pages/machinery/map/index.dart';
11
 import '../pages/machinery/map/index.dart';
11
 import 'LinearGradientText.dart';
12
 import 'LinearGradientText.dart';
12
 
13
 
13
 class CarsCard extends StatefulWidget {
14
 class CarsCard extends StatefulWidget {
14
-  final CardInfo item;
15
+  final CardListModel item;
15
 
16
 
16
   const CarsCard({Key? key, required this.item}) : super(key: key);
17
   const CarsCard({Key? key, required this.item}) : super(key: key);
17
 
18
 
19
   _CarsCardPage createState() => _CarsCardPage(item);
20
   _CarsCardPage createState() => _CarsCardPage(item);
20
 }
21
 }
21
 
22
 
23
+
22
 class _CarsCardPage extends State<CarsCard> {
24
 class _CarsCardPage extends State<CarsCard> {
23
-  final CardInfo item;
25
+  final CardListModel item;
24
   _CarsCardPage(this.item);
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
   @override
42
   @override
27
   Widget build(BuildContext context) {
43
   Widget build(BuildContext context) {
36
         children: [
52
         children: [
37
           GestureDetector(
53
           GestureDetector(
38
             onTap: () {
54
             onTap: () {
39
-              Get.to(MachineryDetailPage());
55
+              Get.to(MachineryDetailPage(),arguments: {'id':item.machineryId,'km':setMorKm().toString()});
40
             },
56
             },
41
             child: Image.network(
57
             child: Image.network(
42
               item.thumb.toString(),
58
               item.thumb.toString(),
53
               verticalDirection: VerticalDirection.up,
69
               verticalDirection: VerticalDirection.up,
54
               children: <Widget>[
70
               children: <Widget>[
55
                 Container(
71
                 Container(
72
+                  width: 210.w,
56
                   child: Text(
73
                   child: Text(
57
                     item.name.toString(),
74
                     item.name.toString(),
75
+                    softWrap: true,
76
+                    textAlign: TextAlign.left,
77
+                    overflow: TextOverflow.ellipsis,
58
                     style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold),
78
                     style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold),
59
                   ),
79
                   ),
60
                 ),
80
                 ),
109
                     child: ElevatedButton(
129
                     child: ElevatedButton(
110
                       onPressed: () {
130
                       onPressed: () {
111
                         Get.toNamed('/orderConfirmation',
131
                         Get.toNamed('/orderConfirmation',
112
-                            arguments: {'machineryId': item.machineryId});
132
+                            arguments: {'id':item.machineryId});
113
                       },
133
                       },
114
                       child: const Text(
134
                       child: const Text(
115
                         "预约",
135
                         "预约",
150
                       child: Row(
170
                       child: Row(
151
                         mainAxisAlignment: MainAxisAlignment.spaceBetween,
171
                         mainAxisAlignment: MainAxisAlignment.spaceBetween,
152
                         children: [
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
                           GestureDetector(
191
                           GestureDetector(
159
                             child: Text(
192
                             child: Text(
160
                               '进入地图 >>',
193
                               '进入地图 >>',
164
                             onTap: () {
197
                             onTap: () {
165
                               print('进入地图');
198
                               print('进入地图');
166
                               Get.toNamed('/machineryMap',
199
                               Get.toNamed('/machineryMap',
167
-                                  arguments: {'machineryId': item.machineryId});
200
+                                  arguments: {'id':item.machineryId,'km':setMorKm().toString()});
168
                             },
201
                             },
169
                           )
202
                           )
170
                         ],
203
                         ],
176
     );
209
     );
177
   }
210
   }
178
 }
211
 }
212
+
213
+

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

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

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

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

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

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