李志伟 2 vuotta sitten
vanhempi
commit
56956be38d

+ 0
- 1
lib/main.dart Näytä tiedosto

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

+ 8
- 5
lib/pages/userInfo/index.dart Näytä tiedosto

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

+ 1
- 1
lib/services/user.dart Näytä tiedosto

@@ -19,7 +19,7 @@ Future userLogin(String userName, String password) async {
19 19
     options: Options(method: 'POST'),
20 20
     data: {'userName': userName, 'password': password},
21 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 Näytä tiedosto

@@ -29,7 +29,7 @@ final client = GetPlatform.isAndroid ? 'android' : 'ios';
29 29
 
30 30
 Dio createRequest() {
31 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 33
   final baseUrl = '$host/api/$client/farmer';
34 34
 
35 35
   var options = BaseOptions(

+ 13
- 7
lib/widgets/layout/BasicPage.dart Näytä tiedosto

@@ -96,19 +96,25 @@ class _BasicPageState extends State<BasicPage> {
96 96
     }
97 97
   }
98 98
 
99
+  final client = GetPlatform.isAndroid ? true : false;
100
+
99 101
   @override
100 102
   Widget build(BuildContext context) {
101 103
     return Scaffold(
102 104
       resizeToAvoidBottomInset: false,
103 105
       appBar: _getAppBar(),
104 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 119
       bottomNavigationBar: widget.tabIndex == null
114 120
           ? null