AppFontSizesPresets class
Predefined font size configurations for common use cases.
This class provides ready-to-use AppFontSizes instances with different base sizes and scale factors, making it easy to switch between size presets for different contexts like accessibility, device types, or user preferences.
Available Base Sizes:
| Base | Size | Use Case |
|---|---|---|
| small | 12px | Compact UIs, dense information |
| normal | 14px | Standard mobile apps (DEFAULT) |
| large | 16px | Enhanced readability, tablets |
| extraLarge | 18px | Accessibility, large screens |
| huge | 20px | Maximum accessibility, presentations |
Scale Factor Variants:
Each base size has 4 scale factor variants:
base- Uses small scale (1.128) for subtle hierarchybaseNormalScale - Uses normal scale (1.174) for balanced hierarchybaseLargeScale - Uses large scale (1.272) for clear hierarchy ⭐baseExtraLargeScale - Uses golden ratio (1.618) for dramatic impact
Quick Reference Table:
Base Size Presets (with large scale 1.272):
bodySmall body h1 display
small: 12px 15px 38px 61px
normal: 14px 18px 44px 71px
large: 16px 20px 51px 81px
xLarge: 18px 23px 57px 91px
huge: 20px 25px 64px 102px
Example Usage:
// Use default presets (with small scale for compact hierarchy)
final fontSizes = AppFontSizesPresets.normal;
// Use with different scale for more dramatic hierarchy
final fontSizes = AppFontSizesPresets.normalLargeScale;
// Switch based on user preference
final userPreference = 'large';
final fontSizes = switch (userPreference) {
'small' => AppFontSizesPresets.small,
'normal' => AppFontSizesPresets.normalLargeScale,
'large' => AppFontSizesPresets.largeLargeScale,
'extraLarge' => AppFontSizesPresets.extraLargeLargeScale,
_ => AppFontSizesPresets.normalLargeScale,
};
// Combine size and scale for fine-tuned control
final compactData = AppFontSizesPresets.small; // 12px + small scale
final readableContent = AppFontSizesPresets.largeLargeScale; // 16px + large scale
final heroSection = AppFontSizesPresets.normalExtraLargeScale; // 14px + golden ratio
Recommendations by Use Case:
Mobile Apps:
- Default:
normalLargeScale(14px + clear hierarchy) - Compact:
normal(14px + subtle hierarchy) - Accessibility:
largeLargeScaleorextraLargeLargeScale
Tablet Apps:
- Default:
largeLargeScale(16px + clear hierarchy) - Reading apps:
extraLargeLargeScale
Desktop Apps:
- Data-heavy:
smallorsmallNormalScale - Standard:
normalNormalScale - Marketing:
normalExtraLargeScale
Accessibility:
- Level 1:
largeLargeScale - Level 2:
extraLargeLargeScale - Level 3:
hugeLargeScale
See also:
- AppFontSizes for custom configurations
- AppFontSizesScaleFactors for available scale factors
- AppFontSizesConstants for compile-time constants
Constructors
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Properties
- extraLarge → AppFontSizes
-
Extra large 18px base with small scale (1.128) - Accessible with subtle hierarchy.
final
- extraLargeExtraLargeScale → AppFontSizes
-
Extra large 18px base with extra large scale (1.618) - Maximum impact accessible.
final
- extraLargeLargeScale → AppFontSizes
-
Extra large 18px base with large scale (1.272) - Clear accessible hierarchy.
final
- extraLargeNormalScale → AppFontSizes
-
Extra large 18px base with normal scale (1.174) - Accessible balanced design.
final
- huge → AppFontSizes
-
Huge 20px base with small scale (1.128) - Maximum size, subtle hierarchy.
final
- hugeExtraLargeScale → AppFontSizes
-
Huge 20px base with extra large scale (1.618) - Extreme accessibility/impact.
final
- hugeLargeScale → AppFontSizes
-
Huge 20px base with large scale (1.272) - Maximum accessibility.
final
- hugeNormalScale → AppFontSizes
-
Huge 20px base with normal scale (1.174) - Maximum accessible balanced.
final
- large → AppFontSizes
-
Large 16px base with small scale (1.128) - Readable with subtle hierarchy.
final
- largeExtraLargeScale → AppFontSizes
-
Large 16px base with extra large scale (1.618) - Dramatic readable design.
final
- largeLargeScale → AppFontSizes
-
Large 16px base with large scale (1.272) - Excellent readability.
final
- largeNormalScale → AppFontSizes
-
Large 16px base with normal scale (1.174) - Balanced readable design.
final
- normal → AppFontSizes
-
Standard 14px base with small scale (1.128) - DEFAULT, subtle hierarchy.
final
- normalExtraLargeScale → AppFontSizes
-
Standard 14px base with extra large scale (1.618) - Impactful standard base.
final
- normalLargeScale → AppFontSizes
-
Standard 14px base with large scale (1.272) - Clear, modern hierarchy.
final
- normalNormalScale → AppFontSizes
-
Standard 14px base with normal scale (1.174) - Material Design aligned.
final
- small → AppFontSizes
-
Compact 12px base with small scale (1.128) - Most subtle hierarchy.
final
- smallExtraLargeScale → AppFontSizes
-
Compact 12px base with extra large scale (1.618) - Dramatic compact design.
final
- smallLargeScale → AppFontSizes
-
Compact 12px base with large scale (1.272) - Clear hierarchy in small space.
final
- smallNormalScale → AppFontSizes
-
Compact 12px base with normal scale (1.174) - Balanced compact layout.
final