| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108 |
- import 'package:flutter/material.dart';
- import 'app_colors.dart';
- /// 应用主题配置
- class AppTheme {
- static ThemeData lightTheme = ThemeData(
- useMaterial3: true,
- fontFamily: 'Noto Sans SC',
- colorScheme: ColorScheme.fromSeed(
- seedColor: AppColors.primary,
- brightness: Brightness.light,
- ),
- // 卡片主题
- cardTheme: CardThemeData(
- elevation: 2,
- shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)),
- margin: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
- ),
- // 按钮主题
- elevatedButtonTheme: ElevatedButtonThemeData(
- style: ElevatedButton.styleFrom(
- elevation: 0,
- padding: const EdgeInsets.symmetric(horizontal: 24, vertical: 12),
- shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(6)),
- ),
- ),
- // 输入框主题
- inputDecorationTheme: InputDecorationTheme(
- border: OutlineInputBorder(
- borderRadius: BorderRadius.circular(6),
- borderSide: const BorderSide(color: AppColors.border),
- ),
- enabledBorder: OutlineInputBorder(
- borderRadius: BorderRadius.circular(6),
- borderSide: const BorderSide(color: AppColors.border),
- ),
- focusedBorder: OutlineInputBorder(
- borderRadius: BorderRadius.circular(6),
- borderSide: const BorderSide(color: AppColors.primary, width: 2),
- ),
- contentPadding: const EdgeInsets.symmetric(horizontal: 16, vertical: 12),
- ),
- // 文本主题
- textTheme: const TextTheme(
- displayLarge: TextStyle(
- fontSize: 32,
- fontWeight: FontWeight.bold,
- color: AppColors.textPrimary,
- ),
- displayMedium: TextStyle(
- fontSize: 28,
- fontWeight: FontWeight.bold,
- color: AppColors.textPrimary,
- ),
- displaySmall: TextStyle(
- fontSize: 24,
- fontWeight: FontWeight.bold,
- color: AppColors.textPrimary,
- ),
- headlineLarge: TextStyle(
- fontSize: 20,
- fontWeight: FontWeight.w600,
- color: AppColors.textPrimary,
- ),
- headlineMedium: TextStyle(
- fontSize: 18,
- fontWeight: FontWeight.w600,
- color: AppColors.textPrimary,
- ),
- headlineSmall: TextStyle(
- fontSize: 16,
- fontWeight: FontWeight.w600,
- color: AppColors.textPrimary,
- ),
- bodyLarge: TextStyle(fontSize: 16, color: AppColors.textPrimary),
- bodyMedium: TextStyle(fontSize: 14, color: AppColors.textPrimary),
- bodySmall: TextStyle(fontSize: 12, color: AppColors.textSecondary),
- ),
- // 应用栏主题
- appBarTheme: const AppBarTheme(
- elevation: 0,
- centerTitle: false,
- backgroundColor: AppColors.backgroundLight,
- foregroundColor: AppColors.textPrimary,
- ),
- // 分割线主题
- dividerTheme: const DividerThemeData(
- color: AppColors.borderLight,
- thickness: 1,
- space: 1,
- ),
- );
- static ThemeData darkTheme = ThemeData(
- useMaterial3: true,
- fontFamily: 'Noto Sans SC',
- colorScheme: ColorScheme.fromSeed(
- seedColor: AppColors.primary,
- brightness: Brightness.dark,
- ),
- );
- }
|