100 lines
3.0 KiB
Dart
100 lines
3.0 KiB
Dart
import 'package:flutter/material.dart';
|
|
|
|
abstract final class AppColors {
|
|
static const primary = Color(0xFF4F46E5);
|
|
static const canvas = Color(0xFFF8FAFC);
|
|
static const ink = Color(0xFF0F172A);
|
|
static const muted = Color(0xFF64748B);
|
|
static const border = Color(0xFFE2E8F0);
|
|
static const success = Color(0xFF10B981);
|
|
static const warning = Color(0xFFF59E0B);
|
|
}
|
|
|
|
ThemeData buildAppTheme() {
|
|
final scheme = ColorScheme.fromSeed(
|
|
seedColor: AppColors.primary,
|
|
brightness: Brightness.light,
|
|
surface: Colors.white,
|
|
);
|
|
|
|
return ThemeData(
|
|
useMaterial3: true,
|
|
colorScheme: scheme,
|
|
scaffoldBackgroundColor: AppColors.canvas,
|
|
fontFamilyFallback: const [
|
|
'Noto Sans CJK SC',
|
|
'Noto Sans SC',
|
|
'PingFang SC',
|
|
'Microsoft YaHei',
|
|
'sans-serif',
|
|
],
|
|
textTheme: const TextTheme(
|
|
headlineSmall: TextStyle(
|
|
color: AppColors.ink,
|
|
fontSize: 22,
|
|
fontWeight: FontWeight.w800,
|
|
),
|
|
titleLarge: TextStyle(
|
|
color: AppColors.ink,
|
|
fontSize: 18,
|
|
fontWeight: FontWeight.w800,
|
|
),
|
|
titleMedium: TextStyle(
|
|
color: AppColors.ink,
|
|
fontSize: 15,
|
|
fontWeight: FontWeight.w700,
|
|
),
|
|
bodyMedium: TextStyle(color: AppColors.ink, fontSize: 14, height: 1.5),
|
|
bodySmall: TextStyle(color: AppColors.muted, fontSize: 12, height: 1.4),
|
|
),
|
|
cardTheme: const CardThemeData(
|
|
color: Colors.white,
|
|
elevation: 0,
|
|
margin: EdgeInsets.zero,
|
|
shape: RoundedRectangleBorder(
|
|
borderRadius: BorderRadius.all(Radius.circular(24)),
|
|
side: BorderSide(color: Color(0xFFF1F5F9)),
|
|
),
|
|
),
|
|
inputDecorationTheme: const InputDecorationTheme(
|
|
filled: true,
|
|
fillColor: Colors.white,
|
|
contentPadding: EdgeInsets.symmetric(horizontal: 16, vertical: 14),
|
|
border: OutlineInputBorder(
|
|
borderRadius: BorderRadius.all(Radius.circular(18)),
|
|
borderSide: BorderSide(color: AppColors.border),
|
|
),
|
|
enabledBorder: OutlineInputBorder(
|
|
borderRadius: BorderRadius.all(Radius.circular(18)),
|
|
borderSide: BorderSide(color: AppColors.border),
|
|
),
|
|
focusedBorder: OutlineInputBorder(
|
|
borderRadius: BorderRadius.all(Radius.circular(18)),
|
|
borderSide: BorderSide(color: AppColors.primary, width: 1.5),
|
|
),
|
|
),
|
|
snackBarTheme: const SnackBarThemeData(
|
|
behavior: SnackBarBehavior.floating,
|
|
shape: RoundedRectangleBorder(
|
|
borderRadius: BorderRadius.all(Radius.circular(16)),
|
|
),
|
|
),
|
|
navigationBarTheme: NavigationBarThemeData(
|
|
backgroundColor: Colors.white,
|
|
indicatorColor: const Color(0xFFE0E7FF),
|
|
height: 72,
|
|
labelTextStyle: WidgetStateProperty.resolveWith((states) {
|
|
return TextStyle(
|
|
fontSize: 11,
|
|
fontWeight: states.contains(WidgetState.selected)
|
|
? FontWeight.w700
|
|
: FontWeight.w500,
|
|
color: states.contains(WidgetState.selected)
|
|
? AppColors.primary
|
|
: AppColors.muted,
|
|
);
|
|
}),
|
|
),
|
|
);
|
|
}
|