[baozhangchao] hace 3 años
padre
commit
53db685a2d

BIN
images/cars.png Ver fichero


BIN
images/gpsImgae.png Ver fichero


+ 1
- 0
lib/components/UI/Banner.dart Ver fichero

@@ -0,0 +1 @@
1
+import 'package:flutter/material.dart';

+ 141
- 12
lib/components/UI/CarsCard.dart Ver fichero

@@ -1,27 +1,156 @@
1
+import 'package:flutter/foundation.dart';
1 2
 import 'package:flutter/material.dart';
3
+import 'package:flutter_screenutil/flutter_screenutil.dart';
2 4
 
3 5
 
6
+class CarItem {
7
+  late String name ;
8
+  late num? price ;
9
+  late num? distance ;
10
+
11
+
12
+  CarItem({ required this.name,this.price,this.distance});
13
+
14
+
15
+}
16
+
4 17
 
5 18
 class CarsCard extends StatelessWidget {
6
-  const CarsCard({Key? key}) : super(key: key);
19
+  final CarItem item;
20
+
21
+
22
+  const CarsCard({Key? key, required this.item,}) : super(key: key);
7 23
 
8 24
   @override
9 25
   Widget build(BuildContext context) {
10 26
 
11
-    final Object Item;
12 27
 
13 28
     return Container(
14
-width: 20.0,
15
-      decoration: const BoxDecoration(
16
-        image: DecorationImage(
17
-          image: AssetImage("images/icon_login.png"),
18
-          fit: BoxFit.cover,
19
-        ),
29
+      decoration: BoxDecoration(
30
+        color: Color(0xfff2f2f2),
31
+      ),
32
+      width: 345.w,
33
+      // height: 389.h,
34
+      child: Column(
35
+        children: [
36
+          Image.network(
37
+            "http://yz-shigongli.oss-accelerate.aliyuncs.com/2022-03/1648094119154-7b280bbf63105a8e90299e2d79c8c6ee.jpeg",
38
+            width: 345.w,
39
+            height: 230.h,
40
+            fit: BoxFit.cover,
41
+          ),
42
+          Container(
43
+            padding: EdgeInsets.fromLTRB(15, 20, 0, 0),
44
+            child: Row(
45
+              crossAxisAlignment: CrossAxisAlignment.start,
46
+              verticalDirection: VerticalDirection.up,
47
+              children: <Widget>[
48
+                Container(
49
+                  child:  Text(
50
+                    item.name,
51
+                    style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold),
52
+                  ),
53
+                ),
54
+              ],
55
+            ),
56
+          ),
57
+          Container(
58
+            padding: const EdgeInsets.fromLTRB(19, 0, 0, 0),
59
+            child: Row(
60
+              crossAxisAlignment: CrossAxisAlignment.start,
61
+              verticalDirection: VerticalDirection.up,
62
+              mainAxisAlignment: MainAxisAlignment.spaceBetween,
63
+              children: <Widget>[
64
+                Container(
65
+                  child: RichText(
66
+                    text: const TextSpan(children: <InlineSpan>[
67
+                      TextSpan(
68
+                          text: '8555元/',
69
+                          style: TextStyle(
70
+                              color: Color(0xffce3800),
71
+                              fontSize: 22,
72
+                              fontWeight: FontWeight.bold)),
73
+                      TextSpan(
74
+                          text: '公顷',
75
+                          style: TextStyle(
76
+                              color: Color(0xffce3800),
77
+                              fontSize: 10,
78
+                              fontWeight: FontWeight.bold)),
79
+                    ]),
80
+                  ),
81
+                ),
82
+                Align(
83
+                  widthFactor: 1.2,
84
+                  heightFactor: 1.2,
85
+                  alignment: Alignment(1.2, -5),
86
+                  child: Container(
87
+                    margin: EdgeInsets.only(right: 13),
88
+                    width: 86.w, //+6
89
+                    height: 44.h, //+10
90
+                    child: ElevatedButton(
91
+                      onPressed: () {
92
+                        print('点我去预约${item.name}');
93
+                      },
94
+                      child: const Text(
95
+                        "预约",
96
+                        style: TextStyle(
97
+                            fontSize: 19,
98
+                            color: Colors.white,
99
+                            fontWeight: FontWeight.bold),
100
+                      ),
101
+                      style: ButtonStyle(
102
+                        backgroundColor:
103
+                            MaterialStateProperty.all(const Color(0xFFFF703B)),
104
+                        shape: MaterialStateProperty.all(
105
+                            const RoundedRectangleBorder(
106
+                                //这个0像素圆角style如果删掉的话,按钮会变成默认样式,自带圆角
107
+                                borderRadius:
108
+                                    BorderRadius.all(Radius.circular(0)))),
109
+                      ),
110
+                    ),
111
+                  ),
112
+                ),
113
+              ],
114
+            ),
115
+          ),
116
+// 地址信息 进入地图
117
+          Container(
118
+              padding: EdgeInsets.fromLTRB(19, 20, 0, 10),
119
+              child: Row(
120
+                children: [
121
+                  Image.asset(
122
+                    "images/gpsImgae.png",
123
+                    width: 11.w,
124
+                    height: 13.h,
125
+                    fit: BoxFit.cover,
126
+                  ),
127
+                  Container(
128
+                      padding: EdgeInsets.fromLTRB(5, 0, 0, 0),
129
+                      width: 300.w,
130
+                      child: Row(
131
+                        mainAxisAlignment: MainAxisAlignment.spaceBetween,
132
+                        children: [
133
+                          Text(
134
+                            '距离当前位置2.6公里',
135
+                            style: TextStyle(
136
+                                fontSize: 15, fontWeight: FontWeight.bold),
137
+                          ),
138
+                          GestureDetector(
139
+                            child: Text(
140
+                              '进入地图 >>',
141
+                              style: TextStyle(
142
+                                  fontSize: 15, fontWeight: FontWeight.bold),
143
+                            ),
144
+                            onTap: () {
145
+                              print('进入地图');
146
+                            },
147
+                          )
148
+                        ],
149
+                      )),
150
+                ],
151
+              )),
152
+        ],
20 153
       ),
21 154
     );
22
-
23 155
   }
24 156
 }
