[baozhangchao] 3 年前
父节点
当前提交
748a72b564

二进制
images/decorate.png 查看文件


images/icons/ListBack.png → images/icons/nullDataImg.png 查看文件


二进制
images/icons/search.png 查看文件


+ 46
- 0
lib/models/entities/ExtendContent.dart 查看文件

1
+
2
+class ExtendContent {
3
+  // 租户号
4
+  String? extId;
5
+
6
+  // 扩展对象类型;message消息表 bannar轮播图 info资讯
7
+  String? targetType;
8
+
9
+  // 拓展对象Id
10
+  String? targetId;
11
+
12
+  // 内容类型;text文本 image图片
13
+  String? contentType;
14
+
15
+  // 内容
16
+  String? content;
17
+
18
+  // 排序
19
+  int? sort;
20
+
21
+  // 创建时间
22
+  String? createDate;
23
+
24
+  ExtendContent();
25
+
26
+  ExtendContent.simple({ this.content, this.contentType });
27
+
28
+  ExtendContent.fromJson(Map<String, dynamic> json)
29
+      : extId = json["extId"],
30
+        targetType = json["targetType"],
31
+        targetId = json["targetId"],
32
+        contentType = json["contentType"],
33
+        content = json["content"],
34
+        sort = json["sort"],
35
+        createDate = json["createDate"];
36
+
37
+  Map<String, dynamic> toJson() => {
38
+    'extId' : extId,
39
+    'targetType' : targetType,
40
+    'targetId' : targetId,
41
+    'contentType' : contentType,
42
+    'content' : content,
43
+    'sort' : sort,
44
+    'createDate' : createDate,
45
+  };
46
+}

+ 24
- 28
lib/pages/MoreCars/index.dart 查看文件

1
-
2
 import 'package:flutter/material.dart';
1
 import 'package:flutter/material.dart';
3
 import 'package:flutter_screenutil/flutter_screenutil.dart';
2
 import 'package:flutter_screenutil/flutter_screenutil.dart';
3
+import 'package:get/get.dart';
4
 
4
 
5
 import '../../widgets/CarsCard.dart';
5
 import '../../widgets/CarsCard.dart';
6
 import '../../widgets/Search.dart';
6
 import '../../widgets/Search.dart';
7
 import '../TabBar/widgets/home/widgets/headers.dart';
7
 import '../TabBar/widgets/home/widgets/headers.dart';
8
 
8
 
9
-
10
 class MoreCars extends StatefulWidget {
9
 class MoreCars extends StatefulWidget {
11
   const MoreCars({Key? key}) : super(key: key);
10
   const MoreCars({Key? key}) : super(key: key);
12
 
11
 
14
   State<MoreCars> createState() => _MoreCarsState();
13
   State<MoreCars> createState() => _MoreCarsState();
15
 }
14
 }
16
 
15
 
17
-class _MoreCarsState extends State<MoreCars> with TickerProviderStateMixin  {
18
-
19
-  late TabController _controller = TabController(length: tabText.length, vsync: this);
20
-   List<String> tabText= [
21
-     '全部',
22
-     '播种机',
23
-     '收割机',
24
-     '挺长名字的农机选项分类',
16
+class _MoreCarsState extends State<MoreCars> with TickerProviderStateMixin {
17
+  late TabController _controller =
18
+      TabController(length: tabText.length, vsync: this);
19
+  List<String> tabText = [
20
+    '全部',
21
+    '播种机',
22
+    '收割机',
23
+    '挺长名字的农机选项分类',
25
   ];
24
   ];
26
 
25
 
27
-
28
-
29
   @override
26
   @override
30
   void initState() {
27
   void initState() {
31
     // TODO: implement initState
28
     // TODO: implement initState
32
     super.initState();
29
     super.initState();
33
   }
30
   }
31
+
34
   @override
32
   @override
35
   Widget build(BuildContext context) {
33
   Widget build(BuildContext context) {
36
     // _controller=TabController(length: tabText.length, vsync: this);
34
     // _controller=TabController(length: tabText.length, vsync: this);
37
     return Scaffold(
35
     return Scaffold(
38
-      resizeToAvoidBottomInset: false,
39
-      appBar: AppBar(
40
-        elevation: 0,
41
-        centerTitle: true,
42
-        backgroundColor: Colors.white,
43
-        title:Text(
44
-          '更多',
45
-          style: TextStyle(
46
-              color: Colors.black,
47
-              fontSize: 17.sp,
48
-              letterSpacing: 2,
49
-              fontWeight: FontWeight.bold),
36
+        resizeToAvoidBottomInset: false,
37
+        appBar: AppBar(
38
+          elevation: 0,
39
+          centerTitle: true,
40
+          backgroundColor: Colors.white,
41
+          title: Text(
42
+            '更多',
43
+            style: TextStyle(
44
+                color: Colors.black,
45
+                fontSize: 17.sp,
46
+                letterSpacing: 2,
47
+                fontWeight: FontWeight.bold),
48
+          ),
50
         ),
49
         ),
51
 
50
 
52
-      ),
51
+
53
       body: Container(
52
       body: Container(
54
         decoration: BoxDecoration(
53
         decoration: BoxDecoration(
55
             color: Colors.white
54
             color: Colors.white
97
         ),
96
         ),
98
       )
97
       )
99
 
98
 
100
-
101
-
102
     );
99
     );
103
   }
100
   }
104
 }
101
 }
105
-

+ 19
- 13
lib/pages/OrderConfirmation/index.dart 查看文件

1
-import 'package:flutter/cupertino.dart';
2
 import 'package:flutter/material.dart';
1
 import 'package:flutter/material.dart';
3
 import 'package:flutter/services.dart';
2
 import 'package:flutter/services.dart';
4
 import 'package:flutter_screenutil/flutter_screenutil.dart';
3
 import 'package:flutter_screenutil/flutter_screenutil.dart';
5
 import 'package:get/get.dart';
4
 import 'package:get/get.dart';
5
+import 'package:get_storage/get_storage.dart';
6
 import 'package:intl/intl.dart';
6
 import 'package:intl/intl.dart';
7
 
7
 
8
 class OrderConfirmation extends StatefulWidget {
8
 class OrderConfirmation extends StatefulWidget {
19
 
19
 
20
   var selectDate; //选择的时间
20
   var selectDate; //选择的时间
21
   var workingArea;
21
   var workingArea;
22
-
23
-
22
+  String address = '请选择详细地址';
23
+  @override
24
+  void initState() {
25
+    super.initState();
26
+    //到底哪里错了 唉
27
+    // if (GetStorage().read("address") != null) {
28
+    //   address = GetStorage().read("address").address;
29
+    // }
30
+  }
24
 //  20:59:59
31
 //  20:59:59
25
 
32
 
26
   @override
33
   @override
76
                 floatingLabelBehavior: FloatingLabelBehavior.never,
83
                 floatingLabelBehavior: FloatingLabelBehavior.never,
77
                 hintText: "请输入具体面积(公顷)",
84
                 hintText: "请输入具体面积(公顷)",
78
               ),
85
               ),
79
-              onChanged: (e){
86
+              onChanged: (e) {
80
                 setState(() {
87
                 setState(() {
81
-                  workingArea=e;
88
+                  workingArea = e;
82
                 });
89
                 });
83
               },
90
               },
84
               // 校验用户名
91
               // 校验用户名
