李志伟 2 years ago
parent
commit
56956be38d

+ 0
- 1
lib/main.dart View File

1
 import 'package:farmer_client/theme.dart';
1
 import 'package:farmer_client/theme.dart';
2
-import 'package:farmer_client/utils/location.dart';
3
 import 'package:flutter/material.dart';
2
 import 'package:flutter/material.dart';
4
 import 'package:flutter_easyloading/flutter_easyloading.dart';
3
 import 'package:flutter_easyloading/flutter_easyloading.dart';
5
 import 'package:fluwx/fluwx.dart';
4
 import 'package:fluwx/fluwx.dart';

+ 8
- 5
lib/pages/userInfo/index.dart View File

20
   @override
20
   @override
21
   void beforeShow() {
21
   void beforeShow() {
22
     super.beforeShow();
22
     super.beforeShow();
23
-    _cName = TextEditingController(text: userInfo.user().nickName.toString());
24
-    _cPhone = TextEditingController(text: userInfo.user().phone.toString());
25
-    name = userInfo.user().nickName.toString();
23
+    name = userInfo.user().nickName != null
24
+        ? userInfo.user().nickName.toString()
25
+        : '';
26
     phone = userInfo.user().phone.toString();
26
     phone = userInfo.user().phone.toString();
27
+    _cName = TextEditingController(text: name);
28
+    _cPhone = TextEditingController(text: phone);
27
   }
29
   }
28
 
30
 
29
   bool disableLogin = false;
31
   bool disableLogin = false;
41
     } else {
43
     } else {
42
       data = {
44
       data = {
43
         ...userInfo.user().toJson(),
45
         ...userInfo.user().toJson(),
44
-        'avatar': userInfo.user().avatar ?? '',
45
         'nickName': name,
46
         'nickName': name,
46
         'phone': phone
47
         'phone': phone
47
       };
48
       };
134
                   Row(
135
                   Row(
135
                       mainAxisAlignment: MainAxisAlignment.spaceBetween,
136
                       mainAxisAlignment: MainAxisAlignment.spaceBetween,
136
                       children: [
137
                       children: [
137
-                        Container(
138
+                        SizedBox(
138
                           width: 327.w,
139
                           width: 327.w,
139
                           child: TextField(
140
                           child: TextField(
140
                             controller: _cName,
141
                             controller: _cName,
158
                           ),
159
                           ),
159
                         ),
160
                         ),
160
                         GestureDetector(
161
                         GestureDetector(
162
+                          behavior: HitTestBehavior.opaque,
161
                           onTap: () {
163
                           onTap: () {
162
                             name = '';
164
                             name = '';
163
                             _cName.clear();
165
                             _cName.clear();
223
                           ),
225
                           ),
224
                         ),
226
                         ),
225
                         GestureDetector(
227
                         GestureDetector(
228
+                          behavior: HitTestBehavior.opaque,
226
                           onTap: () {
229
                           onTap: () {
227
                             phone = '';
230
                             phone = '';
228
                             _cPhone.clear();
231
                             _cPhone.clear();

+ 1
- 1
lib/services/user.dart View File

19
     options: Options(method: 'POST'),
19
     options: Options(method: 'POST'),
20
     data: {'userName': userName, 'password': password},
20
     data: {'userName': userName, 'password': password},
21
   ).catchError((error) => {
21
   ).catchError((error) => {
22
-        Fluttertoast.showToast(msg: error.error['message']),
22
+        Fluttertoast.showToast(msg: error['message']),
23
       });
23
       });
24
 }
24
 }
25
 
25
 

+ 1
- 1
lib/utils/Request.dart View File

29
 
29
 
30
 Dio createRequest() {
30
 Dio createRequest() {
31
   const isProd = bool.fromEnvironment('dart.vm.product');
31
   const isProd = bool.fromEnvironment('dart.vm.product');
32
-  const host = isProd ? 'https://machine.njyunzhi.com' : 'http://192.168.89.25:7080';
32
+  const host = isProd ? 'https://machine.njyunzhi.com' : 'http://192.168.89.147:7080';
33
   final baseUrl = '$host/api/$client/farmer';
33
   final baseUrl = '$host/api/$client/farmer';
34
 
34
 
35
   var options = BaseOptions(
35
   var options = BaseOptions(

+ 13
- 7
lib/widgets/layout/BasicPage.dart View File

96
     }
96
     }
97
   }
97
   }
98
 
98
 
99
+  final client = GetPlatform.isAndroid ? true : false;
100
+
99
   @override
101
   @override
100
   Widget build(BuildContext context) {
102
   Widget build(BuildContext context) {
101
     return Scaffold(
103
     return Scaffold(
102
       resizeToAvoidBottomInset: false,
104
       resizeToAvoidBottomInset: false,
103
       appBar: _getAppBar(),
105
       appBar: _getAppBar(),
104
       body: SafeArea(
106
       body: SafeArea(
105
-        child: GestureDetector(
106
-          behavior: HitTestBehavior.translucent,
107
-          onTap: () {
108
-            FocusScope.of(context).requestFocus(FocusNode());
109
-          },
110
-          child: widget.builder(context),
111
-        ),
107
+        //判断是否是安卓手机  因为安卓手机键盘有收起功能所以普通就行
108
+        //如果是苹果系统 因为苹果键盘没有收起功能只能点击屏幕收起所以需要加一个代码
109
+        child: !client
110
+            ? widget.builder(context)
111
+            : GestureDetector(
112
+                behavior: HitTestBehavior.translucent,
113
+                onTap: () {
114
+                  FocusScope.of(context).requestFocus(FocusNode());
115
+                },
116
+                child: widget.builder(context),
117
+              ),
112
       ),
118
       ),
113
       bottomNavigationBar: widget.tabIndex == null
119
       bottomNavigationBar: widget.tabIndex == null
114
           ? null
120
           ? null