import 'package:flutter/material.dart'; import 'package:tdesign_flutter/tdesign_flutter.dart'; import 'app_colors.dart'; class AppTheme { AppTheme._(); /// TDesign 主题数据,注入自定义品牌色和字体 static TDThemeData get tdThemeData { final base = TDThemeData.defaultData(); return base.copyWithTDThemeData( 'tbossCustom', colorMap: { 'brandNormalColor': AppColors.primary, 'brandClickColor': AppColors.primaryActive, 'successNormalColor': AppColors.success, 'warningNormalColor': AppColors.warning, 'errorNormalColor': AppColors.danger, 'textColorPrimary': AppColors.textPrimary, 'textColorSecondary': AppColors.textSecondary, 'textColorPlaceholder': AppColors.textPlaceholder, 'bgColorPage': AppColors.bgPage, 'bgColorContainer': AppColors.bgCard, 'borderColor': AppColors.border, }, fontMap: { 'fontBodyMedium': Font(size: AppFontSizes.body.toInt(), lineHeight: 22), 'fontBodySmall': Font( size: AppFontSizes.caption.toInt(), lineHeight: 20, ), 'fontTitleMedium': Font( size: AppFontSizes.subtitle.toInt(), lineHeight: 24, ), 'fontTitleLarge': Font( size: AppFontSizes.title.toInt(), lineHeight: 26, ), }, ); } static ThemeData get light { final colorScheme = ColorScheme.fromSeed( seedColor: AppColors.primary, brightness: Brightness.light, ).copyWith(surface: AppColors.bgPage); return ThemeData( useMaterial3: true, colorScheme: colorScheme, canvasColor: AppColors.bgPage, scaffoldBackgroundColor: AppColors.bgPage, appBarTheme: const AppBarTheme( backgroundColor: AppColors.primary, foregroundColor: Colors.white, elevation: 0, centerTitle: false, titleTextStyle: TextStyle( fontSize: AppFontSizes.title, fontWeight: FontWeight.w600, color: Colors.white, ), ), cardTheme: CardThemeData( color: AppColors.bgCard, elevation: 1, shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)), ), elevatedButtonTheme: ElevatedButtonThemeData( style: ElevatedButton.styleFrom( backgroundColor: AppColors.primary, foregroundColor: Colors.white, shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(22), ), minimumSize: const Size(double.infinity, 44), textStyle: const TextStyle( fontSize: AppFontSizes.body, fontWeight: FontWeight.w600, ), ), ), outlinedButtonTheme: OutlinedButtonThemeData( style: OutlinedButton.styleFrom( foregroundColor: AppColors.textPrimary, shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(22), ), minimumSize: const Size(double.infinity, 44), side: const BorderSide(color: AppColors.border), textStyle: const TextStyle(fontSize: AppFontSizes.body), ), ), dividerColor: AppColors.border, dividerTheme: const DividerThemeData( color: AppColors.border, thickness: 1, ), ); } }