textTheme property
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 sizeh: Font heightw: 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:
- TextTheme class which contains definitions for the various typographical styles found in Material Design
- Material Design Typography, which explains the various typographical styles in Material Design.
Implementation
TextTheme get textTheme => theme.textTheme;