99 lines
3.3 KiB
Dart
99 lines
3.3 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'app_colors.dart';
|
|
|
|
class AppTheme {
|
|
static ThemeData get lightTheme {
|
|
// Base text theme with DM Sans (PRD: 正文/UI 字体)
|
|
final baseTextTheme = const TextTheme(
|
|
// h1 / Large Headings
|
|
displayLarge: TextStyle(
|
|
color: AppColors.textPrimary,
|
|
fontSize: 32,
|
|
fontWeight: FontWeight.w700,
|
|
letterSpacing: -0.5,
|
|
),
|
|
// h2 / Subheadings
|
|
displayMedium: TextStyle(
|
|
color: AppColors.textPrimary,
|
|
fontSize: 24,
|
|
fontWeight: FontWeight.w600,
|
|
),
|
|
// Body Text
|
|
bodyLarge: TextStyle(
|
|
color: AppColors.textPrimary,
|
|
fontSize: 16,
|
|
fontWeight: FontWeight.w400,
|
|
height: 1.5,
|
|
),
|
|
bodyMedium: TextStyle(
|
|
color: AppColors.textSecondary,
|
|
fontSize: 14,
|
|
fontWeight: FontWeight.w400,
|
|
),
|
|
// Small captions
|
|
bodySmall: TextStyle(color: AppColors.textLight, fontSize: 12),
|
|
// Button Text
|
|
labelLarge: TextStyle(
|
|
color: Colors.white,
|
|
fontSize: 16,
|
|
fontWeight: FontWeight.w600,
|
|
letterSpacing: 0.5,
|
|
),
|
|
).apply(fontFamily: 'DM Sans');
|
|
|
|
// Apply Outfit to heading styles (PRD: 标题/Display 字体)
|
|
final textTheme = baseTextTheme.copyWith(
|
|
displayLarge: baseTextTheme.displayLarge?.copyWith(fontFamily: 'Outfit'),
|
|
displayMedium: baseTextTheme.displayMedium?.copyWith(fontFamily: 'Outfit'),
|
|
displaySmall: baseTextTheme.displaySmall?.copyWith(fontFamily: 'Outfit'),
|
|
headlineLarge: baseTextTheme.headlineLarge?.copyWith(fontFamily: 'Outfit'),
|
|
headlineMedium: baseTextTheme.headlineMedium?.copyWith(fontFamily: 'Outfit'),
|
|
headlineSmall: baseTextTheme.headlineSmall?.copyWith(fontFamily: 'Outfit'),
|
|
titleLarge: baseTextTheme.titleLarge?.copyWith(fontFamily: 'Outfit'),
|
|
titleMedium: baseTextTheme.titleMedium?.copyWith(fontFamily: 'Outfit'),
|
|
titleSmall: baseTextTheme.titleSmall?.copyWith(fontFamily: 'Outfit'),
|
|
);
|
|
|
|
return ThemeData(
|
|
useMaterial3: true,
|
|
scaffoldBackgroundColor: AppColors.bgBase,
|
|
primaryColor: AppColors.primaryIndigo,
|
|
colorScheme: ColorScheme.fromSeed(
|
|
seedColor: AppColors.primaryIndigo,
|
|
primary: AppColors.primaryIndigo,
|
|
secondary: AppColors.primaryPurple,
|
|
surface: AppColors.bgBase,
|
|
background: AppColors.bgBase,
|
|
),
|
|
// PRD: DM Sans 为默认正文字体,回退到系统字体
|
|
fontFamily: 'DM Sans',
|
|
fontFamilyFallback: const [
|
|
'Roboto',
|
|
'PingFang SC',
|
|
'Helvetica Neue',
|
|
],
|
|
textTheme: textTheme,
|
|
snackBarTheme: SnackBarThemeData(
|
|
backgroundColor: const Color(0xFFF9FAFB),
|
|
contentTextStyle: const TextStyle(
|
|
color: Color(0xFF374151),
|
|
fontSize: 14,
|
|
),
|
|
shape: RoundedRectangleBorder(
|
|
borderRadius: BorderRadius.circular(16),
|
|
),
|
|
behavior: SnackBarBehavior.floating,
|
|
elevation: 4,
|
|
insetPadding: const EdgeInsets.symmetric(horizontal: 20, vertical: 10),
|
|
),
|
|
);
|
|
}
|
|
|
|
// Animation Curves from CSS
|
|
// --ease-smooth: cubic-bezier(0.4, 0, 0.2, 1);
|
|
static const Curve easeSmooth = Cubic(0.4, 0, 0.2, 1);
|
|
|
|
// --ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
|
|
static const Curve easeBounce = Cubic(0.34, 1.56, 0.64, 1);
|
|
}
|