/
siblun
/
ReadFlow
Обзор
Документация
Войти
/
siblun
/
ReadFlow
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
develop
lib/presentation/theme/app_theme.dart
209 строк
7 KB
siblun
Refactoring
06 апр 2026, 15:59
06 апр 2026, 15:59
3151a22
Код
Авторство
О чём код?
import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'app_colors.dart'; import 'app_typography.dart'; class AppTheme { static ThemeData get lightTheme { return ThemeData( useMaterial3: true, brightness: Brightness.light, scaffoldBackgroundColor: AppColors.background, colorScheme: const ColorScheme.light( primary: AppColors.primaryAction, onPrimary: AppColors.white, secondary: AppColors.accentSecondary, onSecondary: AppColors.white, surface: AppColors.surface, onSurface: AppColors.textMain, error: AppColors.error, onError: AppColors.white, outline: AppColors.accentSecondary, ), textTheme: TextTheme( displayLarge: AppTypography.h1.copyWith(fontSize: 42.sp), displayMedium: AppTypography.timerDisplay.copyWith(fontSize: 72.sp), headlineMedium: AppTypography.h2.copyWith(fontSize: 24.sp), headlineSmall: AppTypography.h3.copyWith(fontSize: 20.sp), bodyLarge: AppTypography.bodyLarge.copyWith(fontSize: 16.sp), bodyMedium: AppTypography.bodyMedium.copyWith(fontSize: 14.sp), bodySmall: AppTypography.bodyMedium.copyWith(fontSize: 12.sp), labelLarge: AppTypography.buttonText.copyWith(fontSize: 16.sp), labelMedium: AppTypography.label.copyWith(fontSize: 11.sp), labelSmall: AppTypography.overline.copyWith(fontSize: 10.sp), ), elevatedButtonTheme: ElevatedButtonThemeData( style: ElevatedButton.styleFrom( backgroundColor: AppColors.primaryAction, foregroundColor: AppColors.white, textStyle: AppTypography.buttonText.copyWith( fontSize: 16.sp, fontWeight: FontWeight.w600, letterSpacing: 0.35, ), padding: EdgeInsets.symmetric(vertical: 16.h, horizontal: 24.w), shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(16.r), ), elevation: 0, ), ), textButtonTheme: TextButtonThemeData( style: TextButton.styleFrom( foregroundColor: AppColors.primaryAction, textStyle: AppTypography.bodyMedium.copyWith( fontSize: 14.sp, fontWeight: FontWeight.w600, ), padding: EdgeInsets.symmetric(vertical: 12.h, horizontal: 16.w), ), ), inputDecorationTheme: InputDecorationTheme( filled: true, fillColor: AppColors.surface.withValues(alpha: 0.4), hintStyle: AppTypography.bodyMedium.copyWith( color: AppColors.accentSecondary.withValues(alpha: 0.5), ), labelStyle: AppTypography.bodyMedium.copyWith( color: AppColors.textMain.withValues(alpha: 0.6), ), border: OutlineInputBorder( borderRadius: BorderRadius.circular(4.r), borderSide: BorderSide( color: AppColors.primaryAction.withValues(alpha: 0.3), width: 1.w, ), ), enabledBorder: OutlineInputBorder( borderRadius: BorderRadius.circular(4.r), borderSide: BorderSide( color: AppColors.primaryAction.withValues(alpha: 0.3), width: 1.w, ), ), focusedBorder: OutlineInputBorder( borderRadius: BorderRadius.circular(4.r), borderSide: BorderSide( color: AppColors.primaryAction, width: 2.w, ), ), errorBorder: OutlineInputBorder( borderRadius: BorderRadius.circular(4.r), borderSide: BorderSide(color: AppColors.error, width: 1.w), ), focusedErrorBorder: OutlineInputBorder( borderRadius: BorderRadius.circular(4.r), borderSide: BorderSide(color: AppColors.error, width: 2.w), ), contentPadding: EdgeInsets.symmetric(horizontal: 16.w, vertical: 16.h), ), appBarTheme: AppBarTheme( backgroundColor: AppColors.background, elevation: 0, scrolledUnderElevation: 0, foregroundColor: AppColors.textMain, titleTextStyle: AppTypography.h2.copyWith( fontSize: 24.sp, fontWeight: FontWeight.w500, color: AppColors.textMain, ), iconTheme: const IconThemeData( color: AppColors.textMain, size: 24, ), ), dialogTheme: DialogThemeData( backgroundColor: AppColors.cardBackground, shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(16.r), ), titleTextStyle: AppTypography.h3.copyWith( fontSize: 18.sp, fontWeight: FontWeight.w600, color: AppColors.textMain, ), contentTextStyle: AppTypography.bodyMedium.copyWith( color: AppColors.textMain, ), ), snackBarTheme: SnackBarThemeData( backgroundColor: AppColors.textMain, contentTextStyle: AppTypography.bodyMedium.copyWith( color: AppColors.white, ), shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(12.r), ), behavior: SnackBarBehavior.floating, elevation: 2, ), floatingActionButtonTheme: FloatingActionButtonThemeData( backgroundColor: AppColors.primaryAction, foregroundColor: AppColors.white, elevation: 2, shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(16.r), ), ), cardTheme: CardThemeData( color: AppColors.cardBackground, elevation: 0, shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(20.r), ), ), progressIndicatorTheme: ProgressIndicatorThemeData( color: AppColors.primaryAction, circularTrackColor: AppColors.surface.withValues(alpha: 0.3), strokeWidth: 2.w, ), bottomSheetTheme: BottomSheetThemeData( backgroundColor: AppColors.background, shape: RoundedRectangleBorder( borderRadius: BorderRadius.vertical(top: Radius.circular(28.r)), ), modalBackgroundColor: AppColors.background, modalBarrierColor: Colors.black.withValues(alpha: 0.5), ), chipTheme: ChipThemeData( backgroundColor: AppColors.surface.withValues(alpha: 0.2), selectedColor: AppColors.surface, labelStyle: AppTypography.bodyMedium.copyWith( fontSize: 14.sp, fontWeight: FontWeight.w500, ), padding: EdgeInsets.symmetric(horizontal: 16.w, vertical: 8.h), shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(10.r), side: BorderSide( color: AppColors.surface, width: 1.w, ), ), ), dividerTheme: DividerThemeData( color: AppColors.surface.withValues(alpha: 0.3), thickness: 1.w, space: 1.h, ), splashFactory: NoSplash.splashFactory, highlightColor: Colors.transparent, ); } }