From 0599d6dc23f3a7239b562d1bf371f3a9cf63d4ab Mon Sep 17 00:00:00 2001 From: Alan Silva Date: Thu, 3 Dec 2026 16:47:15 +0000 Subject: [PATCH] App: keep the Terminal text theme in its own file Co-Authored-By: Claude Opus 5.5 --- app/lib/ui/theme/terminal_theme.dart | 33 +-------------------- app/lib/ui/theme/terminal_typography.dart | 35 +++++++++++++++++++++++ 2 files changed, 36 insertions(+), 32 deletions(-) create mode 100644 app/lib/ui/theme/terminal_typography.dart diff --git a/app/lib/ui/theme/terminal_theme.dart b/app/lib/ui/theme/terminal_theme.dart index 8e13cf86..23124f46 100644 --- a/app/lib/ui/theme/terminal_theme.dart +++ b/app/lib/ui/theme/terminal_theme.dart @@ -6,6 +6,7 @@ import 'app_design.dart'; import 'app_design_tokens.dart'; import 'app_theme.dart'; import 'terminal_palette.dart'; +import 'terminal_typography.dart'; /// Terminal's corner radius: square enough to read as a terminal frame, soft /// enough not to alias. @@ -228,35 +229,3 @@ ThemeData terminalTheme(Brightness brightness) { ), ); } - -/// [base] in the monospace family at a terminal's compact size: Material's -/// roles a step smaller (monospace runs wide), with no added letter spacing. -TextTheme terminalTextTheme(TextTheme base) { - TextStyle? mono(TextStyle? style) { - if (style == null) return null; - final size = style.fontSize; - return style.copyWith( - fontFamily: appMonospaceFamily, - fontSize: size == null ? null : (size * 0.875).roundToDouble(), - letterSpacing: 0, - ); - } - - return base.copyWith( - displayLarge: mono(base.displayLarge), - displayMedium: mono(base.displayMedium), - displaySmall: mono(base.displaySmall), - headlineLarge: mono(base.headlineLarge), - headlineMedium: mono(base.headlineMedium), - headlineSmall: mono(base.headlineSmall), - titleLarge: mono(base.titleLarge), - titleMedium: mono(base.titleMedium), - titleSmall: mono(base.titleSmall), - bodyLarge: mono(base.bodyLarge), - bodyMedium: mono(base.bodyMedium), - bodySmall: mono(base.bodySmall), - labelLarge: mono(base.labelLarge), - labelMedium: mono(base.labelMedium), - labelSmall: mono(base.labelSmall), - ); -} diff --git a/app/lib/ui/theme/terminal_typography.dart b/app/lib/ui/theme/terminal_typography.dart new file mode 100644 index 00000000..eb6fe27c --- /dev/null +++ b/app/lib/ui/theme/terminal_typography.dart @@ -0,0 +1,35 @@ +import 'package:flutter/material.dart'; + +import '../text/monospace.dart'; + +/// [base] in the monospace family at a terminal's compact size: Material's +/// roles a step smaller (monospace runs wide), with no added letter spacing. +TextTheme terminalTextTheme(TextTheme base) { + TextStyle? mono(TextStyle? style) { + if (style == null) return null; + final size = style.fontSize; + return style.copyWith( + fontFamily: appMonospaceFamily, + fontSize: size == null ? null : (size * 0.875).roundToDouble(), + letterSpacing: 0, + ); + } + + return base.copyWith( + displayLarge: mono(base.displayLarge), + displayMedium: mono(base.displayMedium), + displaySmall: mono(base.displaySmall), + headlineLarge: mono(base.headlineLarge), + headlineMedium: mono(base.headlineMedium), + headlineSmall: mono(base.headlineSmall), + titleLarge: mono(base.titleLarge), + titleMedium: mono(base.titleMedium), + titleSmall: mono(base.titleSmall), + bodyLarge: mono(base.bodyLarge), + bodyMedium: mono(base.bodyMedium), + bodySmall: mono(base.bodySmall), + labelLarge: mono(base.labelLarge), + labelMedium: mono(base.labelMedium), + labelSmall: mono(base.labelSmall), + ); +}