173
                   Padding(
180
                   Padding(
174
                       padding: EdgeInsets.fromLTRB(10, 0, 0, 0),
181
                       padding: EdgeInsets.fromLTRB(10, 0, 0, 0),
175
                       child: GestureDetector(
182
                       child: GestureDetector(
176
-                        onTap: () {},
183
+                        onTap: () {
184
+                          Get.toNamed('/addressList',
185
+                              arguments: {'isBack': true});
186
+                        },
177
                         child: Container(
187
                         child: Container(
178
                           width: 290.w,
188
                           width: 290.w,
179
                           child: Text(
189
                           child: Text(
180
-                            '请选择详细地址',
190
+                            address,
181
                             softWrap: true,
191
                             softWrap: true,
182
                             maxLines: 1,
192
                             maxLines: 1,
183
                             textAlign: TextAlign.left,
193
                             textAlign: TextAlign.left,
189
               ),
199
               ),
190
             ),
200
             ),
191
 
201
 
192
-            // 登录按钮
193
             Spacer(),
202
             Spacer(),
194
             Container(
203
             Container(
195
               alignment: Alignment.bottomCenter,
204
               alignment: Alignment.bottomCenter,
199
                 child: ElevatedButton(
208
                 child: ElevatedButton(
200
                   onPressed: () {
209
                   onPressed: () {
201
                     if ((_formKey.currentState as FormState).validate()) {
210
                     if ((_formKey.currentState as FormState).validate()) {
202
-                      var a={selectDate,workingArea};
211
+                      var a = {selectDate, workingArea};
203
                       print('我确定了$a');
212
                       print('我确定了$a');
204
                       //验证通过提交数据
213
                       //验证通过提交数据
214
+                      Get.toNamed('/orderPageInfo');
205
                     }
215
                     }
206
                   },
216
                   },
207
                   child: const Text(
217
                   child: const Text(
260
     );
270
     );
261
   }
271
   }
262
 }
272
 }
263
-
264
-
265
-
266
-

+ 5
- 1
lib/pages/TabBar/widgets/home/index.dart 查看文件

35
       child: ListView(
35
       child: ListView(
36
         children: [
36
         children: [
37
 
37
 
38
-          TypeHeader(type: true,),
38
+          Container(
39
+            width:20.w ,
40
+            child: TypeHeader(type: true,),
41
+          ),
42
+
39
 
43
 
40
           Container(
44
           Container(
41
             margin: EdgeInsets.fromLTRB(0, 15, 0, 0),
45
             margin: EdgeInsets.fromLTRB(0, 15, 0, 0),

+ 59
- 76
lib/pages/TabBar/widgets/home/widgets/headers.dart 查看文件

1
 import 'package:flutter/material.dart';
1
 import 'package:flutter/material.dart';
2
 import 'package:flutter_screenutil/flutter_screenutil.dart';
2
 import 'package:flutter_screenutil/flutter_screenutil.dart';
3
+import 'package:get/get.dart';
4
+
3
 
5
 
4
 class TypeHeader extends StatefulWidget {
6
 class TypeHeader extends StatefulWidget {
5
   TypeHeader({Key? key, required this.type}) : super(key: key);
7
   TypeHeader({Key? key, required this.type}) : super(key: key);
12
 
14
 
13
 class _TypeHeaderState extends State<TypeHeader> {
15
 class _TypeHeaderState extends State<TypeHeader> {
14
   @override
16
   @override
15
-  Widget build(BuildContext context) {
17
+  Widget build (BuildContext context) {
16
     if (widget.type) {
18
     if (widget.type) {
17
       return Container(
19
       return Container(
18
         child: Row(
20
         child: Row(
39
                       ),
41
                       ),
40
                     ),
42
                     ),
41
                   ),
43
                   ),
42
-                  const Icon(Icons.arrow_drop_down),
43
-                  Container(
44
-                      padding: EdgeInsets.fromLTRB(15.w, 0, 0, 0),
45
-                      width: 260.w,
46
-                      height: 32.w,
47
-                      decoration: const BoxDecoration(color: Colors.white),
48
-                      child: GestureDetector(
49
-                          onTap: () {
50
-                            print('点击了搜索');
51
-                          },
52
-                          child: Container(
53
-                            decoration: const BoxDecoration(
54
-                              // color: Colors.red,
55
-                              color: Color(0x30cccccc),
56
-                              borderRadius:
57
-                                  BorderRadius.all(Radius.circular(25)),
58
-                            ),
59
-                            child: Row(
60
-                              children: [
61
-                                Padding(
62
-                                  padding: EdgeInsets.fromLTRB(15, 0, 5, 0),
63
-                                  child: Icon(
64
-                                    Icons.search,
65
-                                    size: 19,
66
-                                    color: Color(0xff666666),
67
-                                  ),
68
-                                ),
69
-                                Text(
70
-                                  '请输入关键字查询',
71
-                                  style: TextStyle(
72
-                                      color: Color(0xff666666), fontSize: 14),
73
-                                )
74
-                              ],
75
-                            ),
76
-                          )
77
-                          // Search(),
78
-                          )),
44
+        Container(
45
+          padding: EdgeInsets.fromLTRB(0, 0, 10, 0),
46
+          child: Icon(Icons.arrow_drop_down),
47
+        ),
48
+                  _initWidget(),
79
                 ],
49
                 ],
80
               ),
50
               ),
81
             ),
51
             ),
83
         ),
53
         ),
84
       );
54
       );
85
     } else {
55
     } else {
86
-      return Container(
87
-          padding: EdgeInsets.fromLTRB(15.w, 0, 0, 0),
88
-          width: 260.w,
89
-          height: 32.w,
90
-          decoration: const BoxDecoration(color: Colors.white),
91
-          child: GestureDetector(
92
-              onTap: () {
93
-                print('点击了搜索');
94
-              },
95
-              child: Container(
96
-                decoration: const BoxDecoration(
97
-                  // color: Colors.red,
98
-                  color: Color(0x30cccccc),
99
-                  borderRadius: BorderRadius.all(Radius.circular(25)),
100
-                ),
101
-                child: Row(
102
-                  children: [
103
-                    Padding(
104
-                      padding: EdgeInsets.fromLTRB(15, 0, 5, 0),
105
-                      child: Icon(
106
-                        Icons.search,
107
-                        size: 19,
108
-                        color: Color(0xff666666),
109
-                      ),
110
-                    ),
111
-                    Text(
112
-                      '请输入关键字查询',
113
-                      style: TextStyle(color: Color(0xff666666), fontSize: 14),
114
-                    )
115
-                  ],
116
-                ),
117
-              )
118
-              // Search(),
119
-              ));
56
+      return _initWidget();
57
+
120
     }
58
     }
59
+
60
+
121
   }
61
   }
122
 }
62
 }
123
-
124
-// Widget _initWidget (TypeHeader flag) {
125
 //
63
 //
126
-//
127
-// }
64
+
65
+
66
+class _initWidget extends StatelessWidget {
67
+  const _initWidget({Key? key}) : super(key: key);
68
+
69
+  @override
70
+  Widget build(BuildContext context) {
71
+    return Container(
72
+        width: 255.w,
73
+        height: 32.w,
74
+        decoration: const BoxDecoration(color: Colors.white),
75
+        child: GestureDetector(
76
+            onTap: () {
77
+              print('点击了搜索');
78
+              Get.toNamed('/searchPage');
79
+
80
+            },
81
+            child: Container(
82
+              decoration: const BoxDecoration(
83
+                // color: Colors.red,
84
+                color: Color(0x30cccccc),
85
+                borderRadius: BorderRadius.all(Radius.circular(25)),
86
+              ),
87
+              child: Row(
88
+                children: [
89
+                  Padding(
90
+                    padding: EdgeInsets.fromLTRB(15, 0, 5, 0),
91
+                    child: Icon(
92
+                      Icons.search,
93
+                      size: 19,
94
+                      color: Color(0xff666666),
95
+                    ),
96
+                  ),
97
+                  Text(
98
+                    '请输入关键字查询',
99
+                    style: TextStyle(color: Color(0xff666666), fontSize: 14),
100
+                  )
101
+                ],
102
+              ),
103
+            )
104
+          // Search(),
105
+        ));
106
+
107
+  }
108
+}
109
+
110
+

