Files
pipelines/app/lib/ui/theme/compact_typography.dart
T
2026-12-03 20:01:13 +00:00

37 lines
1.7 KiB
Dart

import 'package:flutter/material.dart';
import 'app_design_styles.dart';
/// Compact's reading type: the interface face at the dense body size
/// (`bodyLarge`, 14px), a little more line height than the role's so long
/// answers stay easy to follow, and about two thirds of a line between
/// paragraphs.
const ReadingType compactReading = ReadingType(height: 1.5, paragraphGap: 0.6);
/// [base] (Material 3's type scale, in the device's interface face) at
/// Compact's sizes: body 13px, labels 11-12px, list and dialog titles 14 and
/// 18px. Line heights sit on a 2px step so rows of mixed roles still line up
/// on the 4px grid. Weights, colours, families and tracking stay Material's;
/// text scaling still applies on top.
TextTheme compactTextTheme(TextTheme base) {
TextStyle? sized(TextStyle? style, double size, double line) =>
style?.copyWith(fontSize: size, height: line / size);
return base.copyWith(
displayLarge: sized(base.displayLarge, 44, 52),
displayMedium: sized(base.displayMedium, 36, 44),
displaySmall: sized(base.displaySmall, 28, 36),
headlineLarge: sized(base.headlineLarge, 26, 32),
headlineMedium: sized(base.headlineMedium, 22, 28),
headlineSmall: sized(base.headlineSmall, 20, 26),
titleLarge: sized(base.titleLarge, 18, 24),
titleMedium: sized(base.titleMedium, 14, 20),
titleSmall: sized(base.titleSmall, 13, 18),
bodyLarge: sized(base.bodyLarge, 14, 20),
bodyMedium: sized(base.bodyMedium, 13, 18),
bodySmall: sized(base.bodySmall, 11.5, 16),
labelLarge: sized(base.labelLarge, 13, 18),
labelMedium: sized(base.labelMedium, 12, 16),
labelSmall: sized(base.labelSmall, 11, 14),
);
}