101 lines
3.4 KiB
Dart
101 lines
3.4 KiB
Dart
import 'package:flutter/material.dart';
|
|
|
|
import 'yanting_text.dart';
|
|
import 'yanting_tokens.dart';
|
|
import 'wise_tokens.dart';
|
|
|
|
ThemeData buildAppTheme() {
|
|
final scheme = ColorScheme.fromSeed(
|
|
seedColor: YantingColors.primary,
|
|
primary: YantingColors.primary,
|
|
onPrimary: YantingColors.primaryForeground,
|
|
secondary: YantingColors.secondary,
|
|
onSecondary: YantingColors.secondaryForeground,
|
|
tertiary: YantingColors.link,
|
|
surface: YantingColors.card,
|
|
onSurface: YantingColors.foreground,
|
|
error: YantingColors.destructive,
|
|
outline: YantingColors.border,
|
|
);
|
|
return ThemeData(
|
|
useMaterial3: true,
|
|
colorScheme: scheme,
|
|
fontFamily: YantingText.fontFamily,
|
|
fontFamilyFallback: YantingText.fontFallback,
|
|
scaffoldBackgroundColor: YantingColors.background,
|
|
appBarTheme: const AppBarTheme(
|
|
backgroundColor: YantingColors.background,
|
|
foregroundColor: YantingColors.foreground,
|
|
elevation: 0,
|
|
centerTitle: false,
|
|
titleTextStyle: YantingText.sectionTitle,
|
|
),
|
|
cardTheme: const CardThemeData(
|
|
color: YantingColors.card,
|
|
elevation: 0,
|
|
margin: EdgeInsets.zero,
|
|
shape: RoundedRectangleBorder(
|
|
borderRadius: BorderRadius.all(Radius.circular(WiseRadius.md)),
|
|
side: BorderSide(color: YantingColors.border),
|
|
),
|
|
),
|
|
dividerTheme: const DividerThemeData(
|
|
color: YantingColors.border,
|
|
thickness: 1,
|
|
space: 1,
|
|
),
|
|
inputDecorationTheme: InputDecorationTheme(
|
|
filled: true,
|
|
fillColor: YantingColors.background,
|
|
hintStyle: YantingText.body.copyWith(
|
|
color: YantingColors.mutedForeground,
|
|
),
|
|
contentPadding: const EdgeInsets.symmetric(horizontal: 14),
|
|
border: OutlineInputBorder(
|
|
borderRadius: BorderRadius.circular(YantingRadius.md),
|
|
borderSide: const BorderSide(color: YantingColors.input),
|
|
),
|
|
enabledBorder: OutlineInputBorder(
|
|
borderRadius: BorderRadius.circular(YantingRadius.md),
|
|
borderSide: const BorderSide(color: YantingColors.input),
|
|
),
|
|
focusedBorder: OutlineInputBorder(
|
|
borderRadius: BorderRadius.circular(YantingRadius.md),
|
|
borderSide: const BorderSide(color: YantingColors.foreground),
|
|
),
|
|
),
|
|
navigationBarTheme: NavigationBarThemeData(
|
|
backgroundColor: YantingColors.background,
|
|
indicatorColor: Colors.transparent,
|
|
labelTextStyle: WidgetStateProperty.resolveWith(
|
|
(states) => YantingText.meta.copyWith(
|
|
color: states.contains(WidgetState.selected)
|
|
? YantingColors.foreground
|
|
: YantingColors.mutedForeground,
|
|
fontSize: 11,
|
|
fontWeight: states.contains(WidgetState.selected)
|
|
? FontWeight.w600
|
|
: FontWeight.w400,
|
|
),
|
|
),
|
|
iconTheme: WidgetStateProperty.resolveWith(
|
|
(states) => IconThemeData(
|
|
color: states.contains(WidgetState.selected)
|
|
? YantingColors.foreground
|
|
: YantingColors.mutedForeground,
|
|
),
|
|
),
|
|
),
|
|
textTheme: const TextTheme(
|
|
headlineSmall: YantingText.appTitle,
|
|
titleLarge: YantingText.sectionTitle,
|
|
titleMedium: YantingText.cardTitle,
|
|
bodyLarge: YantingText.body,
|
|
bodyMedium: YantingText.sub,
|
|
bodySmall: YantingText.meta,
|
|
labelLarge: YantingText.chip,
|
|
labelSmall: YantingText.badge,
|
|
),
|
|
);
|
|
}
|