Refactor theme management: Replace AppColors with AppPalette
- Removed AppColors class and migrated all references to AppPalette. - Updated VaultAccessScreen, MenuDrawer, NoteCard, SearchAppBar, and other widgets to use AppPalette for color management. - Introduced AppPalette to handle light and dark themes with appropriate color schemes. - Adjusted theme application in AppTheme to utilize AppPalette extensions. - Updated tests to reflect changes in theme structure and color references.
This commit is contained in:
@@ -1,21 +1,33 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:notas/theme/app_colors.dart';
|
||||
import 'package:notas/theme/app_palette.dart';
|
||||
|
||||
class AppTheme {
|
||||
static ThemeData theme({Color seedColor = AppColors.defaultThemeSeedColor}) {
|
||||
static ThemeData theme({
|
||||
Color seedColor = Colors.amber,
|
||||
Brightness brightness = Brightness.dark,
|
||||
}) {
|
||||
final Brightness foregroundBrightness =
|
||||
ThemeData.estimateBrightnessForColor(seedColor);
|
||||
final Color foregroundColor = foregroundBrightness == Brightness.dark
|
||||
? AppColors.textPrimary
|
||||
: AppColors.textOnAccent;
|
||||
? Colors.white
|
||||
: Colors.black87;
|
||||
|
||||
final ColorScheme scheme = ColorScheme.fromSeed(
|
||||
seedColor: seedColor,
|
||||
brightness: brightness,
|
||||
);
|
||||
|
||||
final AppPalette palette = AppPalette.fromBrightness(
|
||||
brightness,
|
||||
seedColor: seedColor,
|
||||
);
|
||||
|
||||
return ThemeData(
|
||||
useMaterial3: true,
|
||||
scaffoldBackgroundColor: AppColors.scaffoldBackground,
|
||||
colorScheme: ColorScheme.fromSeed(
|
||||
seedColor: seedColor,
|
||||
brightness: Brightness.dark,
|
||||
),
|
||||
scaffoldBackgroundColor: scheme.background,
|
||||
colorScheme: scheme,
|
||||
extensions: <ThemeExtension<dynamic>>[palette],
|
||||
brightness: brightness,
|
||||
floatingActionButtonTheme: FloatingActionButtonThemeData(
|
||||
backgroundColor: seedColor,
|
||||
foregroundColor: foregroundColor,
|
||||
|
||||
Reference in New Issue
Block a user