[Breaking Change] Increasing Default TextField Height to Meet Material Guidelines

1,007 views
Skip to first unread message

Justin McCandless

unread,
Oct 21, 2019, 12:27:31 PM10/21/19
to flutter-...@googlegroups.com
I'm proposing to increase the default height of TextField by 8 pixels in order to comply with the Material spec's minimum interactive size guideline.

Issue: https://github.com/flutter/flutter/issues/41200
PR: https://github.com/flutter/flutter/pull/42449

Currently, TextFields are 40px high with default settings. This change would set a minimum height of 48px for all TextFields where the isDense flag on InputDecorator is not true. Any field whose height is calculated to be less than 48px would be bumped up to 48 and its content vertically centered. Smaller TextFields could still be created with the isDense flag set to true.

Anyone that currently has a TextField that is below 48px high in their app, including those just using the default TextField settings, will see the size of these fields increase. These affected apps will need to update any visual diff tests covering these fields, and may also need to adjust their layouts to accommodate the larger fields.

If someone wishes to keep their TextFields at a height of less than 48px, they may do so by using the isDense flag.  As a specific example, the following code will create a TextField that is still the original default height of 40px:

TextField(
  style: TextStyle(height: 1.5),
  decoration: InputDecoration(isDense: true),
)

Please let me know if you have any trouble migrating and need some help! I'm reachable at this email address or on Github in the given PR (@justinmc).

If anyone objects to this change or would like to discuss further, please comment in the linked PR.


Thanks,

Justin
Reply all
Reply to author
Forward
0 new messages