textTheme property

TextTheme textTheme

Returns the text theme from the current theme.

This mapping names the typography styles according to the corresponding Flutter theme text styles for better readability and consistency.

Weight tT h w Flutter Theme
Display
Regular tT57 h64 w0 displayLarge
Regular tT45 h52 w0 displayMedium
Regular tT36 h44 w0 displaySmall
Headline
Regular tT28 h36 w0 headlineMedium
Regular tT24 h32 w0 headlineSmall
Title
Medium tT22 h28 w0 titleLarge
Medium tT16 h24 w015 titleMedium
Medium tT14 h20 w01 titleSmall
Label
Medium tT12 h16 w05 labelLarge
Medium tT11 h16 w05 labelSmall
Body
Regular tT16 h24 w015 bodyLarge
Regular tT14 h20 w025 bodyMedium
Regular tT12 h16 w04 bodySmall

Legend:

  • tT: Font size
  • h: Font height
  • w: Spacing

Example:

Text(
  'Hello, World!',
  style: textTheme.displayLarge,
)

In this example, the displayLarge style from the text theme is applied to the Text widget.

See also:

Implementation

TextTheme get textTheme => theme.textTheme;