大家好,我正试图通过点击图片中出现的按钮来改变对文本框的关注.
我试了FocusScope.of(context).nextFocus();
次这个方法.当我运行此方法时,键盘关闭,当前活动的文本字段上的焦点丢失,下一个文本字段也不活动.
有谁能帮帮我.
我的Flutter 翼版本是:3.0.5
Flutter 治疗仪输出:
[✓] Flutter (Channel stable, 3.0.5, on macOS 12.4 21F79
darwin-arm, locale en-US)
• Flutter version 3.0.5 at
/Users/seniorturkmen/fvm/versions/stable
• Upstream repository
https://github.com/flutter/flutter.git
• Framework revision f1875d570e (5 weeks ago),
2022-07-13 11:24:16 -0700
• Engine revision e85ea0e79c
• Dart version 2.17.6
• DevTools version 2.12.2
[!] Android toolchain - develop for Android devices
(Android SDK version 33.0.0)
• Android SDK at
/Users/seniorturkmen/Library/Android/sdk
• Platform android-33, build-tools 33.0.0
• Java binary at: /Applications/Android
Studio.app/Contents/jre/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build
11.0.12+0-b1504.28-7817840)
✗ Android license status unknown.
Run `flutter doctor --android-licenses` to accept
the SDK licenses.
See
https://flutter.dev/docs/get-started/install/maco
s#android-setup for more details.
[✓] Xcode - develop for iOS and macOS (Xcode 13.4.1)
• Xcode at
/Applications/Xcode.app/Contents/Developer
• CocoaPods version 1.11.3
[✓] Chrome - develop for the web
• Chrome at /Applications/Google
Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 2021.2)
• Android Studio at /Applications/Android
Studio.app/Contents
• Flutter plugin can be installed from:
????
https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
???? https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build
11.0.12+0-b1504.28-7817840)
[✓] VS Code (version 1.70.1)
• VS Code at /Applications/Visual Studio
Code.app/Contents
• Flutter extension version 3.46.0
[✓] Connected device (3 available)
• iPhone 12 (mobile) •
AC295A39-16D5-4B2C-8A9F-567492AD9E01 • ios
• com.apple.CoreSimulator.SimRuntime.iOS-15-5
(simulator)
• macOS (desktop) • macos
• darwin-arm64 • macOS 12.4 21F79 darwin-arm
• Chrome (web) • chrome
• web-javascript • Google Chrome 104.0.5112.79
[✓] HTTP Host Availability
• All required HTTP hosts are available
! Doctor found issues in 1 category.
Edit个
键盘操作小部件代码如下
void showOverlay(
BuildContext context,
) {
if (overlayEntry != null) return;
OverlayState? overlayState = Overlay.of(context);
overlayEntry = OverlayEntry(
builder: (context) {
return Positioned(
bottom: MediaQuery.of(context).viewInsets.bottom,
right: 0.0,
left: 0.0,
child: KeyboardInputWidget(
previous: FocusScope.of(context).previousFocus,
next: FocusScope.of(context).nextFocus,
),
);
},
);
overlayState?.insert(overlayEntry!);
}