Repository navigation
TextField, when center aligned, shows caret in the middle when pasting text #22496
Copy link
Copy link
Closed
Labels
a: text inputEntering text in a text field or keyboard related problemsEntering text in a text field or keyboard related problemsframeworkflutter/packages/flutter repository. See also f: labels.flutter/packages/flutter repository. See also f: labels.
Description
Steps to Reproduce
I have a TextField like this:
child: TextField(
onChanged: handleInputChange,
enabled: !disabled,
textAlign: TextAlign.center,
style: TextStyle(color: Colors.black, fontSize: 16.0),
obscureText: obscureText,
decoration: new InputDecoration(
contentPadding: const EdgeInsets.all(7.0),
hintText: hintText,
border: new OutlineInputBorder(
borderRadius: new BorderRadius.all(const Radius.circular(5.0))
)
),
)As I type, the caret is correctly shown at the end, but if I paste text from my keyboard, like my email which it remembers, the caret is shown in the middle in a weird position, not really in between characters. BTW, this does not happen when left aligned, in which case the caret is correctly advanced to the end.
Logs
N/A
Flutter doctor
$ flutter doctor -v
[✓] Flutter (Channel beta, v0.8.2, on Mac OS X 10.13.6 17G65, locale en-US)
• Flutter version 0.8.2 at /Users/pablo/Documents/work/projects/forks/flutter
• Framework revision 5ab9e70727 (3 weeks ago), 2018-09-07 12:33:05 -0700
• Engine revision 58a1894a1c
• Dart version 2.1.0-dev.3.1.flutter-760a9690c2
[✓] Android toolchain - develop for Android devices (Android SDK 28.0.2)
• Android SDK at /Users/pablo/Library/Android/sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-28, build-tools 28.0.2
• ANDROID_HOME = /Users/pablo/Library/Android/sdk
• Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1136-b06)
• All Android licenses accepted.
[✓] iOS toolchain - develop for iOS devices (Xcode 10.0)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 10.0, Build version 10A255
• ios-deploy 2.0.0
• CocoaPods version 1.5.3
[✓] Android Studio (version 3.2)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin version 28.0.2
• Dart plugin version 173.4700
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1136-b06)
[✓] Connected devices (1 available)
• Android SDK built for x86 • emulator-5554 • android-x86 • Android 7.1.1 (API 25) (emulator)
• No issues found!
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
a: text inputEntering text in a text field or keyboard related problemsEntering text in a text field or keyboard related problemsframeworkflutter/packages/flutter repository. See also f: labels.flutter/packages/flutter repository. See also f: labels.

Activity
JediBurrell commentedon Nov 11, 2018
This also happens when writing text if there's a space at the end.
yohom commentedon Nov 16, 2018
I made a workaround to fix this problem, you can try it. @JediBurrell
pablote commentedon Nov 16, 2018
This seems fixed for me starting with
v0.10.2, can you guys verify it got fixed from 0.9.x to 0.10.x?yohom commentedon Nov 16, 2018
My flutter version is
0.11.3, and I met same problem with @JediBurrell 's situation(text if there's a space at the end), so I found a workaround. This is myflutter doctor:justinmc commentedon Dec 26, 2018
I'm unable to reproduce this on the iOS simulator. I'll try on a real device soon if I can get set up. There have been several improvements to the TextField cursor recently that hopefully have fixed this.
goderbauer commentedon Jan 3, 2019
With the example code given I cannot reproduce this anymore on neither a physical Android nor iOS device. I am tentatively closing this. If you still see this, please do not hesitate to reopen with additional details of how you reproduced it.
zoechi commentedon Jan 4, 2019
Looks like a dup of #24456 that was fixed recently #24456 (comment)
github-actions commentedon Aug 14, 2021
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of
flutter doctor -vand a minimal reproduction of the issue.