+ 42
- 24
lib/pages/addressList/index.dart 查看文件

5
 import 'package:flutter_screenutil/flutter_screenutil.dart';
5
 import 'package:flutter_screenutil/flutter_screenutil.dart';
6
 import 'package:fluttertoast/fluttertoast.dart';
6
 import 'package:fluttertoast/fluttertoast.dart';
7
 import 'package:get/get.dart';
7
 import 'package:get/get.dart';
8
-
8
+import 'package:get_storage/get_storage.dart';
9
 
9
 
10
 class AddressList extends StatefulWidget {
10
 class AddressList extends StatefulWidget {
11
   const AddressList({Key? key}) : super(key: key);
11
   const AddressList({Key? key}) : super(key: key);
15
 }
15
 }
16
 
16
 
17
 class _AddressList extends State<AddressList> {
17
 class _AddressList extends State<AddressList> {
18
+  bool isBack = false;
19
+
20
+  @override
21
+  void initState() {
22
+    super.initState();
23
+    if (Get.arguments != null) {
24
+      isBack = Get.arguments['isBack'];
25
+    }
26
+  }
18
 
27
 
19
   List<Address> addressList = [
28
   List<Address> addressList = [
20
     Address.fromJson({'address': '777', 'isDefault': false}),
29
     Address.fromJson({'address': '777', 'isDefault': false}),
31
       addressList[index].isDefault = true;
40
       addressList[index].isDefault = true;
32
     });
41
     });
33
   }
42
   }
34
-  void onDelete(index){
43
+
44
+  void onDelete(index) {
35
     showDialog(
45
     showDialog(
36
         context: context,
46
         context: context,
37
         builder: (context) {
47
         builder: (context) {
38
-          return AlertDialog(
39
-              content: Text("您确定要删除此地址吗?"),
40
-              actions: <Widget>[
41
-                TextButton(
42
-                  child: Text("取消"),
43
-                  onPressed: () {
44
-                    print("取消");
45
-                    Navigator.pop(context, 'Cancle');
46
-                  },
47
-                ),
48
-                TextButton(
49
-                    child: Text("确定"),
50
-                    onPressed: () {
51
-                      // setState(() {
52
-                      //   addressList.remove(addressList[e]);
53
-                      // });
54
-                      Navigator.pop(context, "Ok");
55
-                      Fluttertoast.showToast(
56
-                          msg: '删除成功!');
57
-                    })
58
-              ]);
48
+          return AlertDialog(content: Text("您确定要删除此地址吗?"), actions: <Widget>[
49
+            TextButton(
50
+              child: Text("取消"),
51
+              onPressed: () {
52
+                print("取消");
53
+                Navigator.pop(context, 'Cancle');
54
+              },
55
+            ),
56
+            TextButton(
57
+                child: Text("确定"),
58
+                onPressed: () {
59
+                  // setState(() {
60
+                  //   addressList.remove(addressList[e]);
61
+                  // });
62
+                  Navigator.pop(context, "Ok");
63
+                  Fluttertoast.showToast(msg: '删除成功!');
64
+                })
65
+          ]);
59
         });
66
         });
60
   }
67
   }
61
 
68
 
91
                           (e) => AddressCard(
98
                           (e) => AddressCard(
92
                             No: e + 1,
99
                             No: e + 1,
93
                             item: addressList[e],
100
                             item: addressList[e],
101
+                            isBack: isBack,
94
                             onChange: () {
102
                             onChange: () {
95
                               onChange(e);
103
                               onChange(e);
96
                             },
104
                             },
97
                             onEdit: () {
105
                             onEdit: () {
98
-                              Get.toNamed('/addAddress',arguments: {'item':addressList[e]});
106
+                              Get.toNamed('/addAddress',
107
+                                  arguments: {'item': addressList[e]});
99
                             },
108
                             },
100
                             onDelete: () {
109
                             onDelete: () {
101
                               onDelete(e);
110
                               onDelete(e);
102
                             },
111
                             },
112
+                            onBack: () {
113
+                              if(GetStorage().read('address')==null) {
114
+                                GetStorage().write('address', addressList[e]);
115
+                              }else {
116
+                                GetStorage().remove('address');
117
+                                GetStorage().write('address', addressList[e]);
118
+                              }
119
+                              Get.back();
120
+                            },
103
                           ),
121
                           ),
104
                         )
122
                         )
105
                         .toList()),
123
                         .toList()),

+ 56
- 35
lib/pages/addressList/widget/AddressCard.dart 查看文件

6
 class AddressCard extends StatefulWidget {
6
 class AddressCard extends StatefulWidget {
7
   final Address item;
7
   final Address item;
8
   final int No;
8
   final int No;
9
+  final bool isBack;
9
   final GestureTapCallback onChange;
10
   final GestureTapCallback onChange;
10
   final GestureTapCallback onDelete;
11
   final GestureTapCallback onDelete;
11
   final GestureTapCallback onEdit;
12
   final GestureTapCallback onEdit;
12
-  AddressCard(
13
+  final GestureTapCallback onBack;
14
+  const AddressCard(
13
       {Key? key,
15
       {Key? key,
14
       required this.item,
16
       required this.item,
15
       required this.No,
17
       required this.No,
18
+      required this.isBack,
16
       required this.onChange,
19
       required this.onChange,
17
       required this.onDelete,
20
       required this.onDelete,
18
-      required this.onEdit})
21
+      required this.onEdit,
22
+      required this.onBack})
19
       : super(key: key);
23
       : super(key: key);
20
 
24
 
21
   @override
25
   @override
22
   _AddressCard createState() =>
26
   _AddressCard createState() =>
23
-      _AddressCard(item, No, onChange, onDelete, onEdit);
27
+      _AddressCard(item, No, onChange, onDelete, onEdit, isBack, onBack);
24
 }
28
 }
25
 
29
 
