Skip to content

TextField's IntrinsicWidth should take cursor into account #24612

@sma

Description

@sma

When computing the intrinsic size, I think, the cursor width should be taken into account so that the text field doesn't scroll if the cursor is at the end. I made the cursor very wide to illustrate the point. The text field below contains 12345 and is sized using an InstrinsicWidth widget. The 1 has been scrolled to the left to make room for the cursor. The same effect occurs with a "normal" cursor, but is barely visible.

image

If you consider this behavior "by design", a way to add a width and/or height offset to the intrinsic widgets would be a workaround to get rid of the scrolling.

Output of flutter doctor

[✓] Flutter (Channel master, v0.11.10-pre.1, on Mac OS X 10.14.1 18B75, locale de-DE)
[✓] Android toolchain - develop for Android devices (Android SDK 28.0.3)
[!] iOS toolchain - develop for iOS devices (Xcode 10.1)
    ✗ Verify that all connected devices have been paired with this computer in Xcode.
      If all devices have been paired, libimobiledevice and ideviceinstaller may require updating.
      To update with Brew, run:
        brew update
        brew uninstall --ignore-dependencies libimobiledevice
        brew uninstall --ignore-dependencies usbmuxd
        brew install --HEAD usbmuxd
        brew unlink usbmuxd
        brew link usbmuxd
        brew install --HEAD libimobiledevice
        brew install ideviceinstaller
[✓] Android Studio (version 3.2)
    ✗ Flutter plugin not installed; this adds Flutter specific functionality.
[✓] VS Code (version 1.29.1)
[✓] Connected device (2 available)

Metadata

Metadata

Assignees

Labels

a: text inputEntering text in a text field or keyboard related problemsframeworkflutter/packages/flutter repository. See also f: labels.waiting for PR to land (fixed)A fix is in flight

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions