浏览代码

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

李志伟 3 年前
父节点
当前提交
270bffaeb3

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


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

@@ -0,0 +1,46 @@
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
+}

+ 97
- 5
lib/pages/MoreCars/index.dart 查看文件

@@ -1,6 +1,11 @@
1
+
1 2
 import 'package:flutter/material.dart';
2 3
 import 'package:flutter_screenutil/flutter_screenutil.dart';
3 4
 
5
+import '../../widgets/CarsCard.dart';
6
+import '../../widgets/Search.dart';
7
+import '../TabBar/widgets/home/widgets/headers.dart';
8
+
4 9
 
5 10
 class MoreCars extends StatefulWidget {
6 11
   const MoreCars({Key? key}) : super(key: key);
@@ -9,16 +14,33 @@ class MoreCars extends StatefulWidget {
9 14
   State<MoreCars> createState() => _MoreCarsState();
10 15
 }
11 16
 
12
-class _MoreCarsState extends State<MoreCars> {
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
+     '挺长名字的农机选项分类',
25
+  ];
26
+
27
+
28
+
29
+  @override
30
+  void initState() {
31
+    // TODO: implement initState
32
+    super.initState();
33
+  }
13 34
   @override
14 35
   Widget build(BuildContext context) {
36
+    // _controller=TabController(length: tabText.length, vsync: this);
15 37
     return Scaffold(
16 38
       resizeToAvoidBottomInset: false,
17 39
       appBar: AppBar(
18 40
         elevation: 0,
19 41
         centerTitle: true,
20 42
         backgroundColor: Colors.white,
21
-        title: Text(
43
+        title:Text(
22 44
           '更多',
23 45
           style: TextStyle(
24 46
               color: Colors.black,
@@ -26,11 +48,81 @@ class _MoreCarsState extends State<MoreCars> {
26 48
               letterSpacing: 2,
27 49
               fontWeight: FontWeight.bold),
28 50
         ),
51
+
29 52
       ),
30
-      body: Container(
31
-        child: Text('wwwwwwwwwww'),
32
-      ),
53
+      body: ListView(
54
+          children: [Column(
55
+          children: [
56
+            Container(
57
+              padding: EdgeInsets.fromLTRB(20, 15, 20, 15),
58
+
59
+              decoration: BoxDecoration(
60
+                color: Colors.white
61
+              ),
62
+              // child:Search(),
63
+              child:          Container(
64
+                  height: 32.w,
65
+                  decoration: const BoxDecoration(
66
+                      color: Colors.white
67
+                  ),
68
+                  child: GestureDetector(
69
+                      onTap: (){
70
+                        print('点击了搜索');
71
+                      },
72
+                      child: Container(
73
+                        decoration: const BoxDecoration(
74
+                          // color: Colors.red,
75
+                          color: Color(0x30cccccc),
76
+                          borderRadius: BorderRadius.all(Radius.circular(25)),
77
+                        ),
78
+                        child: Row(
79
+                          children: [
80
+                            Padding(padding: EdgeInsets.fromLTRB(15, 0, 5, 0),
81
+                              child: Icon(Icons.search,size: 19,color:Color(0xff666666) ,),
82
+                            ),
83
+                            Text('请输入关键字查询',style: TextStyle(color: Color(0xff666666),fontSize: 14),)
84
+                          ],
85
+                        ),
86
+                      )
87
+                    // Search(),
88
+                  )
89
+              ),
90
+            ),
91
+            
92
+            TabBar(
93
+              labelStyle: TextStyle(fontSize: ScreenUtil().setSp(19),fontWeight: FontWeight.bold), //选中的样式
94
+              unselectedLabelStyle: TextStyle(fontSize:ScreenUtil().setSp(16)), //未选中的样式
95
+              controller: _controller,
96
+              isScrollable: true, //可滚动
97
+              indicatorColor: Colors.black, //指示器的颜色
98
+              labelColor: Colors.black, //选中文字颜色
99
+              unselectedLabelColor: Color(0xffadadad),
100
+              // indicatorSize: TabBarIndicatorSize.label, //指示器与文字等宽
101
+              tabs: tabText.map((e) => Tab(text: e)).toList(),
102
+              onTap: (int i) {
103
+                print('当前+${i}');
104
+              },
105
+
106
+            ),
107
+            Container(
108
+              child: Column(
109
+                children: [
110
+                  CarsCard(),
111
+                  CarsCard(),
112
+                  CarsCard(),
113
+                  CarsCard(),
114
+                ],
115
+              )
116
+              ,
117
+            )
118
+
119
+
120
+          ],
121
+        )]
122
+
123
+      )
33 124
 
34 125
     );
35 126
   }
36 127
 }
128
+

+ 3
- 1
lib/pages/machinery/detail/index.dart 查看文件

@@ -18,7 +18,9 @@ class MachineryDetailPage extends StatelessWidget {
18 18
 
19 19
     return Scaffold(
20 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,60 +1,67 @@
1 1
 
2
+import 'package:farmer_client/pages/machinery/widgets/DefLayout.dart';
3
+import 'package:farmer_client/pages/machinery/widgets/RoundButton.dart';
2 4
 import 'package:flutter/widgets.dart';
3 5
 import 'package:flutter/material.dart';
4 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 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 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 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 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 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,7 +16,14 @@ class MachineryMapPage extends StatelessWidget {
16 16
   @override
17 17
   Widget build(BuildContext context) {
18 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,4 +1,6 @@
1 1
 
2
+import 'package:farmer_client/pages/machinery/widgets/DefLayout.dart';
3
+import 'package:farmer_client/pages/machinery/widgets/RoundButton.dart';
2 4
 import 'package:flutter/material.dart';
3 5
 import 'package:flutter/widgets.dart';
4 6
 import 'package:flutter_screenutil/flutter_screenutil.dart';
@@ -7,92 +9,38 @@ import 'package:farmer_client/widgets/amap/amap.dart';
7 9
 
8 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 13
   final _offset = 20.w;
12 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 19
   final img = 'https://yz-websit.oss-cn-hangzhou.aliyuncs.com/xlk/index-icon19.jpg';
21 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 查看文件

@@ -0,0 +1,44 @@
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 查看文件

@@ -0,0 +1,30 @@
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
- 7
lib/pages/machinery/widgets/summary.dart 查看文件

@@ -23,7 +23,7 @@ Widget _title() {
23 23
       Expanded(
24 24
           child: Text("收割机001--S001",
25 25
               style: TextStyle(
26
-                color: Color(0xFF222222),
26
+                color: const Color(0xFF222222),
27 27
                 fontSize: 18.sp,
28 28
                 fontWeight: FontWeight.bold,
29 29
               )),
@@ -60,10 +60,6 @@ Widget _title() {
60 60
                 ]
61 61
             ),
62 62
           ),
63
-
64
-
65
-
66
-
67 63
         ),
68 64
       )
69 65
     ],
@@ -76,7 +72,7 @@ Widget _desc() {
76 72
       Icon(Icons.location_on_outlined, size: 16.sp,),
77 73
       Expanded(
78 74
         flex: 1,
79
-        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),),
80 76
       ),
81 77
     ],
82 78
   );
