李志伟 3 years ago
parent
commit
f523b3a843

+ 92
- 0
lib/pages/agreement/index.dart View File

@@ -0,0 +1,92 @@
1
+import 'package:flutter/cupertino.dart';
2
+import 'package:flutter/material.dart';
3
+import 'package:flutter/src/widgets/framework.dart';
4
+import 'package:flutter_screenutil/flutter_screenutil.dart';
5
+import 'package:worker_client/widgets/layout/BasicPage.dart';
6
+
7
+class Agreement extends BasicPage {
8
+  @override
9
+  Widget builder(BuildContext context) {
10
+    naviTitle = '用户协议';
11
+    return ListView(
12
+      children: [
13
+        Container(
14
+          margin: EdgeInsets.symmetric(vertical: 25.h, horizontal: 15.w),
15
+          child: Column(
16
+            children: [
17
+              Container(
18
+                margin: EdgeInsets.only(bottom: 30.h),
19
+                child: Row(
20
+                  mainAxisAlignment: MainAxisAlignment.center,
21
+                  children: [
22
+                    Image.asset(
23
+                      'images/machinery/mIcon.png',
24
+                      width: 16.5.w,
25
+                    ),
26
+                    Container(
27
+                      margin: EdgeInsets.symmetric(horizontal: 15.5.w),
28
+                      child: Text(
29
+                        '智慧农机的介绍',
30
+                        style: TextStyle(
31
+                            fontSize: 22.sp,
32
+                            fontWeight: FontWeight.bold,
33
+                            color: const Color(0xFF222222),
34
+                            height: 1.1),
35
+                      ),
36
+                    ),
37
+                    Image.asset(
38
+                      'images/machinery/mIcon.png',
39
+                      width: 16.5.w,
40
+                    ),
41
+                  ],
42
+                ),
43
+              ),
44
+              Container(
45
+                margin: EdgeInsets.only(top: 40.h),
46
+                child: Column(
47
+                  children: [
48
+                    Text(
49
+                      '本次更新:',
50
+                      style: TextStyle(
51
+                          fontSize: 16.sp,
52
+                          fontWeight: FontWeight.bold,
53
+                          color: const Color(0xff101010)),
54
+                    ),
55
+                    Text(
56
+                      '--解决了一些已知问题--',
57
+                      style: TextStyle(
58
+                          fontSize: 16.sp,
59
+                          fontWeight: FontWeight.bold,
60
+                          color: const Color(0xff101010)),
61
+                    ),
62
+                  ],
63
+                ),
64
+              ),
65
+              Container(
66
+                margin: EdgeInsets.only(top: 40.h),
67
+                child: Column(
68
+                  children: [
69
+                    Text(
70
+                      '最近更新:',
71
+                      style: TextStyle(
72
+                          fontSize: 16.sp,
73
+                          fontWeight: FontWeight.bold,
74
+                          color: const Color(0xff101010)),
75
+                    ),
76
+                    Text(
77
+                      '--这个页面回头加一个外链进来--',
78
+                      style: TextStyle(
79
+                          fontSize: 16.sp,
80
+                          fontWeight: FontWeight.bold,
81
+                          color: const Color(0xff101010)),
82
+                    ),
83
+                  ],
84
+                ),
85
+              ),
86
+            ],
87
+          ),
88
+        ),
89
+      ],
90
+    );
91
+  }
92
+}

+ 101
- 0
lib/pages/feedback/index.dart View File