26
 class _AddressCard extends State<AddressCard> {
30
 class _AddressCard extends State<AddressCard> {
27
   final Address item;
31
   final Address item;
28
   final int No;
32
   final int No;
33
+  final bool isBack;
29
   final GestureTapCallback onChange;
34
   final GestureTapCallback onChange;
30
   final GestureTapCallback onDelete;
35
   final GestureTapCallback onDelete;
31
   final GestureTapCallback onEdit;
36
   final GestureTapCallback onEdit;
32
-  _AddressCard(this.item, this.No, this.onChange, this.onDelete, this.onEdit);
37
+  final GestureTapCallback onBack;
38
+  _AddressCard(this.item, this.No, this.onChange, this.onDelete, this.onEdit,
39
+      this.isBack, this.onBack);
33
   @override
40
   @override
34
   Widget build(BuildContext context) {
41
   Widget build(BuildContext context) {
35
     return Container(
42
     return Container(
81
               decoration: BoxDecoration(
88
               decoration: BoxDecoration(
82
                 border: Border(
89
                 border: Border(
83
                   bottom: BorderSide(
90
                   bottom: BorderSide(
84
-                      width: 0.5.h,
91
+                      width: 1.h,
85
                       color: const Color(0xcc000000),
92
                       color: const Color(0xcc000000),
86
                       style: BorderStyle.solid),
93
                       style: BorderStyle.solid),
87
                 ),
94
                 ),
113
               ),
120
               ),
114
             ),
121
             ),
115
           ),
122
           ),
116
-          Row(
117
-            mainAxisAlignment: MainAxisAlignment.spaceBetween,
118
-            children: [
119
-              GestureDetector(
120
-                onTap: onChange,
121
-                child: Row(
122
-                  children: [
123
-                    const Text('设为默认地址'),
124
-                    Radio<bool>(
125
-                        value: true,
126
-                        activeColor: const Color(0xFFFF703B),
127
-                        groupValue: item.isDefault,
128
-                        onChanged: (value){
129
-                          onChange();
130
-                        }),
131
-                  ],
123
+          if (isBack)
124
+            GestureDetector(
125
+              onTap: onBack,
126
+              child: Container(
127
+                width: 315.w,
128
+                margin: EdgeInsets.fromLTRB(0, 5.w, 0, 0),
129
+                child: Text(
130
+                  '选择此地址',
131
+                  style:
132
+                      TextStyle(fontSize: 17.sp, fontWeight: FontWeight.w800),
132
                 ),
133
                 ),
133
               ),
134
               ),
134
-              GestureDetector(
135
-                onTap: onDelete,
136
-                child: Row(
137
-                  children: [
138
-                    const Text('删除'),
139
-                    Image.asset(
140
-                      'images/icons/delete.png',
141
-                      width: 25.w,
142
-                      height: 25.w,
143
-                    ),
144
-                  ],
135
+            ),
136
+          if (!isBack)
137
+            Row(
138
+              mainAxisAlignment: MainAxisAlignment.spaceBetween,
139
+              children: [
140
+                GestureDetector(
141
+                  onTap: onChange,
142
+                  child: Row(
143
+                    children: [
144
+                      const Text('设为默认地址'),
145
+                      Radio<bool>(
146
+                          value: true,
147
+                          activeColor: const Color(0xFFFF703B),
148
+                          groupValue: item.isDefault,
149
+                          onChanged: (value) {
150
+                            onChange();
151
+                          }),
152
+                    ],
153
+                  ),
145
                 ),
154
                 ),
146
-              ),
147
-            ],
148
-          ),
155
+                GestureDetector(
156
+                  onTap: onDelete,
157
+                  child: Row(
158
+                    children: [
159
+                      const Text('删除'),
160
+                      Image.asset(
161
+                        'images/icons/delete.png',
162
+                        width: 25.w,
163
+                        height: 25.w,
164
+                      ),
165
+                    ],
166
+                  ),
167
+                ),
168
+              ],
169
+            ),
149
         ],
170
         ],
150
       ),
171
       ),
151
     );
172
     );

+ 4
- 2
lib/pages/machinery/detail/index.dart 查看文件

9
 
9
 
10
   // 响应预约事件
10
   // 响应预约事件
11
   void handleClick() {
11
   void handleClick() {
12
-
12
+    Get.toNamed('/orderConfirmation');
13
   }
13
   }
14
 
14
 
15
   @override
15
   @override
18
 
18
 
19
     return Scaffold(
19
     return Scaffold(
20
       appBar: appBar,
20
       appBar: appBar,
21
-      body: page(context: context, appbarSize: appBar.preferredSize, handleClick: handleClick),
21
+      body: SingleChildScrollView(
22
+        child: page(context: context, handleClick: handleClick),
23
+      ),
22
     );
24
     );
23
   }
25
   }
24
 
26
 

+ 48
- 41
lib/pages/machinery/detail/widgets/detail.dart 查看文件

1
 
1
 
2
+import 'package:farmer_client/pages/machinery/widgets/DefLayout.dart';
3
+import 'package:farmer_client/pages/machinery/widgets/RoundButton.dart';
2
 import 'package:flutter/widgets.dart';
4
 import 'package:flutter/widgets.dart';
3
 import 'package:flutter/material.dart';
5
 import 'package:flutter/material.dart';
4
 import 'package:flutter_screenutil/flutter_screenutil.dart';
6
 import 'package:flutter_screenutil/flutter_screenutil.dart';
5
-
7
+import 'package:farmer_client/widgets/ExtendContentList.dart';
8
+import 'package:farmer_client/models/entities/ExtendContent.dart';
6
 import '../../widgets/summary.dart';
9
 import '../../widgets/summary.dart';
7
 
10
 
8
-Widget page({ required BuildContext context, required Size appbarSize, required void Function() handleClick}) {
9
-  final _offset = 20.w;
10
-  final width = MediaQuery.of(context).size.width;
11
-  final height = MediaQuery.of(context).size.height
12
-      - appbarSize.height
13
-      - MediaQuery.of(context).padding.top;
14
-  final _bannerHeight = 250.w;
11
+Widget page({ required BuildContext context, VoidCallback? handleClick}) {
15
   final img = 'https://yz-websit.oss-cn-hangzhou.aliyuncs.com/xlk/index-icon19.jpg';
12
   final img = 'https://yz-websit.oss-cn-hangzhou.aliyuncs.com/xlk/index-icon19.jpg';
16
 
13
 
17
-  return Stack(
18
-    alignment: Alignment.topCenter,
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
+
24
+  return DefLayout(
25
+      head: Image.network(img, fit: BoxFit.cover),
19
       children: [
26
       children: [
20
-        // 第一个组件用来撑满全屏
21
-        SizedBox(
22
-          width: width,
23
-          height: height,
24
-        ),
25
-        Positioned(
26
-          left: 0,
27
-          top: 0,
28
-          child: SizedBox(
29
-            height: _bannerHeight,
30
-            child: _banner(img),
31
-          ),
32
-        ),
33
-        Positioned(
34
-          left: 0,
35
-          top: _bannerHeight - _offset,
36
-          child: _content(context),
37
-        ),
38
-      ],
27
+        DefLayout.card(
28
+          top: DefLayout.headHeight - DefLayout.offset,
29
+          padding: EdgeInsets.only(top: 45.w, left: 15.w, right: 15.w, bottom: 20.w),
30
+          child: _content(context, list, handleClick),
31
+        )
32
+      ]
39
   );
33
   );
40
 }
34
 }
41
 
35
 
42
-Widget _banner(String imgUrl) {
43
-  return Image.network(imgUrl);
36
+Widget _content(BuildContext context, List<ExtendContent> list, VoidCallback? handleClick) {
37
+  return Column(
38
+    children: [
39
+      summary(),
40
+      _sectionHead('农机详情'),
41
+      ExtendContentList(list: list),
42
+      SizedBox(height: 20.w,),
43
+      RoundButton(text: "预约", onPressed: handleClick,)
44
+    ],
45
+  );
44
 }
46
 }
45
 
47
 
