|
@@ -0,0 +1,124 @@
|
|
1
|
+import 'package:flutter/cupertino.dart';
|
|
2
|
+import 'package:flutter/material.dart';
|
|
3
|
+import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
4
|
+import 'package:get/get.dart';
|
|
5
|
+import 'package:worker_client/models/entities/Machinery.dart';
|
|
6
|
+import 'package:worker_client/services/machinery.dart';
|
|
7
|
+import 'package:worker_client/widgets/layout/BasicPage.dart';
|
|
8
|
+
|
|
9
|
+class MachineryMap extends BasicPage {
|
|
10
|
+ MachineryMap({Key? key}) : super(key: key);
|
|
11
|
+ final machineryList = Rx<List<Machinery>>([]);
|
|
12
|
+ final machinery = Rx<Machinery>(Machinery());
|
|
13
|
+
|
|
14
|
+ @override
|
|
15
|
+ void beforeShow() {
|
|
16
|
+ // TODO: implement beforeShow
|
|
17
|
+ super.beforeShow();
|
|
18
|
+ if (Get.arguments != null) {
|
|
19
|
+ getMachineryDetail(Get.arguments['id'], {
|
|
20
|
+ 'attached': true,
|
|
21
|
+ 'location': '118.84002,31.95266'
|
|
22
|
+ }).then((res) => {machinery(Machinery.fromJson(res))});
|
|
23
|
+ }
|
|
24
|
+ }
|
|
25
|
+
|
|
26
|
+ void goBack() {
|
|
27
|
+ Get.back();
|
|
28
|
+ }
|
|
29
|
+ void goDetail() {
|
|
30
|
+ Get.toNamed('/machineryDetail',
|
|
31
|
+ arguments: {'id': machinery.value.machineryId});
|
|
32
|
+ }
|
|
33
|
+
|
|
34
|
+ @override
|
|
35
|
+ Widget builder(BuildContext context) {
|
|
36
|
+ naviTitle = '我的农机';
|
|
37
|
+ return Stack(
|
|
38
|
+ children: [
|
|
39
|
+ Container(
|
|
40
|
+ width: 375.w,
|
|
41
|
+ decoration: const BoxDecoration(color: Colors.greenAccent),
|
|
42
|
+ ),
|
|
43
|
+ Positioned(
|
|
44
|
+ bottom: 0,
|
|
45
|
+ child: Container(
|
|
46
|
+ width: 375.w,
|
|
47
|
+ padding: EdgeInsets.symmetric(horizontal: 15.w, vertical: 30.h),
|
|
48
|
+ decoration: BoxDecoration(
|
|
49
|
+ borderRadius: BorderRadius.only(
|
|
50
|
+ topLeft: Radius.circular(20.w),
|
|
51
|
+ topRight: Radius.circular(20.w)),
|
|
52
|
+ color: Colors.white),
|
|
53
|
+ child: Column(
|
|
54
|
+ crossAxisAlignment: CrossAxisAlignment.start,
|
|
55
|
+ children: [
|
|
56
|
+ GestureDetector(
|
|
57
|
+ onTap: () {
|
|
58
|
+ goBack();
|
|
59
|
+ },
|
|
60
|
+ child: Text(
|
|
61
|
+ '<<农机列表',
|
|
62
|
+ style: TextStyle(
|
|
63
|
+ color: const Color(0xff666666),
|
|
64
|
+ fontSize: 15.sp,
|
|
65
|
+ fontWeight: FontWeight.bold),
|
|
66
|
+ ),
|
|
67
|
+ ),
|
|
68
|
+ Container(
|
|
69
|
+ margin: EdgeInsets.only(top: 30.h, bottom: 20.h),
|
|
70
|
+ child: Row(
|
|
71
|
+ mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
72
|
+ children: [
|
|
73
|
+ Text(
|
|
74
|
+ '第一台收割机',
|
|
75
|
+ style: TextStyle(
|
|
76
|
+ color: const Color(0xff222222),
|
|
77
|
+ fontSize: 18.sp,
|
|
78
|
+ fontWeight: FontWeight.bold),
|
|
79
|
+ ),
|
|
80
|
+ GestureDetector(
|
|
81
|
+ onTap: () {
|
|
82
|
+ goDetail();
|
|
83
|
+ },
|
|
84
|
+ child: Text(
|
|
85
|
+ '详情>>',
|
|
86
|
+ style: TextStyle(
|
|
87
|
+ color: const Color(0xff666666),
|
|
88
|
+ fontSize: 15.sp,
|
|
89
|
+ fontWeight: FontWeight.bold),
|
|
90
|
+ ),
|
|
91
|
+ )
|
|
92
|
+ ],
|
|
93
|
+ ),
|
|
94
|
+ ),
|
|
95
|
+ Row(
|
|
96
|
+ children: [
|
|
97
|
+ Container(
|
|
98
|
+ margin: EdgeInsets.only(right: 8.w),
|
|
99
|
+ child: Image.asset(
|
|
100
|
+ 'images/index/position.png',
|
|
101
|
+ width: 17.w,
|
|
102
|
+ ),
|
|
103
|
+ ),
|
|
104
|
+ Expanded(
|
|
105
|
+ flex: 1,
|
|
106
|
+ child: Text(
|
|
107
|
+ '当前位置: 江苏省南京市南京南站城际空间站D2栋212南京云致科技服务有限公司',
|
|
108
|
+ style: TextStyle(
|
|
109
|
+ fontWeight: FontWeight.bold,
|
|
110
|
+ fontSize: 15.sp,
|
|
111
|
+ color: const Color(0xff222222),
|
|
112
|
+ ),
|
|
113
|
+ ),
|
|
114
|
+ )
|
|
115
|
+ ],
|
|
116
|
+ )
|
|
117
|
+ ],
|
|
118
|
+ ),
|
|
119
|
+ ),
|
|
120
|
+ )
|
|
121
|
+ ],
|
|
122
|
+ );
|
|
123
|
+ }
|
|
124
|
+}
|