210 lines
6.9 KiB
Dart
210 lines
6.9 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:google_fonts/google_fonts.dart';
|
|
import 'package:trainhub_flutter/core/theme/app_colors.dart';
|
|
import 'package:trainhub_flutter/core/constants/ui_constants.dart';
|
|
|
|
class AppTheme {
|
|
AppTheme._();
|
|
|
|
static final ThemeData dark = ThemeData(
|
|
useMaterial3: true,
|
|
brightness: Brightness.dark,
|
|
colorScheme: const ColorScheme.dark(
|
|
primary: AppColors.zinc50,
|
|
onPrimary: AppColors.zinc950,
|
|
secondary: AppColors.zinc200,
|
|
onSecondary: AppColors.zinc950,
|
|
surface: AppColors.zinc950,
|
|
onSurface: AppColors.zinc50,
|
|
surfaceContainer: AppColors.zinc900,
|
|
error: AppColors.destructive,
|
|
onError: AppColors.zinc50,
|
|
outline: AppColors.zinc800,
|
|
outlineVariant: AppColors.zinc700,
|
|
),
|
|
scaffoldBackgroundColor: AppColors.surface,
|
|
textTheme: GoogleFonts.interTextTheme(ThemeData.dark().textTheme).apply(
|
|
bodyColor: AppColors.textPrimary,
|
|
displayColor: AppColors.textPrimary,
|
|
),
|
|
cardTheme: CardThemeData(
|
|
color: AppColors.surfaceContainer,
|
|
elevation: 0,
|
|
shape: RoundedRectangleBorder(
|
|
borderRadius: UIConstants.cardBorderRadius,
|
|
side: const BorderSide(color: AppColors.border, width: 1),
|
|
),
|
|
margin: EdgeInsets.zero,
|
|
),
|
|
dividerTheme: const DividerThemeData(
|
|
color: AppColors.border,
|
|
thickness: 1,
|
|
space: 1,
|
|
),
|
|
iconTheme: const IconThemeData(
|
|
color: AppColors.textSecondary,
|
|
size: 20,
|
|
),
|
|
navigationRailTheme: NavigationRailThemeData(
|
|
backgroundColor: AppColors.surfaceContainer,
|
|
selectedIconTheme: const IconThemeData(color: AppColors.textPrimary),
|
|
unselectedIconTheme: const IconThemeData(color: AppColors.textMuted),
|
|
selectedLabelTextStyle: GoogleFonts.inter(
|
|
fontSize: 12,
|
|
fontWeight: FontWeight.w500,
|
|
color: AppColors.textPrimary,
|
|
),
|
|
unselectedLabelTextStyle: GoogleFonts.inter(
|
|
fontSize: 12,
|
|
fontWeight: FontWeight.w400,
|
|
color: AppColors.textMuted,
|
|
),
|
|
indicatorColor: AppColors.zinc700,
|
|
),
|
|
inputDecorationTheme: InputDecorationTheme(
|
|
filled: true,
|
|
fillColor: AppColors.surfaceContainer,
|
|
contentPadding: const EdgeInsets.symmetric(horizontal: 12, vertical: 12),
|
|
border: OutlineInputBorder(
|
|
borderRadius: UIConstants.smallCardBorderRadius,
|
|
borderSide: const BorderSide(color: AppColors.border),
|
|
),
|
|
enabledBorder: OutlineInputBorder(
|
|
borderRadius: UIConstants.smallCardBorderRadius,
|
|
borderSide: const BorderSide(color: AppColors.border),
|
|
),
|
|
focusedBorder: OutlineInputBorder(
|
|
borderRadius: UIConstants.smallCardBorderRadius,
|
|
borderSide: const BorderSide(color: AppColors.zinc400, width: 1),
|
|
),
|
|
hintStyle: GoogleFonts.inter(
|
|
color: AppColors.textMuted,
|
|
fontSize: 14,
|
|
),
|
|
labelStyle: GoogleFonts.inter(
|
|
color: AppColors.textSecondary,
|
|
fontSize: 14,
|
|
),
|
|
),
|
|
dialogTheme: DialogThemeData(
|
|
backgroundColor: AppColors.surfaceContainer,
|
|
shape: RoundedRectangleBorder(
|
|
borderRadius: UIConstants.cardBorderRadius,
|
|
side: const BorderSide(color: AppColors.border),
|
|
),
|
|
titleTextStyle: GoogleFonts.inter(
|
|
fontSize: 18,
|
|
fontWeight: FontWeight.w600,
|
|
color: AppColors.textPrimary,
|
|
),
|
|
),
|
|
filledButtonTheme: FilledButtonThemeData(
|
|
style: FilledButton.styleFrom(
|
|
backgroundColor: AppColors.zinc50,
|
|
foregroundColor: AppColors.zinc950,
|
|
shape: RoundedRectangleBorder(
|
|
borderRadius: UIConstants.smallCardBorderRadius,
|
|
),
|
|
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 10),
|
|
textStyle: GoogleFonts.inter(
|
|
fontSize: 14,
|
|
fontWeight: FontWeight.w500,
|
|
),
|
|
),
|
|
),
|
|
outlinedButtonTheme: OutlinedButtonThemeData(
|
|
style: OutlinedButton.styleFrom(
|
|
foregroundColor: AppColors.textPrimary,
|
|
side: const BorderSide(color: AppColors.border),
|
|
shape: RoundedRectangleBorder(
|
|
borderRadius: UIConstants.smallCardBorderRadius,
|
|
),
|
|
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 10),
|
|
textStyle: GoogleFonts.inter(
|
|
fontSize: 14,
|
|
fontWeight: FontWeight.w500,
|
|
),
|
|
),
|
|
),
|
|
textButtonTheme: TextButtonThemeData(
|
|
style: TextButton.styleFrom(
|
|
foregroundColor: AppColors.textSecondary,
|
|
shape: RoundedRectangleBorder(
|
|
borderRadius: UIConstants.smallCardBorderRadius,
|
|
),
|
|
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 8),
|
|
textStyle: GoogleFonts.inter(
|
|
fontSize: 14,
|
|
fontWeight: FontWeight.w500,
|
|
),
|
|
),
|
|
),
|
|
tabBarTheme: TabBarThemeData(
|
|
labelColor: AppColors.textPrimary,
|
|
unselectedLabelColor: AppColors.textMuted,
|
|
indicatorColor: AppColors.textPrimary,
|
|
dividerColor: AppColors.border,
|
|
labelStyle: GoogleFonts.inter(
|
|
fontSize: 14,
|
|
fontWeight: FontWeight.w500,
|
|
),
|
|
unselectedLabelStyle: GoogleFonts.inter(
|
|
fontSize: 14,
|
|
fontWeight: FontWeight.w400,
|
|
),
|
|
),
|
|
snackBarTheme: SnackBarThemeData(
|
|
backgroundColor: AppColors.surfaceContainer,
|
|
contentTextStyle: GoogleFonts.inter(
|
|
color: AppColors.textPrimary,
|
|
fontSize: 14,
|
|
),
|
|
shape: RoundedRectangleBorder(
|
|
borderRadius: UIConstants.smallCardBorderRadius,
|
|
side: const BorderSide(color: AppColors.border),
|
|
),
|
|
behavior: SnackBarBehavior.floating,
|
|
),
|
|
bottomSheetTheme: const BottomSheetThemeData(
|
|
backgroundColor: AppColors.surfaceContainer,
|
|
shape: RoundedRectangleBorder(
|
|
borderRadius: BorderRadius.vertical(top: Radius.circular(16)),
|
|
),
|
|
),
|
|
dropdownMenuTheme: DropdownMenuThemeData(
|
|
inputDecorationTheme: InputDecorationTheme(
|
|
filled: true,
|
|
fillColor: AppColors.surfaceContainer,
|
|
border: OutlineInputBorder(
|
|
borderRadius: UIConstants.smallCardBorderRadius,
|
|
borderSide: const BorderSide(color: AppColors.border),
|
|
),
|
|
),
|
|
),
|
|
checkboxTheme: CheckboxThemeData(
|
|
fillColor: WidgetStateProperty.resolveWith((states) {
|
|
if (states.contains(WidgetState.selected)) {
|
|
return AppColors.zinc50;
|
|
}
|
|
return Colors.transparent;
|
|
}),
|
|
checkColor: WidgetStateProperty.all(AppColors.zinc950),
|
|
side: const BorderSide(color: AppColors.zinc400),
|
|
shape: RoundedRectangleBorder(
|
|
borderRadius: BorderRadius.circular(4),
|
|
),
|
|
),
|
|
tooltipTheme: TooltipThemeData(
|
|
decoration: BoxDecoration(
|
|
color: AppColors.zinc800,
|
|
borderRadius: BorderRadius.circular(6),
|
|
border: Border.all(color: AppColors.zinc700),
|
|
),
|
|
textStyle: GoogleFonts.inter(
|
|
color: AppColors.textPrimary,
|
|
fontSize: 12,
|
|
),
|
|
),
|
|
);
|
|
}
|