[Breaking Change] TextPainter no longer rounds up the text width to the next integer

425 views
Skip to first unread message

Longcatis Looong

unread,
Aug 10, 2023, 3:27:39 PM8/10/23
to Flutter Public Announcements (flutter-announce)

Starting from Flutter 3.14.0-1.0.pre, the TextPainter class reports the exact width (that is, without applying double.ceil()) of a paragraph. This fixes https://github.com/flutter/flutter/issues/31707.

As a result of this change, some Text or TextField widgets may become slightly narrower. For example, a Text widget that was 15 pixels wide before may now be 14.2 pixels wide.

This is not an API change, but it may introduce some (often subtle) changes to your UI. These changes include:

  1. Widgets with text may become slightly narrowerButtons and ActionChips, for example, may see a decrease in width by less than 1 logical pixel.
  2. Widgets may shift slightly to the left or to the right.
  3. A horizontal Wrap container may put more child widgets on the same line, since some children are now narrower.
  4. It’s less common, but line breaks may change. Multiline text may occupy fewer lines or be broken at different words.
Reply all
Reply to author
Forward
0 new messages