Flutter_Pinput
Flutter_Pinput copied to clipboard
'autofocus: true' doesn't open keyboard
Describe the bug If I set autofocus=true, the focus goes to pinput but the keyboard doesn't open. I need to tap on the pinput widget to open the keyboard. The keyboard should also open.
To Reproduce Steps to reproduce the behavior:
- Set autofocus:true
Screenshots
https://github.com/Tkko/Flutter_Pinput/assets/72180606/ffbb39c9-7878-4695-a237-838568c1500c
Pinput version: 3.0.1
Result of: flutter doctor --verbose
[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0) • Android SDK at /Users/avdhoot/Library/Android/sdk • Platform android-34, build-tools 34.0.0 • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 17.0.7+0-17.0.7b1000.6-10550314) • All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 15.3) • Xcode at /Applications/Xcode.app/Contents/Developer • Build 15E204a • CocoaPods version 1.15.2
[✓] Chrome - develop for the web • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 2023.1) • 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 17.0.7+0-17.0.7b1000.6-10550314)
[✓] VS Code (version 1.88.1) • VS Code at /Applications/Visual Studio Code.app/Contents • Flutter extension can be installed from: 🔨 https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter
[✓] Connected device (3 available) • iPhone 15 Pro Max (mobile) • E717C647-386F-4E05-82D9-7B956C76D7EC • ios • com.apple.CoreSimulator.SimRuntime.iOS-17-4 (simulator) • macOS (desktop) • macos • darwin-arm64 • macOS 14.4.1 23E224 darwin-arm64 • Chrome (web) • chrome • web-javascript • Google Chrome 124.0.6367.91
[✓] Network resources • All expected network resources are available.
• No issues found!
Smartphone (please complete the following information):
- Device: Redmi Note 13 Pro
- OS: Android 14
The keyboard also does not appear for me on mobile browsers on iOS.
Hi @jblankenship5, can you check if the autofocus works if you replace Pinput with:
return TextField(
autofocus: true,
);
No it does not @Tkko, after some research I've come to realize that autofocus doesn't work at all on mobile browsers on iOS. I guess the OS requires the user to tap on the screen or give some kind of input. For this reason I have turned auto focus off for iOS browsers, and that includes all the other form widgets in my app.