Kaynağa Gözat

修复添加好友键盘问题

Groot 6 ay önce
ebeveyn
işleme
e4f9c45ab1

+ 2 - 0
lib/module/add_friend/add_friend_dialog_controller.dart

@@ -40,6 +40,7 @@ class AddFriendDialogController extends BaseController {
   }
 
   void onAddFriendClick() {
+    FocusScope.of(Get.context!).unfocus();
     if (!RegExp(r'^1\d{10}$').hasMatch(phone)) {
       ToastUtil.show(StringName.loginPrintPhoneVerification);
       return;
@@ -117,6 +118,7 @@ class AddFriendDialogController extends BaseController {
   }
 
   void _goContact() async {
+    FocusScope.of(Get.context!).unfocus();
     final contact = await FlutterContacts.openExternalPick();
     if (contact != null) {
       final phones = contact.phones;

+ 36 - 33
lib/module/add_friend/add_friend_page.dart

@@ -36,40 +36,43 @@ class AddFriendPage extends BaseView<AddFriendDialogController> {
   }
 
   Widget _addFriendView() {
-    return IntrinsicHeight(
-      child: Container(
-        decoration: BoxDecoration(
-          color: '#FDFCFE'.color,
-          borderRadius: BorderRadius.only(
-            topLeft: Radius.circular(16.w),
-            topRight: Radius.circular(16.w),
-          ),
-        ),
-        child: Stack(
-          children: [
-            Positioned(
-              top: 0,
-              child: Assets.images.bgAddFriendDialog.image(width: 1.sw),
+    return GestureDetector(
+      onTap: () => FocusScope.of(Get.context!).unfocus(),
+      child: IntrinsicHeight(
+        child: Container(
+          decoration: BoxDecoration(
+            color: '#FDFCFE'.color,
+            borderRadius: BorderRadius.only(
+              topLeft: Radius.circular(16.w),
+              topRight: Radius.circular(16.w),
             ),
-            _buildClose(),
-            Column(
-              crossAxisAlignment: CrossAxisAlignment.start,
-              children: [
-                SizedBox(height: 19.h),
-                _buildAddHeader(),
-                SizedBox(height: 18.h),
-                _buildPhone(),
-                SizedBox(height: 16.h),
-                _buildShareWx(),
-                SizedBox(height: 20.h),
-                Center(
-                    child: Text(StringName.friendAddRule,
-                        style: TextStyle(
-                            fontSize: 12.sp, color: '#A7A7A7'.color))),
-                SizedBox(height: 30.h),
-              ],
-            )
-          ],
+          ),
+          child: Stack(
+            children: [
+              Positioned(
+                top: 0,
+                child: Assets.images.bgAddFriendDialog.image(width: 1.sw),
+              ),
+              _buildClose(),
+              Column(
+                crossAxisAlignment: CrossAxisAlignment.start,
+                children: [
+                  SizedBox(height: 19.h),
+                  _buildAddHeader(),
+                  SizedBox(height: 18.h),
+                  _buildPhone(),
+                  SizedBox(height: 16.h),
+                  _buildShareWx(),
+                  SizedBox(height: 20.h),
+                  Center(
+                      child: Text(StringName.friendAddRule,
+                          style: TextStyle(
+                              fontSize: 12.sp, color: '#A7A7A7'.color))),
+                  SizedBox(height: 30.h),
+                ],
+              )
+            ],
+          ),
         ),
       ),
     );