AppFontSizesConstants class

Compile-time constant font sizes using the default configuration.

This class provides const font size values that can be used in compile-time constant expressions, unlike AppFontSizes which is instantiated at runtime.

All values are calculated using:

  • Base size: 14 pixels
  • Scale factor: 1.27 (large)

When to use:

  • Use AppFontSizesConstants when you need compile-time constants (e.g., in const constructors, default parameter values)
  • Use AppFontSizes when you need runtime flexibility (e.g., dynamic sizing, user preferences)

Example:

// ✅ Good: Compile-time constant
const TextStyle(
  fontSize: AppFontSizesConstants.body,
);

// ✅ Good: Default parameter value
Widget buildText({
  double fontSize = AppFontSizesConstants.body,
}) { ... }

// ❌ Won't work with AppFontSizes (not const)
const TextStyle(
  fontSize: AppFontSizes().body, // Error!
);

Recommendations:

See also:

Constructors

AppFontSizesConstants()

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

Constants

body → const double
Standard body text: 17.8px (14 × 1.272) - Paragraphs, lists, buttons
bodyLarge → const double
Large body text: 22.6px (17.8 × 1.272) - Emphasized text, callouts
bodySmall → const double
Base font size: 14.0px - Captions, footnotes, metadata
display → const double
Display text: 121.4px (95.4 × 1.272) - Hero text, splash screens
h1 → const double
H1 headings: 95.4px (75.0 × 1.272) - Page titles, main headings
h2 → const double
H2 headings: 75.0px (59.0 × 1.272) - Page subtitles, major sections
h3 → const double
H3 headings: 59.0px (46.4 × 1.272) - Large section titles, modal titles
Main headings: 46.4px (36.5 × 1.272) - Section headers, app bar titles
paragraphTitle → const double
Paragraph titles: 28.7px (22.6 × 1.272) - Card titles, list headers
subheader → const double
Subheadings: 36.5px (28.7 × 1.272) - Dialog titles, subsection headers