25
-
26
-
27
-

+ 56
- 0
lib/components/UI/Search.dart Ver fichero

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

+ 32
- 26
lib/main.dart Ver fichero

@@ -6,8 +6,10 @@ import 'package:farmer_client/pages/login/login.dart';
6 6
 import 'package:flutter/material.dart';
7 7
 import 'package:get/get.dart';
8 8
 import 'package:flutter_screenutil/flutter_screenutil.dart';
9
+import 'components/UI/Banner.dart';
9 10
 import 'components/UI/CarsCard.dart';
10 11
 import 'components/UI/DefaultButton.dart';
12
+import 'components/UI/Search.dart';
11 13
 
12 14
 void main() {
13 15
   Store().init();
@@ -62,6 +64,7 @@ class MyHomePage extends StatefulWidget {
62 64
 class _MyHomePageState extends State<MyHomePage> {
63 65
   int _counter = 0;
64 66
 
67
+
65 68
   @override
66 69
   Widget build(BuildContext context) {
67 70
 
@@ -107,32 +110,35 @@ class _MyHomePageState extends State<MyHomePage> {
107 110
           // axis because Columns are vertical (the cross axis would be
108 111
           // horizontal).
109 112
           mainAxisAlignment: MainAxisAlignment.center,
110
-          children: <Widget>[
111
-            const Text(
112
-              'You have pushed the button this many times:',
113
-            ),
114
-            Text(
115
-              '$_counter',
116
-              style: Theme.of(context).textTheme.headline4,
117
-            ),
118
-            DefaultButton(
119
-              margin: EdgeInsets.fromLTRB(0, 30.0, 0, 0), //可选配置,自定义控件中有默认配置
120
-              text: "登陆",
121
-              width: 120.0,
122
-              height: 50.0,
123
-              fontSize: 20.0,
124
-              backColor: Color(0xffff703b),
125
-              color: Colors.white,
126
-              onPressed: () {
127
-                Navigator.push(
128
-                  context,
129
-                  MaterialPageRoute(builder: (context) {
130
-                    return MyRouteLogin();
131
-                  }),
132
-                );
133
-              },
134
-            ),
135
-            CarsCard()
113
+          children: const <Widget>[
114
+
115
+            // Text(
116
+            //   '$_counter',
117
+            //   style: Theme.of(context).textTheme.headline4,
118
+            // ),
119
+            // DefaultButton(
120
+            //   margin: EdgeInsets.fromLTRB(0, 30.0, 0, 0), //可选配置,自定义控件中有默认配置
121
+            //   text: "登陆",
122
+            //   width: 120.0,
123
+            //   height: 50.0,
124
+            //   fontSize: 20.0,
125
+            //   backColor: Color(0xffff703b),
126
+            //   color: Colors.white,
127
+            //   onPressed: () {
128
+            //     Navigator.push(
129
+            //       context,
130
+            //       MaterialPageRoute(builder: (context) {
131
+            //         return MyRouteLogin();
132
+            //       }),
133
+            //     );
134
+            //   },
135
+            // ),
136
+            // CarsCard(item: CarItem(
137
+            //     name:'元神第二个收割机',
138
+            //   distance:8.8,
139
+            //   price:270.6,
140
+            // )),
141
+            Search()
136 142
           ],
137 143
         ),
138 144
       ),

+ 74
- 0
lib/models/entities/CardInfo.dart Ver fichero

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

+ 2
- 0
lib/models/entities/person.dart Ver fichero

@@ -38,3 +38,5 @@ class Person {
38 38
     'createDate' : createDate,
39 39
   };
40 40
 }
41
+
42
+

+ 2
- 0
pubspec.yaml Ver fichero

@@ -74,6 +74,8 @@ flutter:
74 74
     - images/newsONImages.png
75 75
     - images/OrdersNOImgaes.png
76 76
     - images/OrdersOFFImgaes.png
77
+    - images/cars.png
78
+    - images/gpsImgae.png
77 79
 
78 80
   # An image asset can refer to one or more resolution-specific "variants", see
79 81
   # https://flutter.dev/assets-and-images/#resolution-aware.