@@ -0,0 +1,101 @@
1
+import 'package:flutter/material.dart';
2
+import 'package:flutter_screenutil/flutter_screenutil.dart';
3
+import 'package:fluttertoast/fluttertoast.dart';
4
+import 'package:get/get.dart';
5
+import 'package:worker_client/widgets/layout/BasicPage.dart';
6
+import 'package:worker_client/widgets/MyButton/index.dart';
7
+import 'package:worker_client/services/feedback.dart';
8
+
9
+class Feedback extends BasicPage {
10
+  final text = Rx<String>('');
11
+  final isEdit = Rx<bool>(false);
12
+
13
+  void submit() {
14
+    if (text() == '') {
15
+      Fluttertoast.showToast(msg: '请输入内容哦');
16
+    } else {
17
+      feedback(text()).then((value) {
18
+        Fluttertoast.showToast(msg: '提交成功!');
19
+        Get.back();
20
+      });
21
+    }
22
+  }
23
+
24
+  @override
25
+  Widget builder(BuildContext context) {
26
+    naviTitle = '意见反馈';
27
+    return Container(
28
+      height: 700.h,
29
+      padding: EdgeInsets.all(15.w),
30
+      child: Stack(
31
+        children: [
32
+          Container(
33
+            margin: EdgeInsets.fromLTRB(0, 0, 0, 50.h),
34
+            padding: EdgeInsets.symmetric(vertical: 5.w, horizontal: 18.5.w),
35
+            decoration: BoxDecoration(
36
+                color: const Color(0xFFfefefe),
37
+                borderRadius: BorderRadius.all(Radius.circular(10.w)),
38
+                border: Border.all(
39
+                    color: const Color(0xcc000000),
40
+                    width: 1.h,
41
+                    style: BorderStyle.solid)),
42
+            child: TextFormField(
43
+              minLines: 6,
44
+              maxLines: 6,
45
+              style: TextStyle(fontSize: 17.sp, height: 1.5),
46
+              decoration: const InputDecoration(
47
+                isCollapsed: true,
48
+                border: InputBorder.none,
49
+                counterText: '', //去掉计数
50
+                floatingLabelBehavior: FloatingLabelBehavior.never,
51
+              ),
52
+              onTap: () {
53
+                isEdit.value = true;
54
+              },
55
+              onChanged: (e) {
56
+                text.value = e;
57
+              },
58
+            ),
59
+          ),
60
+          Obx(
61
+            () => Visibility(
62
+              visible: !isEdit(),
63
+              child: Positioned(
64
+                left: 20.w,
65
+                top: 5.w,
66
+                child: Row(
67
+                  children: [
68
+                    Container(
69
+                      margin: EdgeInsets.only(right: 8.w),
70
+                      child: Image.asset(
71
+                        'images/main/edit.png',
72
+                        width: 15.w,
73
+                      ),
74
+                    ),
75
+                    Text(
76
+                      '请留下您宝贵的意见和建议!',
77
+                      style: TextStyle(
78
+                          fontSize: 17.sp,
79
+                          letterSpacing: 2,
80
+                          color: const Color(0xFFBEBDBD)),
81
+                    ),
82
+                  ],
83
+                ),
84
+              ),
85
+            ),
86
+          ),
87
+          Positioned(
88
+              bottom: 25.h,
89
+              child: MyButton(
90
+                  pwith: 30.w,
91
+                  text: '提交',
92
+                  type: 0,
93
+                  disable: false,
94
+                  onClick: () {
95
+                    submit();
96
+                  })),
97
+        ],
98
+      ),
99
+    );
100
+  }
101
+}

+ 2
- 0
lib/pages/index.dart View File

@@ -12,4 +12,6 @@ export 'bankList/index.dart';
12 12
 export 'addBankCard/index.dart';
13 13
 export 'userInfo/index.dart';
14 14
 export 'aboutUs/index.dart';
15
+export 'agreement/index.dart';
16
+export 'feedback/index.dart';
15 17
 

+ 10
- 2
lib/pages/main/index.dart View File

@@ -47,6 +47,12 @@ class Main extends BasicPage {
47 47
   void goAboutUs(){
48 48
     Get.toNamed('/aboutUs');
49 49
   }
50
+  void goAgreement(){
51
+    Get.toNamed('/agreement');
52
+  }
53
+  void goFeedback(){
54
+    Get.toNamed('/feedback');
55
+  }
50 56
 
51 57
   @override
52 58
   Widget builder(BuildContext context) {
@@ -285,7 +291,7 @@ class Main extends BasicPage {
285 291
                             'images/main/goto.png',
286 292
                             width: 10.w,
287 293
                           ),
288
-                          onClick: () {},
294
+                          onClick: () {goAgreement();},
289 295
                         ),
290 296
                         MyCell(
291 297
                           head: Image.asset(
@@ -303,7 +309,9 @@ class Main extends BasicPage {
303 309
                             'images/main/goto.png',
304 310
                             width: 10.w,
305 311
                           ),
306
-                          onClick: () {},
312
+                          onClick: () {
313
+                            goFeedback();
314
+                          },
307 315
                         ),
308 316
                         Container(
309 317
                             height: 45.5.h,

+ 2
- 0
lib/routes/pages.dart View File

@@ -23,4 +23,6 @@ List<GetPage> pages=[
23 23
   GetPage(name: '/addBankCard', page: () => AddBankPage()),
24 24
   GetPage(name: '/userInfo', page: () => UserInfo()),
25 25
   GetPage(name: '/aboutUs', page: () => AboutUs()),
26
+  GetPage(name: '/agreement', page: () => Agreement()),
27
+  GetPage(name: '/feedback', page: () => Feedback()),
26 28
 ];

+ 17
- 0
lib/services/feedback.dart View File

@@ -0,0 +1,17 @@
1
+import 'package:dio/dio.dart';
2
+import '../utils/Request.dart';
3
+import 'package:fluttertoast/fluttertoast.dart';
4
+
5
+/**
6
+ * 意见反馈
7
+ * @param {*} data
8
+ * @returns
9
+ */
10
+
11
+Future feedback(String content) async {
12
+  return request('/feedback',
13
+      options: Options(method: 'POST'), data: {'content': content})
14
+      .catchError((error) => {
15
+    Fluttertoast.showToast(msg: error.error['message']),
16
+  });
17
+}