theme.dart 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. import 'package:flutter/material.dart';
  2. class AppTheme {
  3. static ThemeData get light {
  4. final colorScheme = ColorScheme.fromSeed(
  5. seedColor: const Color(0xFF1A6B4C),
  6. brightness: Brightness.light,
  7. );
  8. return _buildTheme(colorScheme);
  9. }
  10. static ThemeData get dark {
  11. final colorScheme = ColorScheme.fromSeed(
  12. seedColor: const Color(0xFF1A6B4C),
  13. brightness: Brightness.dark,
  14. );
  15. return _buildTheme(colorScheme);
  16. }
  17. static ThemeData _buildTheme(ColorScheme colorScheme) {
  18. return ThemeData(
  19. useMaterial3: true,
  20. colorScheme: colorScheme,
  21. appBarTheme: AppBarTheme(
  22. centerTitle: false,
  23. elevation: 0,
  24. scrolledUnderElevation: 1,
  25. backgroundColor: colorScheme.surface,
  26. foregroundColor: colorScheme.onSurface,
  27. ),
  28. cardTheme: CardThemeData(
  29. elevation: 0,
  30. shape: RoundedRectangleBorder(
  31. borderRadius: BorderRadius.circular(12),
  32. side: BorderSide(color: colorScheme.outlineVariant, width: 0.5),
  33. ),
  34. ),
  35. inputDecorationTheme: InputDecorationTheme(
  36. filled: true,
  37. border: OutlineInputBorder(
  38. borderRadius: BorderRadius.circular(12),
  39. ),
  40. contentPadding: const EdgeInsets.symmetric(horizontal: 16, vertical: 14),
  41. ),
  42. floatingActionButtonTheme: FloatingActionButtonThemeData(
  43. elevation: 2,
  44. shape: RoundedRectangleBorder(
  45. borderRadius: BorderRadius.circular(16),
  46. ),
  47. ),
  48. navigationBarTheme: NavigationBarThemeData(
  49. elevation: 1,
  50. indicatorShape: RoundedRectangleBorder(
  51. borderRadius: BorderRadius.circular(12),
  52. ),
  53. ),
  54. navigationRailTheme: NavigationRailThemeData(
  55. elevation: 1,
  56. indicatorShape: RoundedRectangleBorder(
  57. borderRadius: BorderRadius.circular(12),
  58. ),
  59. ),
  60. );
  61. }
  62. }