Skip to content

[TextField] The computation of the intrinsic width of a TextField should include the hint width only when visible #93337

@ramsestom

Description

@ramsestom

Currently, when a TextField has decoration with an hint text, the width of this hint element is always integrated into the computation of the intrinsic width of the TextField widget, even if this hint is not displayed (= when the TextField text is not empty). This do not really make sense. As a consequence of this, when wrapping a TextField with an hint into an IntrinsicWidth widget or when setting a suffixText decoration to the TextField, the result is not the one you would expect as the minimal width of the text field would be constrained by the hint width.
This should be fixed by integrating the width of the hint text into the computation of the TextField intrinsic width only when its text is empty (=when the hint is actually displayed).

Metadata

Metadata

Assignees

Labels

P2Important issues not at the top of the work lista: text inputEntering text in a text field or keyboard related problemsfound in release: 2.5Found to occur in 2.5found in release: 2.6Found to occur in 2.6frameworkflutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onr: fixedIssue is closed as already fixed in a newer versionteam-frameworkOwned by Framework teamtriaged-frameworkTriaged by Framework team

Type

No type

Projects

Status

Done (PR merged)

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions