-
Notifications
You must be signed in to change notification settings - Fork 26.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TextEditingController.clear() doesn't clear Korean input with a Samsung Keyboard on Android 10. #71782
Comments
Hi @njovy Previewcode sampleimport 'package:flutter/material.dart';
void main() {
runApp(MaterialApp(
home: TextFieldDemo(),
));
}
class TextFieldDemo extends StatefulWidget {
@override
_TextFieldDemoState createState() => _TextFieldDemoState();
}
class _TextFieldDemoState extends State<TextFieldDemo> {
List<String> messages = [];
TextEditingController controller = TextEditingController();
FocusNode focusNode = FocusNode();
@override
Widget build(BuildContext context) {
return Scaffold(
body: Column(
children: [
Expanded(
child: ListView(
reverse: true,
children: messages.map((e) => Text(e)).toList(),
),
),
TextField(
textInputAction: TextInputAction.send,
maxLines: 1,
keyboardType: TextInputType.text,
focusNode: focusNode,
controller: controller,
autofocus: false,
onSubmitted: (input) {
FocusScope.of(context).requestFocus(focusNode);
onSend(input);
},
decoration: InputDecoration(
border: OutlineInputBorder(),
contentPadding: EdgeInsets.only(left: 15, right: 15, bottom: 6),
),
),
FlatButton(
minWidth: MediaQuery.of(context).size.width,
onPressed: () {
onSend(controller.text);
},
child: Text("SEND"))
],
),
);
}
void onSend(String input) {
final message = input.trim();
if (message.isNotEmpty) {
controller.clear();
setState(() {
messages.insert(0, message);
});
}
}
}
flutter doctor -v[✓] Flutter (Channel stable, 1.22.4, on macOS 11.0.1 20B29 darwin-x64, locale
en-GB)
• Flutter version 1.22.4 at /Users/tahatesser/Code/flutter_stable
• Framework revision 1aafb3a8b9 (3 weeks ago), 2020-11-13 09:59:28 -0800
• Engine revision 2c956a31c0
• Dart version 2.10.4
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
• Android SDK at /Users/tahatesser/Code/sdk
• Platform android-30, build-tools 30.0.2
• ANDROID_HOME = /Users/tahatesser/Code/sdk
• Java binary at: /Applications/Android
Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build
1.8.0_242-release-1644-b3-6915495)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 12.2)
• Xcode at /Volumes/Extreme/Xcode.app/Contents/Developer
• Xcode 12.2, Build version 12B45b
• CocoaPods version 1.10.0
[!] Android Studio (version 4.1)
• Android Studio at /Applications/Android Studio.app/Contents
✗ Flutter plugin not installed; this adds Flutter specific functionality.
✗ Dart plugin not installed; this adds Dart specific functionality.
• Java version OpenJDK Runtime Environment (build
1.8.0_242-release-1644-b3-6915495)
[✓] VS Code (version 1.51.1)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.17.0
[✓] Connected device (2 available)
• Taha’s iPad (mobile) • 00008020-000255113EE8402E • ios • iOS
14.2
• iPhone 12 (mobile) • C303B5A5-D598-4CAC-8ACC-09BF07A191DC • ios •
com.apple.CoreSimulator.SimRuntime.iOS-14-2 (simulator)
! Doctor found issues in 1 category. |
@TahaTesser The preview you posted shows that you use the auto suggestion to type. This bug happens due to the way Korean characters are built. It doesn't have to be exact letter as I typed but I believe the auto suggestion clears some flag internally so the bug doesn't appear. |
Hi @njovy Previewhttps://drive.google.com/file/d/1L5TC4XPc-fjpeQYLb-BFu6_Hef_M4tk5/view?usp=sharing |
@TahaTesser It could be device specific or locale but three different devices running Android 10 have this issue with the same code. Galaxy S20 This is a list of devices running Android 10 that has this issue at the moment. |
Steps to Reproduce
TextEditingController.clear()
@GaryQian
Calling
TextEditingController.clear()
doesn't clear text in TextField when a user types Korean.Attached is a minimal code that you can reproduce this bug.
This GIF demonstrates that
clear()
clears the English input but it doesn't clear the input with Korean letters. The previous input that was supposed to be cleared remains.I am mentioning GaryQian because it seems like this issue only appears on Android with a Samsung's Keyboard. The same issue doesn't appear with Gboard.
Even if an expected result is same, the way it appears is not same as #69161 describes so submitting a new issue.
PS: The issue didn't appear on Galaxy S9+ running Android 9 or below. One of my colleagues have tested this bug. Two other different Galaxy devices running Android 10 have this issue so I think this bug is related to OS version specific.
The text was updated successfully, but these errors were encountered: