Bläddra i källkod

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

李志伟 3 år sedan
förälder
incheckning
5a219ba6c6
36 ändrade filer med 1534 tillägg och 224 borttagningar
  1. 6
    0
      android/app/src/main/java/com/example/farmer_client/MainActivity.java
  2. Binär
      images/cars.png
  3. 89
    0
      lib/components/UI/DefaultButton.dart
  4. 1
    0
      lib/models/Store.dart
  5. 15
    0
      lib/models/User.dart
  6. 1
    1
      lib/models/app.dart
  7. 72
    5
      lib/models/entities/CardInfo.dart
  8. 69
    0
      lib/models/entities/CardListModel.dart
  9. 78
    0
      lib/models/entities/NewsInformationInfoTextModel.dart
  10. 28
    0
      lib/models/entities/banner.dart
  11. 73
    35
      lib/pages/ArticleInfo/ArticleInfo.dart
  12. 62
    0
      lib/pages/Information/ArticleInfo.dart
  13. 141
    0
      lib/pages/Information/index.dart
  14. 63
    11
      lib/pages/OrderConfirmation/index.dart
  15. 1
    0
      lib/pages/home.dart
  16. 8
    5
      lib/pages/home/widgets/home/index.dart
  17. 109
    0
      lib/pages/home2.dart
  18. 26
    7
      lib/pages/infomation/index.dart
  19. 60
    54
      lib/pages/infomation/widgets/Information/index.dart
  20. 22
    4
      lib/pages/machinery/detail/index.dart
  21. 25
    16
      lib/pages/machinery/detail/widgets/detail.dart
  22. 17
    2
      lib/pages/machinery/map/index.dart
  23. 8
    7
      lib/pages/machinery/map/widgets/detail.dart
  24. 1
    1
      lib/pages/machinery/widgets/DefLayout.dart
  25. 15
    11
      lib/pages/machinery/widgets/summary.dart
  26. 155
    0
      lib/pages/main/widgets/OtherColumn.dart
  27. 98
    0
      lib/pages/main/widgets/UserAddress.dart
  28. 111
    0
      lib/pages/main/widgets/UserInfo.dart
  29. 10
    4
      lib/pages/order/widgets/order/index.dart
  30. 32
    21
      lib/pages/orderInfo/index.dart
  31. 10
    8
      lib/services/homeAPI.dart
  32. 15
    0
      lib/services/orderAPI.dart
  33. 43
    8
      lib/widgets/CarsCard.dart
  34. 38
    16
      lib/widgets/ExtendContentList.dart
  35. 10
    8
      lib/widgets/OrderInfoCard.dart
  36. 22
    0
      lib/widgets/amap/const_config.dart

+ 6
- 0
android/app/src/main/java/com/example/farmer_client/MainActivity.java Visa fil

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

Binär
images/cars.png Visa fil


+ 89
- 0
lib/components/UI/DefaultButton.dart Visa fil

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

+ 1
- 0
lib/models/Store.dart Visa fil

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

+ 15
- 0
lib/models/User.dart Visa fil

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

+ 1
- 1
lib/models/app.dart Visa fil

