Typography class
The color and geometry TextThemes for Material apps.
The text theme provided by the overall Theme, ThemeData.textTheme, is based on the current locale's MaterialLocalizations.scriptCategory and is created by merging a color text theme - black for Brightness.light themes and white for Brightness.dark themes - and a geometry text theme, one of englishLike, dense, or tall, depending on the locale.
To lookup the localized text theme use
Theme.of(context).textTheme
.
The color text themes are blackMountainView, whiteMountainView, blackCupertino, and whiteCupertino. The Mountain View theme TextStyles are based on the Roboto fonts as used on Android. The Cupertino themes are based on the San Francisco font fonts as used by Apple on iOS.
Two sets of geometry themes are provided: 2014 and 2018. The 2014 themes correspond to the original version of the Material Design spec and are the defaults. The 2018 themes correspond the second iteration of the specification and feature different font sizes, font weights, and letter spacing values.
By default, ThemeData.typography is Typography.material2014(platform: platform)
which uses englishLike2014, dense2014 and tall2014. To use
the 2018 text theme geometries, specify a value using the Typography.material2018
constructor:
typography: Typography.material2018(platform: platform)
See also:
- Mixed-in types
- Annotations
Constructors
- Typography({TargetPlatform? platform, TextTheme? black, TextTheme? white, TextTheme? englishLike, TextTheme? dense, TextTheme? tall})
-
Creates a typography instance.
factory
- Typography.material2014({TargetPlatform? platform = TargetPlatform.android, TextTheme? black, TextTheme? white, TextTheme? englishLike, TextTheme? dense, TextTheme? tall})
-
Creates a typography instance using Material Design's 2014 defaults.
factory
- Typography.material2018({TargetPlatform? platform = TargetPlatform.android, TextTheme? black, TextTheme? white, TextTheme? englishLike, TextTheme? dense, TextTheme? tall})
-
Creates a typography instance using Material Design's 2018 defaults.
factory
- Typography.material2021({TargetPlatform? platform = TargetPlatform.android, ColorScheme colorScheme = const ColorScheme.light(), TextTheme? black, TextTheme? white, TextTheme? englishLike, TextTheme? dense, TextTheme? tall})
-
Creates a typography instance using Material Design 3 2021 defaults.
factory
Properties
- black → TextTheme
-
A Material Design text theme with dark glyphs.
final
- dense → TextTheme
-
Defines text geometry for dense scripts, such as Chinese, Japanese
and Korean.
final
- englishLike → TextTheme
-
Defines text geometry for ScriptCategory.englishLike scripts, such as
English, French, Russian, etc.
final
- hashCode → int
-
The hash code for this object.
no setteroverride
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- tall → TextTheme
-
Defines text geometry for tall scripts, such as Farsi, Hindi, and Thai.
final
- white → TextTheme
-
A Material Design text theme with light glyphs.
final
Methods
-
copyWith(
{TextTheme? black, TextTheme? white, TextTheme? englishLike, TextTheme? dense, TextTheme? tall}) → Typography - Creates a copy of this Typography with the given fields replaced by the non-null parameter values.
-
debugFillProperties(
DiagnosticPropertiesBuilder properties) → void -
Add additional properties associated with the node.
override
-
geometryThemeFor(
ScriptCategory category) → TextTheme - Returns one of englishLike, dense, or tall.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toDiagnosticsNode(
{String? name, DiagnosticsTreeStyle? style}) → DiagnosticsNode -
Returns a debug representation of the object that is used by debugging
tools and by DiagnosticsNode.toStringDeep.
inherited
-
toString(
{DiagnosticLevel minLevel = DiagnosticLevel.info}) → String -
A string representation of this object.
inherited
-
toStringShort(
) → String -
A brief description of this object, usually just the runtimeType and the
hashCode.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
override
Static Methods
-
lerp(
Typography a, Typography b, double t) → Typography - Linearly interpolate between two Typography objects.
Constants
- blackCupertino → const TextTheme
- A Material Design text theme with dark glyphs based on San Francisco.
- blackHelsinki → const TextTheme
- A Material Design text theme with dark glyphs based on Roboto, with fallback fonts that are likely (but not guaranteed) to be installed on Linux.
- blackMountainView → const TextTheme
- A Material Design text theme with dark glyphs based on Roboto.
- blackRedmond → const TextTheme
- A Material Design text theme with dark glyphs based on Segoe UI.
- blackRedwoodCity → const TextTheme
- A Material Design text theme with dark glyphs based on San Francisco.
- dense2014 → const TextTheme
- Defines text geometry for dense scripts, such as Chinese, Japanese and Korean.
- dense2018 → const TextTheme
- Defines text geometry for dense scripts, such as Chinese, Japanese and Korean.
- dense2021 → const TextTheme
- Defines text geometry for dense scripts, such as Chinese, Japanese and Korean.
- englishLike2014 → const TextTheme
- Defines text geometry for ScriptCategory.englishLike scripts, such as English, French, Russian, etc.
- englishLike2018 → const TextTheme
- Defines text geometry for ScriptCategory.englishLike scripts, such as English, French, Russian, etc.
- englishLike2021 → const TextTheme
- Defines text geometry for ScriptCategory.englishLike scripts, such as English, French, Russian, etc.
- tall2014 → const TextTheme
- Defines text geometry for tall scripts, such as Farsi, Hindi, and Thai.
- tall2018 → const TextTheme
- Defines text geometry for tall scripts, such as Farsi, Hindi, and Thai.
- tall2021 → const TextTheme
- Defines text geometry for tall scripts, such as Farsi, Hindi, and Thai.
- whiteCupertino → const TextTheme
- A Material Design text theme with light glyphs based on San Francisco.
- whiteHelsinki → const TextTheme
- A Material Design text theme with light glyphs based on Roboto, with fallbacks of DejaVu Sans, Liberation Sans and Arial.
- whiteMountainView → const TextTheme
- A Material Design text theme with light glyphs based on Roboto.
- whiteRedmond → const TextTheme
- A Material Design text theme with light glyphs based on Segoe UI.
- whiteRedwoodCity → const TextTheme
- A Material Design text theme with light glyphs based on San Francisco.