@@ -85,6 +81,6 @@ Widget _desc() {
85 81
 Widget _detail() {
86 82
   return Container(
87 83
     alignment: Alignment.centerLeft,
88
-    child: Text("农机手1的收割机", style: TextStyle(color: Color(0xFF222222), fontSize: 15.sp),),
84
+    child: Text("农机手1的收割机", style: TextStyle(color: const Color(0xFF222222), fontSize: 15.sp),),
89 85
   );
90 86
 }

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

@@ -9,6 +9,7 @@ import 'package:farmer_client/pages/feedback/index.dart';
9 9
 import 'package:farmer_client/pages/orderInfo/index.dart';
10 10
 import 'package:farmer_client/pages/userInfo/index.dart';
11 11
 import 'package:get/get.dart';
12
+import '../pages/MoreCars/index.dart';
12 13
 import '../pages/index.dart';
13 14
 
14 15
 
@@ -21,6 +22,7 @@ List<GetPage> pages = [
21 22
   GetPage(name: '/addAddress', page: () =>  AddAddress()),
22 23
   GetPage(name: '/userInfo', page: () =>  UserInfo()),
23 24
   GetPage(name: '/machineryMap', page: () =>  MachineryMapPage()),
25
+  GetPage(name: '/machineryDetail', page: () =>  MachineryDetailPage()),
24 26
   GetPage(name: '/aboutUs', page: () =>  AboutUs()),
25 27
   GetPage(name: '/agreement', page: () =>  Agreement()),
26 28
   GetPage(name: '/feedback', page: () =>  Feedback()),

+ 43
- 20
lib/widgets/CarsCard.dart 查看文件

@@ -5,7 +5,9 @@ import 'package:get/get.dart';
5 5
 import 'package:get/get_core/src/get_main.dart';
6 6
 
7 7
 import '../pages/OrderConfirmation/index.dart';
8
+import '../pages/machinery/detail/index.dart';
8 9
 import '../pages/machinery/map/index.dart';
10
+import 'LinearGradientText.dart';
9 11
 
10 12
 // class CarItem {
11 13
 //   late String name;
@@ -33,12 +35,19 @@ class CarsCard extends StatelessWidget {
33 35
       // height: 389.h,
34 36
       child: Column(
35 37
         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,
38
+          GestureDetector(
39
+            onTap: (){
40
+              Get.to(MachineryDetailPage());
41
+
42
+            },
43
+            child:Image.network(
44
+              "http://yz-shigongli.oss-accelerate.aliyuncs.com/2022-03/1648094119154-7b280bbf63105a8e90299e2d79c8c6ee.jpeg",
45
+              width: 345.w,
46
+              height: 230.h,
47
+              fit: BoxFit.cover,
48
+            ),
41 49
           ),
50
+
42 51
           Container(
43 52
             padding: EdgeInsets.fromLTRB(15, 20, 0, 0),
44 53
             child: Row(
@@ -62,21 +71,35 @@ class CarsCard extends StatelessWidget {
62 71
               mainAxisAlignment: MainAxisAlignment.spaceBetween,
63 72
               children: <Widget>[
64 73
                 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
-                    ]),
74
+                  child: LinearGradientText(
75
+                    colors: const <Color>[
76
+                      Color(0xFFFA7878),
77
+                      Color(0xFFB61515),
78
+                    ],
79
+                    child: RichText(
80
+                      text: TextSpan(
81
+                          children: <InlineSpan>[
82
+                            TextSpan(
83
+                                text: "4508",
84
+                                style: TextStyle(
85
+                                  fontSize: 22,
86
+                                  fontWeight: FontWeight.bold,
87
+                                )),
88
+                            TextSpan(
89
+                                text: "元/",
90
+                                style: TextStyle(
91
+                                  fontSize: 22,
92
+                                  fontWeight: FontWeight.bold,
93
+                                )),
94
+                            TextSpan(
95
+                                text: "公顷",
96
+                                style: TextStyle(
97
+                                  fontSize: 12,
98
+                                  fontWeight: FontWeight.bold,
99
+                                )),
100
+                          ]
101
+                      ),
102
+                    ),
80 103
                   ),
81 104
                 ),
82 105
                 Align(

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

@@ -0,0 +1,41 @@
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
+}

+ 20
- 10
lib/widgets/OrderInfoCard.dart 查看文件

@@ -1,6 +1,8 @@
1 1
 import 'package:flutter/material.dart';
2 2
 import 'package:flutter_screenutil/flutter_screenutil.dart';
3 3
 
4
+import 'LinearGradientText.dart';
5
+
4 6
 class OrderInfoCard extends StatelessWidget {
5 7
   const OrderInfoCard({Key? key}) : super(key: key);
6 8
 
@@ -136,7 +138,7 @@ class OrderInfoCard extends StatelessWidget {
136 138
                     Padding(
137 139
                       padding: EdgeInsets.fromLTRB(0, 0, 0, 20),
138 140
                       child: RichText(
139
-                        text: TextSpan(children: <InlineSpan>[
141
+                        text: const TextSpan(children: <InlineSpan>[
140 142
                           TextSpan(
141 143
                               text: '订单状态:',
142 144
                               style: TextStyle(
@@ -165,25 +167,33 @@ class OrderInfoCard extends StatelessWidget {
165 167
                           children: [
166 168
                             Row(
167 169
                               mainAxisAlignment: MainAxisAlignment.spaceBetween,
168
-                              children: [
169
-                                Text('费用:',
170
+                              children:  [
171
+                                const Text('费用:',
170 172
                                     style: TextStyle(
171 173
                                         color: Color(0xff666666),
172 174
                                         fontSize: 16,
173 175
                                         fontWeight: FontWeight.bold)),
174
-                                Text('8880',
175
-                                    style: TextStyle(
176
-                                        color: Color(0xffB61515),
177
-                                        fontSize: 16,
178
-                                        fontWeight: FontWeight.bold)),
176
+                                LinearGradientText(
177
+                                  colors: const <Color>[
178
+                                    Color(0xFFFA7878),
179
+                                    Color(0xFFB61515),
180
+                                  ],
181
+                                  child: const Text('8880',
182
+                                      style: TextStyle(
183
+                                          color: Color(0xffB61515),
184
+                                          fontSize: 16,
185
+                                          fontWeight: FontWeight.bold)),
186
+                                ),
187
+
188
+
179 189
                               ],
180 190
                             ),
181 191
                             Padding(
182 192
                               padding: EdgeInsets.fromLTRB(0, 30, 0, 0),
183 193
                               child: Row(
184 194
                                 mainAxisAlignment:
185
-                                    MainAxisAlignment.spaceBetween,
186
-                                children: [
195
+                                MainAxisAlignment.spaceBetween,
196
+                                children: const [
187 197
                                   Text('状态:',
188 198
                                       style: TextStyle(
189 199
                                           color: Color(0xff666666),

+ 37
- 15
lib/widgets/OrderListCard.dart 查看文件

@@ -4,6 +4,7 @@ import 'package:get/get.dart';
4 4
 
5 5
 import '../pages/OrderConfirmation/index.dart';
6 6
 import '../pages/orderInfo/index.dart';
7
+import 'LinearGradientText.dart';
7 8
 import 'OrderInfoCard.dart';
8 9
 
9 10
 class OrderListCard extends StatelessWidget {
@@ -194,22 +195,43 @@ class OrderListCard extends StatelessWidget {
194 195
                                   fontWeight: FontWeight.bold)),
195 196
                         ]),
196 197
                       ),
197
-                      RichText(
198
-                        text: const TextSpan(children: <InlineSpan>[
199
-                          TextSpan(
200
-                              text: '费用:',
201
-                              style: TextStyle(
202
-                                  color: Color(0xff666666),
203
-                                  fontSize: 16,
204
-                                  fontWeight: FontWeight.bold)),
205
-                          TextSpan(
206
-                              text: '850元',
207
-                              style: TextStyle(
208
-                                  color: Color(0xffB61515),
209
-                                  fontSize: 16,
210
-                                  fontWeight: FontWeight.bold)),
211
-                        ]),
198
+                      Container(
199
+                        child: Row(
200
+                          children: [
201
+                            const Text('费用:',style: TextStyle(
202
+                                color: Color(0xff666666),
203
+                                fontSize: 16,
204
+                                fontWeight: FontWeight.bold)),
205
+                            LinearGradientText(
206
+                              colors: const <Color>[
207
+                                Color(0xFFFA7878),
208
+                                Color(0xFFB61515),
209
+                              ],
210
+                              child: RichText(
211
+                                text: const TextSpan(
212
+                                    children: <InlineSpan>[
213
+                                      TextSpan(
214
+                                          text: "8808",
215
+                                          style: TextStyle(
216
+                                            fontSize: 16,
217
+                                            fontWeight: FontWeight.bold,
218
+                                          )),
219
+                                      TextSpan(
220
+                                          text: "元",
221
+                                          style: TextStyle(
222
+                                            fontSize: 16,
223
+                                            fontWeight: FontWeight.bold,
224
+                                          )),
225
+
226
+                                    ]
227
+                                ),
228
+                              ),
229
+                            ),
230
+
231
+                          ],
232
+                        ),
212 233
                       ),
234
+
213 235
                     ],
214 236
                   ),
215 237
                 ),