FTypography class final
The typographical tokens.
A FTypography contains scalar values for scaling a TextStyle's corresponding properties. It also contains labelled font sizes, such as FTypography.xs, which are based on Tailwind CSS.
The scaling is applied automatically in all Forui widgets while the labelled font sizes are used as the defaults
for the corresponding properties of widget styles configured via inherit(...) constructors.
CJK Text Alignment
When using CJK (Chinese, Japanese, Korean) scripts, text may appear vertically misaligned. This is a known Flutter issue.
As a temporary workaround, wrap the affected widget in a DefaultTextStyle with the appropriate TextHeightBehavior:
DefaultTextStyle.merge(
textHeightBehavior: const TextHeightBehavior(
applyHeightToFirstAscent: false,
applyHeightToLastDescent: false,
),
child: FButton(
onPressed: () {},
child: const Text('按钮'),
),
)
- Mixed-in types
Constructors
- FTypography({String fontFamily = FTypography.defaultFontFamily, TextStyle? xs3, TextStyle? xs2, TextStyle? xs, TextStyle? sm, TextStyle? md, TextStyle? lg, TextStyle? xl, TextStyle? xl2, TextStyle? xl3, TextStyle? xl4, TextStyle? xl5, TextStyle? xl6, TextStyle? xl7, TextStyle? xl8})
- Creates a FTypography that defaults to touch font sizes.
- FTypography.inherit({required FColors colors, required bool touch, String fontFamily = FTypography.defaultFontFamily})
-
Creates a FTypography that inherits its properties.
factory
- FTypography.lerp(FTypography a, FTypography b, double t)
-
Creates a linear interpolation between two FTypographys using the given factor
t.factory
Properties
- fontFamily → String
-
The font family. Defaults to defaultFontFamily.
final
- hashCode → int
-
The hash code for this object.
no setteroverride
- lg → TextStyle
-
The font size for large text.
final
- md → TextStyle
-
The font size for medium text.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- sm → TextStyle
-
The font size for small text.
final
- xl → TextStyle
-
The font size for extra large text.
final
- xl2 → TextStyle
-
The font size for extra large text.
final
- xl3 → TextStyle
-
The font size for extra large text.
final
- xl4 → TextStyle
-
The font size for extra large text.
final
- xl5 → TextStyle
-
The font size for extra large text.
final
- xl6 → TextStyle
-
The font size for extra large text.
final
- xl7 → TextStyle
-
The font size for extra large text.
final
- xl8 → TextStyle
-
The font size for extra large text.
final
- xs → TextStyle
-
The font size for extra small text.
final
- xs2 → TextStyle
-
The font size for extra extra small text.
final
- xs3 → TextStyle
-
The font size for extra extra extra small text.
final
Methods
-
copyWith(
{TextStyle? xs3, TextStyle? xs2, TextStyle? xs, TextStyle? sm, TextStyle? md, TextStyle? lg, TextStyle? xl, TextStyle? xl2, TextStyle? xl3, TextStyle? xl4, TextStyle? xl5, TextStyle? xl6, TextStyle? xl7, TextStyle? xl8}) → FTypography - Returns a copy of this FTypography with the given properties replaced.
-
debugFillProperties(
DiagnosticPropertiesBuilder properties) → void -
Add additional properties associated with the node.
override
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
scale(
{double sizeScalar = 1}) → FTypography - Scales the fields of this FTypography by the given fields.
-
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
Constants
- defaultFontFamily → const String
-
The default font family. Defaults to
packages/forui/Inter.