46
-Widget _content(BuildContext context) {
47
-  final _border = 20.w;
48
+Widget _sectionHead(String title) {
49
+  Widget img = SizedBox(
50
+    width: 16.w,
51
+    height: 16.w,
52
+    child: Image.asset('images/decorate.png'),
53
+  );
54
+
48
   return Container(
55
   return Container(
49
-    width: MediaQuery.of(context).size.width,
50
-    padding: EdgeInsets.only(top: 45.w, left: 15.w, right: 15.w, bottom: 20.w),
51
-    decoration: BoxDecoration(
52
-      color: Colors.white,
53
-        borderRadius: BorderRadius.vertical(top: Radius.circular(_border))
54
-    ),
55
-    child: Column(
56
+    padding: EdgeInsets.fromLTRB(0, 20.w, 0, 20.w),
57
+    child: Row(
58
+      mainAxisAlignment: MainAxisAlignment.center,
56
       children: [
59
       children: [
57
-        summary(),
60
+        img,
61
+        SizedBox(width: 20.w),
62
+        Text(title, style: TextStyle(fontSize: 16.sp, color: const Color(0xFF222222), fontWeight: FontWeight.w500),),
63
+        SizedBox(width: 20.w),
64
+        img,
58
       ],
65
       ],
59
     ),
66
     ),
60
   );
67
   );

+ 8
- 1
lib/pages/machinery/map/index.dart 查看文件

16
   @override
16
   @override
17
   Widget build(BuildContext context) {
17
   Widget build(BuildContext context) {
18
     final appBar = AppBar(title: Obx(() => Text(title.value)), centerTitle: true,);
18
     final appBar = AppBar(title: Obx(() => Text(title.value)), centerTitle: true,);
19
-    return Scaffold(appBar: appBar, body: page(context: context, appbarSize: appBar.preferredSize, handleClick: handleClick),);
19
+    return Scaffold(
20
+      appBar: appBar,
21
+      body: SafeArea(
22
+        child: SingleChildScrollView (
23
+          child: page(context: context, handleClick: handleClick),
24
+        ),
25
+      )
26
+    );
20
   }
27
   }
21
   
28
   
22
 }
29
 }

+ 25
- 77
lib/pages/machinery/map/widgets/detail.dart 查看文件

1
 
1
 
2
+import 'package:farmer_client/pages/machinery/widgets/DefLayout.dart';
3
+import 'package:farmer_client/pages/machinery/widgets/RoundButton.dart';
2
 import 'package:flutter/material.dart';
4
 import 'package:flutter/material.dart';
3
 import 'package:flutter/widgets.dart';
5
 import 'package:flutter/widgets.dart';
4
 import 'package:flutter_screenutil/flutter_screenutil.dart';
6
 import 'package:flutter_screenutil/flutter_screenutil.dart';
7
 
9
 
8
 import '../../widgets/summary.dart';
10
 import '../../widgets/summary.dart';
9
 
11
 
10
-Widget page({ required BuildContext context, required Size appbarSize, required void Function() handleClick}) {
12
+Widget page({ required BuildContext context, VoidCallback? handleClick}) {
11
   final _offset = 20.w;
13
   final _offset = 20.w;
12
   final width = MediaQuery.of(context).size.width;
14
   final width = MediaQuery.of(context).size.width;
13
-  final height = MediaQuery.of(context).size.height
14
-      - appbarSize.height
15
-      - MediaQuery.of(context).padding.top;
16
-  final mapHeight = height * 0.3;
17
-  final cardHeight = (height - mapHeight) / 2 + _offset;
15
+  final mapHeight = 226.5.w;
16
+  final cardHeight = 250.w;
18
 
17
 
19
 
18
 
20
   final img = 'https://yz-websit.oss-cn-hangzhou.aliyuncs.com/xlk/index-icon19.jpg';
19
   final img = 'https://yz-websit.oss-cn-hangzhou.aliyuncs.com/xlk/index-icon19.jpg';
21
   final LatLng position = LatLng(32.690712, 112.091892);
20
   final LatLng position = LatLng(32.690712, 112.091892);
22
 
21
 
23
-  return Stack(
24
-    alignment: Alignment.topCenter,
25
-    children: [
26
-      // 第一个组件用来撑满全屏
27
-      SizedBox(
28
-        width: width,
29
-        height: height,
30
-      ),
31
-      SizedBox(
32
-        width: width,
33
-        height: mapHeight,
34
-        child: AMap(position: position),
35
-      ),
36
-      Positioned(
37
-        left: 0,
38
-        top: mapHeight - _offset,
39
-        height: cardHeight,
40
-        child: _thumb(context, img),
41
-      ),
42
-      Positioned(
43
-        left: 0,
44
-        top: mapHeight + cardHeight - 2 * _offset,
45
-        height: cardHeight,
46
-        child: _content(context, handleClick),
47
-      ),
48
-    ],);
49
-}
50
-
51
-Widget _card(BuildContext context, Widget child) {
52
-  final _border = 20.w;
53
-  return Container(
54
-    width: MediaQuery.of(context).size.width,
55
-    clipBehavior: Clip.hardEdge,
56
-    decoration: BoxDecoration(
57
-        borderRadius: BorderRadius.vertical(top: Radius.circular(_border))
58
-    ),
59
-    child: child,
22
+  return DefLayout(
23
+      head: AMap(position: position),
24
+      children: [
25
+        DefLayout.card(
26
+            top: DefLayout.headHeight - DefLayout.offset,
27
+            height: DefLayout.headHeight,
28
+            child: Image.network(img, fit: BoxFit.cover)
29
+        ),
30
+        DefLayout.card(
31
+            top: (DefLayout.headHeight - DefLayout.offset) * 2,
32
+            padding: EdgeInsets.only(top: 45.w, left: 15.w, right: 15.w, bottom: 20.w),
33
+            child: _content(context, handleClick)
34
+        ),
35
+      ]
60
   );
36
   );
61
 }
37
 }
62
 
38
 
63
-Widget _thumb(BuildContext context, String imgUrl) {
64
-  return _card(context, Image.network(imgUrl, fit: BoxFit.cover));
65
-}
66
-
67
-
68
-Widget _button(void Function() handleClick) {
69
-  return ElevatedButton(
70
-    child: const Text("预约"),
71
-    style: ElevatedButton.styleFrom(
72
-        primary: const Color(0xFFFF703B),
73
-        textStyle: TextStyle(color: Colors.white, fontSize: 20.sp, letterSpacing: 5.sp),
74
-        elevation: 0,
75
-        minimumSize: Size(double.infinity, 49.w),
76
-        shape: RoundedRectangleBorder(
77
-          borderRadius: BorderRadius.all(Radius.circular(24.5.w)),
78
-        )
79
-    ),
80
-    onPressed: handleClick,
39
+Widget _content(BuildContext context, VoidCallback? handleClick) {
40
+  return Column(
41
+    children: [
42
+      summary(),
43
+      RoundButton(text: "预约", onPressed: handleClick,),
44
+    ],
81
   );
45
   );
82
-}
83
-
84
-Widget _content(BuildContext context, void Function() handleClick) {
85
-  return _card(context, Container(
86
-    padding: EdgeInsets.only(top: 45.w, left: 15.w, right: 15.w, bottom: 20.w),
87
-    decoration: const BoxDecoration(
88
-      color: Colors.white,
89
-    ),
90
-    child: Column(
91
-
92
-      children: [
93
-        summary(),
94
-        _button(handleClick),
95
-      ],
96
-    ),
97
-  ));
98
 }
46
 }

+ 44
- 0
lib/pages/machinery/widgets/DefLayout.dart 查看文件

