From 1d00ee695f2643a61b332a92dbb4aaf8f78a8fa1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?lollipopkit=F0=9F=8F=B3=EF=B8=8F=E2=80=8D=E2=9A=A7?= =?UTF-8?q?=EF=B8=8F?= <10864310+lollipopkit@users.noreply.github.com> Date: Sat, 13 Jul 2024 11:48:21 +0800 Subject: [PATCH] fix: IME popup (#79) --- ios/Runner.xcodeproj/project.pbxproj | 6 +++--- lib/data/res/build.dart | 2 +- lib/view/page/home/bottom.dart | 6 ++++-- lib/view/page/home/var.dart | 6 +----- pubspec.lock | 4 ++-- pubspec.yaml | 4 ++-- 6 files changed, 13 insertions(+), 15 deletions(-) diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj index d913fc8..7958cea 100644 --- a/ios/Runner.xcodeproj/project.pbxproj +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -381,7 +381,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; - CURRENT_PROJECT_VERSION = 245; + CURRENT_PROJECT_VERSION = 246; DEVELOPMENT_TEAM = BA88US33G6; ENABLE_BITCODE = NO; INFOPLIST_FILE = Runner/Info.plist; @@ -512,7 +512,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; - CURRENT_PROJECT_VERSION = 245; + CURRENT_PROJECT_VERSION = 246; DEVELOPMENT_TEAM = BA88US33G6; ENABLE_BITCODE = NO; INFOPLIST_FILE = Runner/Info.plist; @@ -537,7 +537,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; - CURRENT_PROJECT_VERSION = 245; + CURRENT_PROJECT_VERSION = 246; DEVELOPMENT_TEAM = BA88US33G6; ENABLE_BITCODE = NO; INFOPLIST_FILE = Runner/Info.plist; diff --git a/lib/data/res/build.dart b/lib/data/res/build.dart index c9ba69c..2fc5c73 100644 --- a/lib/data/res/build.dart +++ b/lib/data/res/build.dart @@ -2,5 +2,5 @@ class Build { static const String name = "GPTBox"; - static const int build = 245; + static const int build = 246; } diff --git a/lib/view/page/home/bottom.dart b/lib/view/page/home/bottom.dart index dcbdf7a..09bc224 100644 --- a/lib/view/page/home/bottom.dart +++ b/lib/view/page/home/bottom.dart @@ -126,14 +126,16 @@ class _HomeBottom extends StatelessWidget { // }, onTap: () async { if (_curPage.value != HomePageEnum.chat) { - _dontCloseIme = true; await _switchPage(HomePageEnum.chat); - _dontCloseIme = false; } // Wait IME popup await Future.delayed(Durations.medium4); _scrollBottom(); }, + onTapOutside: (p0) { + if (_curPage.value == HomePageEnum.chat) return; + _imeFocus.unfocus(); + }, contextMenuBuilder: (context, editableTextState) { //final TextEditingValue value = editableTextState.textEditingValue; final List buttonItems = diff --git a/lib/view/page/home/var.dart b/lib/view/page/home/var.dart index e1bf45a..35312b1 100644 --- a/lib/view/page/home/var.dart +++ b/lib/view/page/home/var.dart @@ -38,11 +38,7 @@ ChatHistory? get _curChat => _allHistories[_curChatId]; final _loadingChatIds = {}; final _loadingChatIdRN = RNode(); -var _dontCloseIme = false; -final _curPage = HomePageEnum.chat.vn - ..addListener(() { - if (!_dontCloseIme) _imeFocus.unfocus(); - }); +final _curPage = HomePageEnum.chat.vn; final _imeFocus = FocusNode(); diff --git a/pubspec.lock b/pubspec.lock index d8d4f41..78e7a48 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -398,8 +398,8 @@ packages: dependency: "direct dev" description: path: "." - ref: "v1.0.32" - resolved-ref: "66b36278a2f9f60da3dba804e81148afc60e342e" + ref: "v1.0.33" + resolved-ref: "885c3479db8867f1c4078b97f65578ee2cbc9466" url: "https://github.com/lppcg/fl_build.git" source: git version: "1.0.0" diff --git a/pubspec.yaml b/pubspec.yaml index 0f327cd..f594898 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,7 +1,7 @@ name: gpt_box description: "A third-party GPT Client for OpenAI API." publish_to: 'none' -version: 1.0.245+245 +version: 1.0.246+246 environment: sdk: '>=3.3.0 <4.0.0' @@ -46,7 +46,7 @@ dev_dependencies: fl_build: git: url: https://github.com/lppcg/fl_build.git - ref: v1.0.32 + ref: v1.0.33 # path: ../fl_build flutter: