-
Notifications
You must be signed in to change notification settings - Fork 29.1k
Description
Use case
When applying TextDecoration.underline
in Flutter, the underline always passes through descenders of glyphs (like g
, j
, p
, q
, y
). This makes text harder to read compared to modern text rendering engines that support underline skipping.
On the web and in CSS, this feature is controlled via text-decoration-skip-ink
. Many design systems expect consistent typography between Flutter and the web, but Flutter currently lacks this capability.
Proposal
Introduce a property on TextStyle
, for example:
TextStyle(
decoration: TextDecoration.underline,
decorationSkipInk: true, // new property
);
When decorationSkipInk: true
, Flutter’s text rendering engine should avoid drawing underlines through glyph descenders, making underlined text more visually pleasing.
Why this needs to considered?
- Using just only
decorationStyle: TextDecorationStyle.solid
(still doesn’t skip ink). - Writing a
CustomPainter
to manually draw underlines that skip glyph bounds. This works, but it is inefficient, complex, and inconsistent compared to having native engine support. - No package on pub.dev currently provides a clean drop-in replacement.
Why Flutter should provide this
This feature aligns Flutter with web typography standards (text-decoration-skip-ink
) and improves text readability. It should be available out-of-the-box in TextStyle
rather than requiring custom painters for every use case. And this contibutes to make Flutter apps way more beautiful.