1
+
2
+import 'package:flutter/material.dart';
3
+import 'package:flutter_screenutil/flutter_screenutil.dart';
4
+
5
+class DefLayout extends StatelessWidget {
6
+  Widget head;
7
+  List<Widget> children;
8
+
9
+  DefLayout({Key? key, required this.head, required this.children}): super(key: key);
10
+
11
+  static double headHeight = 250.w;
12
+  static double offset = 20.w;
13
+
14
+  static Widget card({required double top, required Widget child, double? height, EdgeInsetsGeometry? padding}) {
15
+    final _border = 20.w;
16
+    return Container(
17
+      margin: EdgeInsets.only(top: top),
18
+      padding: padding,
19
+      height: height,
20
+      clipBehavior: Clip.hardEdge,
21
+      decoration: BoxDecoration(
22
+          color: Colors.white,
23
+          borderRadius: BorderRadius.vertical(top: Radius.circular(_border))
24
+      ),
25
+      child: child,
26
+    );
27
+  }
28
+
29
+  @override
30
+  Widget build(BuildContext context) {
31
+    final width = MediaQuery.of(context).size.width;
32
+
33
+    return Stack(
34
+      children: [
35
+        SizedBox(
36
+          width: width,
37
+          height: headHeight,
38
+          child: head,
39
+        ),
40
+        ...children,
41
+      ],
42
+    );
43
+  }
44
+}

+ 30
- 0
lib/pages/machinery/widgets/RoundButton.dart 查看文件

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

+ 3
- 3
lib/pages/machinery/widgets/summary.dart 查看文件

23
       Expanded(
23
       Expanded(
24
           child: Text("收割机001--S001",
24
           child: Text("收割机001--S001",
25
               style: TextStyle(
25
               style: TextStyle(
26
-                color: Color(0xFF222222),
26
+                color: const Color(0xFF222222),
27
                 fontSize: 18.sp,
27
                 fontSize: 18.sp,
28
                 fontWeight: FontWeight.bold,
28
                 fontWeight: FontWeight.bold,
29
               )),
29
               )),
72
       Icon(Icons.location_on_outlined, size: 16.sp,),
72
       Icon(Icons.location_on_outlined, size: 16.sp,),
73
       Expanded(
73
       Expanded(
74
         flex: 1,
74
         flex: 1,
75
-        child: Text("距离当前位置2.3公里 >>", style: TextStyle(color: Color(0xFF222222), fontSize: 15.sp),),
75
+        child: Text("距离当前位置2.3公里 >>", style: TextStyle(color: const Color(0xFF222222), fontSize: 15.sp),),
76
       ),
76
       ),
77
     ],
77
     ],
78
   );
78
   );
81
 Widget _detail() {
81
 Widget _detail() {
82
   return Container(
82
   return Container(
83
     alignment: Alignment.centerLeft,
83
     alignment: Alignment.centerLeft,
84
-    child: Text("农机手1的收割机", style: TextStyle(color: Color(0xFF222222), fontSize: 15.sp),),
84
+    child: Text("农机手1的收割机", style: TextStyle(color: const Color(0xFF222222), fontSize: 15.sp),),
85
   );
85
   );
86
 }
86
 }

+ 103
- 32
lib/pages/orderInfo/index.dart 查看文件

1
+import 'package:farmer_client/widgets/DefaultButton.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:fluttertoast/fluttertoast.dart';
5
+import 'package:get/get.dart';
3
 
6
 
4
 import '../../widgets/OrderInfoCard.dart';
7
 import '../../widgets/OrderInfoCard.dart';
5
 
8
 
6
-
7
-
8
-
9
 class OrderPageInfo extends StatefulWidget {
9
 class OrderPageInfo extends StatefulWidget {
10
   const OrderPageInfo({Key? key}) : super(key: key);
10
   const OrderPageInfo({Key? key}) : super(key: key);
11
 
11
 
14
 }
14
 }
15
 
15
 
16
 class _OrderPageInfoState extends State<OrderPageInfo> {
16
 class _OrderPageInfoState extends State<OrderPageInfo> {
17
+  void onCancel() {
18
+    showDialog(
19
+        context: context,
20
+        builder: (context) {
21
+          return AlertDialog(content: Text("您确定要取消订单吗?"), actions: <Widget>[
22
+            TextButton(
23
+              child: Text("取消"),
24
+              onPressed: () {
25
+                print("取消");
26
+                Navigator.pop(context, 'Cancle');
27
+              },
28
+            ),
29
+            TextButton(
30
+                child: Text("确定"),
31
+                onPressed: () {
32
+                  // setState(() {
33
+                  //   addressList.remove(addressList[e]);
34
+                  // });
35
+                  Navigator.pop(context, "Ok");
36
+                  Fluttertoast.showToast(msg: '取消成功!');
37
+                  Get.offAllNamed('/');
38
+                })
39
+          ]);
40
+        });
41
+  }
42
+
17
   @override
43
   @override
18
   Widget build(BuildContext context) {
44
   Widget build(BuildContext context) {
19
     return Scaffold(
45
     return Scaffold(
31
               fontWeight: FontWeight.bold),
57
               fontWeight: FontWeight.bold),
32
         ),
58
         ),
33
       ),
59
       ),
34
-      body:      Column(
60
+      body: Column(
35
         children: [
61
         children: [
36
           OrderInfoCard(),
62
           OrderInfoCard(),
37
-
63
+          Spacer(),
38
           Container(
64
           Container(
39
-            height: 130.h,
40
-            margin: EdgeInsets.only(top: 20.0, bottom: 0.0),
41
-            alignment: Alignment.bottomCenter,
42
-            child: SizedBox(
43
-              width: 315.w,
44
-              height: 49.h,
45
-              child: ElevatedButton(
46
-                onPressed: () {
47
-                  // _handelSubmit();
48
-                  print('用户点击了支付啊阿松大撒地方');
49
-                },
50
-                child: const Text(
51
-                  "支付",
52
-                  style: TextStyle(
53
-                      fontSize: 18,
54
-                      color: Colors.white,
55
-                      fontWeight: FontWeight.bold),
65
+            margin: EdgeInsets.fromLTRB(15.w, 0, 15.w, 50.h),
66
+            child: Row(
67
+              mainAxisAlignment: MainAxisAlignment.spaceBetween,
68
+              children: [
69
+                GestureDetector(
70
+                  onTap: () {
71
+                    onCancel();
72
+                  },
73
+                  child: Container(
74
+                    width: 150.w,
75
+                    height: 49.h,
76
+                    decoration: BoxDecoration(
77
+                        color: const Color(0xffffffff),
78
+                        border: Border.all(
79
+                            color: const Color(0xFFFF703B),
80
+                            width: 1.w,
81
+                            style: BorderStyle.solid),
82
+                        borderRadius:
83
+                            BorderRadius.all(Radius.circular(24.5.w))),
84
+                    child: Center(
85
+                      child: Text(
86
+                        '取消',
87
+                        style: TextStyle(
88
+                            fontSize: 20.sp,
89
+                            color: const Color(0xFFFF703B),
90
+                            fontWeight: FontWeight.bold),
91
+                      ),
92
+                    ),
93
+                  ),
56
                 ),
94
                 ),
57
-                style: ButtonStyle(
58
-                  elevation: MaterialStateProperty.all(0),
59
-                  backgroundColor:
60
-                  MaterialStateProperty.all(const Color(0xFFFF703B)),
61
-                  shape: MaterialStateProperty.all(
62
-                      const RoundedRectangleBorder(
63
-                          borderRadius:
64
-                          BorderRadius.all(Radius.circular(24.4)))),
95
+                DefaultButton(
96
+                  color: const Color(0xffffffff),
97
+                  backColor: const Color(0xFFFF703B),
98
+                  width: 150.w,
99
+                  height: 49.h,
100
+                  text: '支付',
101
+                  onPressed: () {
102
+                    Fluttertoast.showToast(msg: '支付成功!');
103
+                    Get.offAllNamed('/');
104
+                  },
105
+                  margin: const EdgeInsets.all(0),
106
+                  fontSize: 20.sp,
107
+                  radius: 24.5.w,
65
                 ),
108
                 ),
66
-              ),
109
+              ],
67
             ),
110
             ),
68
           ),
111
           ),
112
+          // Container(
113
+          //   height: 130.h,
114
+          //   margin: EdgeInsets.only(top: 20.0, bottom: 0.0),
115
+          //   alignment: Alignment.bottomCenter,
116
+          //   child: SizedBox(
117
+          //     width: 315.w,
118
+          //     height: 49.h,
119
+          //     child: ElevatedButton(
120
+          //       onPressed: () {
121
+          //         // _handelSubmit();
122
+          //         print('用户点击了支付啊阿松大撒地方');
123
+          //       },
124
+          //       child: const Text(
125
+          //         "支付",
126
+          //         style: TextStyle(
127
+          //             fontSize: 18,
128
+          //             color: Colors.white,
129
+          //             fontWeight: FontWeight.bold),
130
+          //       ),
131
+          //       style: ButtonStyle(
132
+          //         elevation: MaterialStateProperty.all(0),
133
+          //         backgroundColor:
134
+          //             MaterialStateProperty.all(const Color(0xFFFF703B)),
135
+          //         shape: MaterialStateProperty.all(const RoundedRectangleBorder(
136
+          //             borderRadius: BorderRadius.all(Radius.circular(24.4)))),
137
+          //       ),
138
+          //     ),
139
+          //   ),
140
+          // ),
69
         ],
141
         ],
70
       ),
142
       ),