@@ -18,7 +18,7 @@ class AppController extends GetxController {
18 18
   AMapFlutterLocation? _location;
19 19
 
20 20
   get locationStr {
21
-    if (null == location.value) return null;
21
+    if (null == location) return null;
22 22
 
23 23
     double longitude = location.value!['longitude'] as double;
24 24
     double latitude = location.value!['latitude'] as double;

+ 72
- 5
lib/models/entities/CardInfo.dart Visa fil

@@ -1,4 +1,18 @@
1
+List<ContentImageList> jsonToContentList(list) {
2
+  List<ContentImageList> contList = [];
3
+  list.forEach((item) {
4
+    contList.add(ContentImageList.fromJson(item));
5
+  });
6
+  return contList;
7
+}
1 8
 
9
+List<BannerImageList> jsonToImagesList(list) {
10
+  List<BannerImageList> contList = [];
11
+  list.forEach((item) {
12
+    contList.add(BannerImageList.fromJson(item));
13
+  });
14
+  return contList;
15
+}
2 16
 
3 17
 class CardInfo {
4 18
   // @ApiModelProperty(value = "农机Id")
@@ -33,10 +47,9 @@ class CardInfo {
33 47
   int? status;
34 48
 
35 49
   // @ApiModelProperty(value = "内容详情")
36
-  late List<dynamic>? contentList;
37
-
50
+   List<ContentImageList>? contentList=[];
38 51
   // @ApiModelProperty(value = "图片列表")
39
-  late List<dynamic>? imagesList;
52
+   List<BannerImageList>? imagesList=[];
40 53
 
41 54
   CardInfo();
42 55
 
@@ -53,8 +66,8 @@ class CardInfo {
53 66
         orgName = json["orgName"],
54 67
         jobStatus = json["jobStatus"],
55 68
         status = json["status"],
56
-        contentList = json["contentList"],
57
-        imagesList = json["imagesList"];
69
+        contentList = jsonToContentList(json["contentList"]),
70
+        imagesList = jsonToImagesList(json["imagesList"]);
58 71
   Map<String, dynamic> toJson() => {
59 72
         'machineryId': machineryId,
60 73
         'name': name,
@@ -72,3 +85,57 @@ class CardInfo {
72 85
         'imagesList': imagesList,
73 86
       };
74 87
 }
88
+
89
+class ContentImageList {
90
+  String? content;
91
+  String? contentType;
92
+  String? createDate;
93
+  String? extId;
94
+  String? 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 Visa fil

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

+ 78
- 0
lib/models/entities/NewsInformationInfoTextModel.dart Visa fil

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

+ 28
- 0
lib/models/entities/banner.dart Visa fil

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

+ 73
- 35
lib/pages/ArticleInfo/ArticleInfo.dart Visa fil

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

+ 62
- 0
lib/pages/Information/ArticleInfo.dart Visa fil

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

+ 141
- 0
lib/pages/Information/index.dart Visa fil

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

+ 63
- 11
lib/pages/OrderConfirmation/index.dart Visa fil

@@ -1,18 +1,70 @@
1 1
 import 'package:farmer_client/models/addressController.dart';
2
+import 'package:farmer_client/models/entities/CardInfo.dart';
2 3
 import 'package:farmer_client/widgets/layout/BasicPage.dart';
3 4
 import 'package:flutter/material.dart';
4 5
 import 'package:flutter/services.dart';
5 6
 import 'package:flutter_screenutil/flutter_screenutil.dart';
7
+import 'package:fluttertoast/fluttertoast.dart';
6 8
 import 'package:get/get.dart';
7 9
 import 'package:intl/intl.dart';
8 10
 
11
+import '../../models/entities/OrderInfoModel.dart';
12
+import '../../services/orderAPI.dart';
13
+
9 14
 class OrderConfirmation extends BasicPage {
10 15
   TextEditingController _unameController = TextEditingController();
11 16
   GlobalKey _formKey = GlobalKey<FormState>();
12 17
 
13 18
   final selectDate = Rx<DateTime>(DateTime.now()); //选择的时间
14
-  final workingArea = Rxn(0);
19
+  final workingArea = Rx<int>(0);
15 20
   AddressController addressController = AddressController.t;
21
+  final item = Rx<CardInfo>(CardInfo());//全部详情
22
+  final orderInfo = Rx<OrderInfoModel>(OrderInfoModel());//全部详情
23
+
24
+  @override
25
+  void beforeShow() {
26
+    // TODO: implement beforeShow
27
+    super.beforeShow();
28
+    if(Get.arguments['item']!=null){
29
+      item.value=Get.arguments['item'];
30
+    }else{
31
+      return;
32
+    }
33
+  }
34
+
35
+
36
+  Map<String, dynamic> data = {
37
+
38
+  };
39
+
40
+  void _orderSubmit (){
41
+
42
+    if ((_formKey.currentState as FormState).validate()) {
43
+          data = {
44
+        'charges': item.value.price! * workingArea.value,
45
+        'price':  item.value.price,
46
+        'amount': workingArea.value,
47
+        'machineryId':  item.value.machineryId,
48
+        'machineryName':  item.value.name,
49
+        'machineryType':  item.value.typeId,
50
+        'typeName':  item.value.typeName,
51
+        'address': addressController.address.value.address,
52
+        'orgId':  item.value.orgId,
53
+        'appointmentDate': '${DateFormat("yyyy-MM-dd").format(selectDate.value)} 08:00:00',
54
+      };
55
+      generateOrder(data).then((value) {
56
+        orderInfo.value=OrderInfoModel.fromJson(value);
57
+        Fluttertoast.showToast(
58
+            msg: '预约成功'
59
+        );
60
+        Get.to('/OrderInfoCard',arguments: {'id':orderInfo.value.orderId});
61
+
62
+
63
+      });
64
+      //验证通过提交数据
65
+    }
66
+
67
+  }
16 68
 
17 69
   @override
18 70
   Widget builder(BuildContext context) {
@@ -56,7 +108,7 @@ class OrderConfirmation extends BasicPage {
56 108
                 hintText: "请输入具体面积(公顷)",
57 109
               ),
58 110
               onChanged: (e) {
59
-                workingArea.value = e as int?;
111
+                workingArea.value = int.parse(e);
60 112
               },
61 113
               // 校验用户名
62 114
               validator: (v) {
@@ -109,9 +161,12 @@ class OrderConfirmation extends BasicPage {
109 161
                           selectDate.value = handleChnage!;
110 162
                           print('${selectDate}+');
111 163
                         },
112
-                        child: Text(selectDate == null
113
-                            ? '请选择日期'
114
-                            : '${DateFormat("yyyy-MM-dd").format(selectDate.value)}'),
164
+                        child: Obx(()=>
165
+                            Text(selectDate == null
166
+                                ? '请选择日期'
167
+                                : '${DateFormat("yyyy-MM-dd").format(selectDate.value)}'),
168
+                        )
169
+
115 170
                       ),
116 171
                     )
117 172
                   ],
@@ -175,12 +230,9 @@ class OrderConfirmation extends BasicPage {
175 230
                 height: 49.h,
176 231
                 child: ElevatedButton(
177 232
                   onPressed: () {
178
-                    if ((_formKey.currentState as FormState).validate()) {
179
-                      var a = {selectDate, workingArea};
180
-                      print('我确定了$a');
181
-                      //验证通过提交数据
182
-                      Get.toNamed('/orderPageInfo');
183
-                    }
233
+                    _orderSubmit();
234
+
235
+
184 236
                   },
185 237
                   child: const Text(
186 238
                     "确定",

+ 1
- 0
lib/pages/home.dart Visa fil

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

+ 8
- 5
lib/pages/home/widgets/home/index.dart Visa fil

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

+ 109
- 0
lib/pages/home2.dart Visa fil

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

+ 26
- 7
lib/pages/infomation/index.dart Visa fil

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

+ 60
- 54
lib/pages/infomation/widgets/Information/index.dart Visa fil

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

+ 22
- 4
lib/pages/machinery/detail/index.dart Visa fil

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

+ 25
- 16
lib/pages/machinery/detail/widgets/detail.dart Visa fil

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

+ 17
- 2
lib/pages/machinery/map/index.dart Visa fil

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

+ 8
- 7
lib/pages/machinery/map/widgets/detail.dart Visa fil

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

+ 1
- 1
lib/pages/machinery/widgets/DefLayout.dart Visa fil

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

+ 15
- 11
lib/pages/machinery/widgets/summary.dart Visa fil

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

+ 155
- 0
lib/pages/main/widgets/OtherColumn.dart Visa fil

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

+ 98
- 0
lib/pages/main/widgets/UserAddress.dart Visa fil

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

+ 111
- 0
lib/pages/main/widgets/UserInfo.dart Visa fil

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

+ 10
- 4
lib/pages/order/widgets/order/index.dart Visa fil

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

+ 32
- 21
lib/pages/orderInfo/index.dart Visa fil

@@ -122,33 +122,43 @@ class _BottomWidget extends StatelessWidget {
122 122
       child: Row(
123 123
         mainAxisAlignment: MainAxisAlignment.spaceBetween,
124 124
         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
-                  '取消',
125
+          Container(
126
+            width: 150.w,
127
+            height: 49.h,
128
+            margin: EdgeInsets.fromLTRB(0, 30.w, 0, 30.w),
129
+            alignment: Alignment.bottomCenter,
130
+            child: SizedBox(
131
+                  width: 150.w,
132
+                  height: 49.h,
133
+              child: ElevatedButton(
134
+                onPressed: () {
135
+                  Get.back();
136
+                },
137
+                child: const Text(
138
+                  "取消",
143 139
                   style: TextStyle(
144
-                      fontSize: 20.sp,
145
-                      color: const Color(0xFFFF703B),
140
+                      fontSize: 18,
141
+                      color: Color(0xFFFF703B),
146 142
                       fontWeight: FontWeight.bold),
147 143
                 ),
144
+                style: ButtonStyle(
145
+                  side: MaterialStateProperty.all(
146
+                      BorderSide(width: 1, color: Color(0xFFFF703B))), //边框
147
+                  elevation: MaterialStateProperty.all(0),
148
+                  backgroundColor: MaterialStateProperty.all(Colors.white),
149
+                  shape: MaterialStateProperty.all(
150
+                    RoundedRectangleBorder(
151
+                        borderRadius:
152
+                        BorderRadius.all(Radius.circular(24.4))),
153
+                  ),
154
+                ),
148 155
               ),
149 156
             ),
150 157
           ),
151
-          DefaultButton(
158
+      Container(
159
+        margin: EdgeInsets.fromLTRB(0, 30.w, 0, 30.w),
160
+        alignment: Alignment.bottomCenter,
161
+        child: DefaultButton(
152 162
             color: const Color(0xffffffff),
153 163
             backColor: const Color(0xFFFF703B),
154 164
             width: 150.w,
@@ -162,6 +172,7 @@ class _BottomWidget extends StatelessWidget {
162 172
             fontSize: 20.sp,
163 173
             radius: 24.5.w,
164 174
           ),
175
+      ),
165 176
         ],
166 177
       ),
167 178
     );

+ 10
- 8
lib/services/homeAPI.dart Visa fil

@@ -7,6 +7,7 @@ import 'package:fluttertoast/fluttertoast.dart';
7 7
  * @param {*} data
8 8
  * @returns
9 9
  */
10
+
10 11
 Future getHomeBanner(String position) async {
11 12
   return request('/banner',
12 13
           options: Options(method: 'GET'), data: {'position': position})
@@ -33,16 +34,17 @@ Future getMachinery(String location) async {
33 34
  * @param {*} data
34 35
  * @returns
35 36
  */
36
-Future getMachineryInfo(String id, String location, bool attached) async {
37
-  return request('/machinery-summary',
38
-          options: Options(method: 'GET'),
39
-          queryParameters: {'id': id},
40
-          data: {'location': location, 'attached': attached})
41
-      .catchError((error) => {
42
-            Fluttertoast.showToast(msg: error.error['message']),
43
-          });
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) =>
42
+  { Fluttertoast.showToast(
43
+      msg: error.error['message']
44
+  ),});
44 45
 }
45 46
 
47
+
46 48
 /**
47 49
  * 农机分类Tab列查询
48 50
  * @param {*} data

+ 15
- 0
lib/services/orderAPI.dart Visa fil

@@ -33,3 +33,18 @@ Future orderInfo(String id)async{
33 33
 }
34 34
 
35 35
 
36
+/**
37
+ * 生成订单
38
+ * @param {*} data
39
+ * @returns
40
+ */
41
+
42
+Future generateOrder(item)async{
43
+  return request('/order',options: Options(method: 'POST'),data: item).catchError((error) =>
44
+  { Fluttertoast.showToast(
45
+      msg: error.error['message']
46
+  ),});
47
+
48
+}
49
+
50
+

+ 43
- 8
lib/widgets/CarsCard.dart Visa fil

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

+ 38
- 16
lib/widgets/ExtendContentList.dart Visa fil

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

+ 10
- 8
lib/widgets/OrderInfoCard.dart Visa fil

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

+ 22
- 0
lib/widgets/amap/const_config.dart Visa fil

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