walletTextScale function

TextTheme walletTextScale(
  1. WalletColors colors
)

The wallet UI's type scale, with NO font family (FR-49 W-3, W-9): sizes, weights and tracking from the refreshed design (Relim design-refresh spec ยง3.6), colours from colors. Every slot the SDK's widgets read is defined, so a host that supplies only some styles still gets the SDK's sizes for the rest, never Material's defaults.

Implementation

TextTheme walletTextScale(WalletColors colors) {
  TextStyle s(
    double size,
    FontWeight weight,
    Color color, {
    double tracking = 0,
    double? height,
  }) => TextStyle(
    fontSize: size,
    fontWeight: weight,
    color: color,
    // Tracking is given in em by the design; Flutter wants logical pixels.
    letterSpacing: tracking * size,
    height: height,
  );

  return TextTheme(
    // The balance figure (the wallet card's total).
    displaySmall: s(38, FontWeight.w700, colors.text, tracking: -0.03),
    // A tab-root large title.
    headlineLarge: s(30, FontWeight.w700, colors.text, tracking: -0.025),
    // A pushed page's title.
    headlineMedium: s(22, FontWeight.w600, colors.text, tracking: -0.01),
    // Sheet titles and step titles.
    headlineSmall: s(24, FontWeight.w700, colors.text, tracking: -0.02),
    // Section titles ("Activity"), empty-state titles.
    titleLarge: s(20, FontWeight.w700, colors.text, tracking: -0.02),
    // Row titles.
    titleMedium: s(16, FontWeight.w600, colors.text),
    // Sub-labels.
    titleSmall: s(14, FontWeight.w600, colors.text),
    // Body text.
    bodyLarge: s(16, FontWeight.w400, colors.text, height: 1.38),
    // Secondary lines and dense rows.
    bodyMedium: s(14, FontWeight.w400, colors.textMuted),
    // Timestamps and meta.
    bodySmall: s(12.5, FontWeight.w400, colors.textMuted),
    // Buttons.
    labelLarge: s(16, FontWeight.w600, colors.text),
    // Chips and label lines.
    labelMedium: s(14, FontWeight.w500, colors.text),
    // Section labels (uppercased by the widget).
    labelSmall: s(12, FontWeight.w600, colors.textMuted, tracking: 0.08),
  );
}