71
     );
143
     );
72
-
73
   }
144
   }
74
 }
145
 }

+ 87
- 0
lib/pages/search/index.jsx.dart 查看文件

1
+import 'package:farmer_client/widgets/NullCard.dart';
2
+import 'package:flutter/material.dart';
3
+import 'package:flutter_screenutil/flutter_screenutil.dart';
4
+import '../../widgets/CarsCard.dart';
5
+
6
+class SearchPage extends StatefulWidget {
7
+  const SearchPage({Key? key}) : super(key: key);
8
+
9
+  @override
10
+  State<SearchPage> createState() => _SearchPage();
11
+}
12
+
13
+class _SearchPage extends State<SearchPage> {
14
+  @override
15
+  Widget build(BuildContext context) {
16
+    return Scaffold(
17
+      resizeToAvoidBottomInset: false,
18
+      appBar: AppBar(
19
+        elevation: 0,
20
+        centerTitle: true,
21
+        backgroundColor: Colors.white,
22
+        title: Text(
23
+          '搜索',
24
+          style: TextStyle(
25
+              color: Colors.black,
26
+              fontSize: 17.sp,
27
+              letterSpacing: 2,
28
+              fontWeight: FontWeight.bold),
29
+        ),
30
+      ),
31
+      body: Container(
32
+          decoration: const BoxDecoration(
33
+            color: Colors.white,
34
+          ),
35
+          child: ListView(children: [
36
+            Container(
37
+              width: 345.w,
38
+              height: 34.h,
39
+              margin: EdgeInsets.symmetric(vertical: 15.h, horizontal: 15.w),
40
+              padding: EdgeInsets.symmetric(vertical: 0, horizontal: 10.w),
41
+              decoration: BoxDecoration(
42
+                  color: Color(0xFFf8f8f8),
43
+                  borderRadius: BorderRadius.all(Radius.circular(17.w))),
44
+              child: Row(
45
+                mainAxisAlignment: MainAxisAlignment.center,
46
+                children: [
47
+                  Image.asset(
48
+                    'images/icons/search.png',
49
+                    width: 15.w,
50
+                    height: 15.w,
51
+                  ),
52
+                  Container(
53
+                    width: 300.w,
54
+                    margin: EdgeInsets.fromLTRB(5.w, 0, 0, 0),
55
+                    child: TextField(
56
+                      style: TextStyle(fontSize: 14.sp),
57
+                      decoration: const InputDecoration(
58
+                        isCollapsed: true,
59
+                        hintText: '搜索关键字查询',
60
+                        border: InputBorder.none,
61
+                        counterText: '', //去掉计数
62
+                        floatingLabelBehavior: FloatingLabelBehavior.never,
63
+                      ),
64
+                      onChanged: (e) {
65
+                        print(999);
66
+                        setState(() {});
67
+                      },
68
+                    ),
69
+                  ),
70
+                ],
71
+              ),
72
+            ),
73
+            Container(
74
+              child: Column(
75
+                children: [
76
+                  // NullCard(text: '暂无农机信息'),
77
+                  CarsCard(),
78
+                  CarsCard(),
79
+                  CarsCard(),
80
+                  CarsCard(),
81
+                ],
82
+              ),
83
+            )
84
+          ])),
85
+    );
86
+  }
87
+}

+ 7
- 0
lib/routes/pages.dart 查看文件

1
 
1
 
2
 import 'package:farmer_client/pages/ArticleInfo/ArticleInfo.dart';
2
 import 'package:farmer_client/pages/ArticleInfo/ArticleInfo.dart';
3
+import 'package:farmer_client/pages/OrderConfirmation/index.dart';
3
 import 'package:farmer_client/pages/aboutUs/index.dart';
4
 import 'package:farmer_client/pages/aboutUs/index.dart';
4
 import 'package:farmer_client/pages/addAddress/index.dart';
5
 import 'package:farmer_client/pages/addAddress/index.dart';
5
 import 'package:farmer_client/pages/addressList/index.dart';
6
 import 'package:farmer_client/pages/addressList/index.dart';
6
 import 'package:farmer_client/pages/agreement/index.dart';
7
 import 'package:farmer_client/pages/agreement/index.dart';
7
 import 'package:farmer_client/pages/feedback/index.dart';
8
 import 'package:farmer_client/pages/feedback/index.dart';
9
+import 'package:farmer_client/pages/orderInfo/index.dart';
10
+import 'package:farmer_client/pages/search/index.jsx.dart';
8
 import 'package:farmer_client/pages/userInfo/index.dart';
11
 import 'package:farmer_client/pages/userInfo/index.dart';
9
 import 'package:get/get.dart';
12
 import 'package:get/get.dart';
10
 import '../pages/MoreCars/index.dart';
13
 import '../pages/MoreCars/index.dart';
20
   GetPage(name: '/addAddress', page: () =>  AddAddress()),
23
   GetPage(name: '/addAddress', page: () =>  AddAddress()),
21
   GetPage(name: '/userInfo', page: () =>  UserInfo()),
24
   GetPage(name: '/userInfo', page: () =>  UserInfo()),
22
   GetPage(name: '/machineryMap', page: () =>  MachineryMapPage()),
25
   GetPage(name: '/machineryMap', page: () =>  MachineryMapPage()),
26
+  GetPage(name: '/machineryDetail', page: () =>  MachineryDetailPage()),
23
   GetPage(name: '/aboutUs', page: () =>  AboutUs()),
27
   GetPage(name: '/aboutUs', page: () =>  AboutUs()),
24
   GetPage(name: '/agreement', page: () =>  Agreement()),
28
   GetPage(name: '/agreement', page: () =>  Agreement()),
25
   GetPage(name: '/feedback', page: () =>  Feedback()),
29
   GetPage(name: '/feedback', page: () =>  Feedback()),
30
+  GetPage(name: '/orderConfirmation', page: () =>  OrderConfirmation()),
31
+  GetPage(name: '/orderPageInfo', page: () =>  OrderPageInfo()),
32
+  GetPage(name: '/searchPage', page: () =>  SearchPage()),
26
 ];
33
 ];

+ 0
- 3
lib/widgets/CarsCard.dart 查看文件

