Skip to content

[Text] Allow for line height *between* lines on text.  #47175

@johnsonmh

Description

@johnsonmh

Use case

This is the default behavior for TextViews on Android. The lineHeight param only applies between lines. This is useful, for example, when you want to increase the line height in your TextTheme. For multiple lines of text, this will increase the spacing between the lines of text. But, importantly, for single lines of text, they will remain unaffected. This means that if you have single line of text that is vertically aligned with a button or a switch, the text will not be affected (and appear off center).

Proposal

It would be nice to have API in TextStyle for specifying the lineHeight behavior. Maybe it could be an enum, something like:

enum LineHeightBehavior {
   betweenLinesOnly,
   aboveAndBelowLines,
   ...
}

That way on TextStyle I could do something like

TextTheme(
  body1: TextStyle(
    height: 1.2,
    lineHeightBehavior: LineHeightBehavior.betweenLinesOnly,
  ),
),

.

Metadata

Metadata

Assignees

Labels

a: typographyText rendering, possibly libtxtc: new featureNothing broken; request for a new capabilityengineflutter/engine related. See also e: labels.frameworkflutter/packages/flutter repository. See also f: labels.

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions