Files
pipelines/app/lib/ui/theme/high_contrast_typography.dart
T

31 lines
1.5 KiB
Dart

import 'package:flutter/material.dart';
/// [base] at High contrast's larger, heavier sizes: body text at 17/16/14px
/// in weight 500, labels at 16/14/13px and titles in weight 600, so thin
/// strokes never wash out in sunlight. Sizes stay theme roles, so the
/// operator's text scaling and the system's bold-text setting (which
/// [Text] applies over these weights) still apply.
TextTheme highContrastTextTheme(TextTheme base) {
TextStyle? set(TextStyle? style, double size, FontWeight weight) =>
style?.copyWith(fontSize: size, fontWeight: weight, letterSpacing: 0.1);
TextStyle? heavier(TextStyle? style) =>
style?.copyWith(fontWeight: FontWeight.w600);
return base.copyWith(
displayLarge: heavier(base.displayLarge),
displayMedium: heavier(base.displayMedium),
displaySmall: heavier(base.displaySmall),
headlineLarge: heavier(base.headlineLarge),
headlineMedium: heavier(base.headlineMedium),
headlineSmall: heavier(base.headlineSmall),
titleLarge: set(base.titleLarge, 22, FontWeight.w600),
titleMedium: set(base.titleMedium, 18, FontWeight.w600),
titleSmall: set(base.titleSmall, 16, FontWeight.w600),
bodyLarge: set(base.bodyLarge, 17, FontWeight.w500),
bodyMedium: set(base.bodyMedium, 16, FontWeight.w500),
bodySmall: set(base.bodySmall, 14, FontWeight.w500),
labelLarge: set(base.labelLarge, 16, FontWeight.w600),
labelMedium: set(base.labelMedium, 14, FontWeight.w600),
labelSmall: set(base.labelSmall, 13, FontWeight.w600),
);
}