38
           GestureDetector(
38
           GestureDetector(
39
             onTap: (){
39
             onTap: (){
40
               Get.to(MachineryDetailPage());
40
               Get.to(MachineryDetailPage());
41
-
42
             },
41
             },
43
             child:Image.network(
42
             child:Image.network(
44
               "http://yz-shigongli.oss-accelerate.aliyuncs.com/2022-03/1648094119154-7b280bbf63105a8e90299e2d79c8c6ee.jpeg",
43
               "http://yz-shigongli.oss-accelerate.aliyuncs.com/2022-03/1648094119154-7b280bbf63105a8e90299e2d79c8c6ee.jpeg",
113
                     child: ElevatedButton(
112
                     child: ElevatedButton(
114
                       onPressed: () {
113
                       onPressed: () {
115
                         Get.to(OrderConfirmation());
114
                         Get.to(OrderConfirmation());
116
-                        print('点我去预约');
117
-
118
                       },
115
                       },
119
                       child: const Text(
116
                       child: const Text(
120
                         "预约",
117
                         "预约",

+ 41
- 0
lib/widgets/ExtendContentList.dart 查看文件

1
+
2
+import 'package:flutter/widgets.dart';
3
+import 'package:flutter_screenutil/flutter_screenutil.dart';
4
+
5
+import '../models/entities/ExtendContent.dart';
6
+
7
+class ExtendContentList extends StatelessWidget {
8
+  final List<ExtendContent> list;
9
+
10
+  ExtendContentList({ Key? key, required this.list }) : super(key: key);
11
+  
12
+  Widget? _image(String? content) {
13
+    if (null == content || content.isEmpty) return null;
14
+    return Image.network(content, fit: BoxFit.cover);
15
+  }
16
+
17
+  Widget? _text(String? content) {
18
+    if (null == content || content.isEmpty) return null;
19
+    return Text(content);
20
+  }
21
+
22
+  @override
23
+  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,
38
+    );
39
+  }
40
+
41
+}

+ 33
- 0
lib/widgets/NullCard.dart 查看文件

1
+import 'package:flutter/material.dart';
2
+import 'package:flutter_screenutil/flutter_screenutil.dart';
3
+
4
+class NullCard extends StatelessWidget {
5
+  final String text;
6
+  const NullCard({Key? key, required this.text}) : super(key: key);
7
+  @override
8
+  Widget build(BuildContext context) {
9
+    return Container(
10
+      width: 345.w,
11
+      padding: EdgeInsets.all(30.w),
12
+      alignment: Alignment.center,
13
+      child: Column(
14
+        children: [
15
+          Container(
16
+            margin: EdgeInsets.fromLTRB(0, 0, 0, 22.h),
17
+            child: Image.asset(
18
+              'images/icons/nullDataImg.png',
19
+              width: 135.w,
20
+            ),
21
+          ),
22
+          Text(
23
+            text,
24
+            style: TextStyle(
25
+                fontSize: 17.sp, color: Color(0xFFb4b4b4)),
26
+          )
27
+        ],
28
+      ),
29
+    );
30
+  }
31
+
32
+
33
+}

+ 16
- 17
lib/widgets/Search.dart 查看文件

1
 import 'package:flutter/material.dart';
1
 import 'package:flutter/material.dart';
2
 import 'package:flutter_screenutil/flutter_screenutil.dart';
2
 import 'package:flutter_screenutil/flutter_screenutil.dart';
3
 
3
 
4
-
5
 class Search extends StatefulWidget {
4
 class Search extends StatefulWidget {
6
   const Search({Key? key}) : super(key: key);
5
   const Search({Key? key}) : super(key: key);
7
 
6
 
10
 }
9
 }
11
 
10
 
12
 class _SearchState extends State<Search> {
11
 class _SearchState extends State<Search> {
13
-
14
   @override
12
   @override
15
   Widget build(BuildContext context) {
13
   Widget build(BuildContext context) {
16
-    return LayoutBuilder(builder: (BuildContext context, BoxConstraints constraints){
17
-      return  Column(
14
+    return LayoutBuilder(
15
+        builder: (BuildContext context, BoxConstraints constraints) {
16
+      return Column(
18
         children: [
17
         children: [
19
           Container(
18
           Container(
20
-            decoration: BoxDecoration(
21
-              color: Colors.white
22
-            ),
23
-      width: constraints.maxWidth,
24
-      height: 34,
25
-      alignment: Alignment.center,
26
-      child:  TextField(
19
+            decoration: BoxDecoration(color: Colors.white),
20
+            width: 345.w,
21
+            height: 34,
22
+            alignment: Alignment.center,
23
+            child: TextField(
27
               onChanged: (value) {
24
               onChanged: (value) {
28
                 print('打一个字我搜索一下$value');
25
                 print('打一个字我搜索一下$value');
29
               },
26
               },
31
                 FocusScope.of(context).requestFocus(FocusNode());
28
                 FocusScope.of(context).requestFocus(FocusNode());
32
                 print('点击键盘搜索');
29
                 print('点击键盘搜索');
33
               },
30
               },
34
-              style: const TextStyle(fontSize: 15, color: Colors.black, textBaseline: TextBaseline.alphabetic),
31
+              style: const TextStyle(
32
+                  fontSize: 15,
33
+                  color: Colors.black,
34
+                  textBaseline: TextBaseline.alphabetic),
35
               decoration: const InputDecoration(
35
               decoration: const InputDecoration(
36
                 isDense: true,
36
                 isDense: true,
37
                 prefixIcon: Padding(
37
                 prefixIcon: Padding(
38
                   padding: EdgeInsets.only(left: 0),
38
                   padding: EdgeInsets.only(left: 0),
39
-                  child:  Icon(Icons.search,),
39
+                  child: Icon(
40
+                    Icons.search,
41
+                  ),
40
                 ),
42
                 ),
41
                 fillColor: Color(0x30cccccc),
43
                 fillColor: Color(0x30cccccc),
42
                 filled: true,
44
                 filled: true,
43
                 border: OutlineInputBorder(borderSide: BorderSide.none),
45
                 border: OutlineInputBorder(borderSide: BorderSide.none),
44
-      contentPadding: EdgeInsets.all(0),
46
+                contentPadding: EdgeInsets.all(0),
45
                 enabledBorder: OutlineInputBorder(
47
                 enabledBorder: OutlineInputBorder(
46
                     borderSide: BorderSide(color: Color(0x00FF0000)),
48
                     borderSide: BorderSide(color: Color(0x00FF0000)),
47
                     borderRadius: BorderRadius.all(Radius.circular(100))),
49
                     borderRadius: BorderRadius.all(Radius.circular(100))),
49
                 hintStyle: TextStyle(
51
                 hintStyle: TextStyle(
50
                   textBaseline: TextBaseline.alphabetic, //用于提示文字对齐
52
                   textBaseline: TextBaseline.alphabetic, //用于提示文字对齐
51
                 ),
53
                 ),
52
-
53
               ),
54
               ),
54
-
55
             ),
55
             ),
56
           ),
56
           ),
57
         ],
57
         ],
58
       );
58
       );
59
     });
59
     });
60
-
61
   }
60
   }
62
 }
61
 }

+ 1
- 1
pubspec.lock 查看文件

68
     dependency: "direct main"
68
     dependency: "direct main"
69
     description:
69
     description:
70
       name: carousel_slider
70
       name: carousel_slider
71
-      url: "https://pub.dartlang.org"
71
+      url: "https://pub.flutter-io.cn"
72
     source: hosted
72
     source: hosted
73
     version: "4.0.0"
73
     version: "4.0.0"
74
   characters:
74
   characters: