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,6 +1,6 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:notas/models/category.dart';
|
||||
import 'package:notas/theme/app_colors.dart';
|
||||
import 'package:notas/theme/app_palette.dart';
|
||||
import 'package:notas/widgets/category_style.dart';
|
||||
|
||||
class MenuDrawer extends StatelessWidget {
|
||||
@@ -21,10 +21,12 @@ class MenuDrawer extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final AppPalette palette = Theme.of(context).extension<AppPalette>()!;
|
||||
|
||||
return Container(
|
||||
decoration: const BoxDecoration(
|
||||
color: AppColors.drawerBackground,
|
||||
border: Border(right: BorderSide(color: AppColors.border, width: 0.5)),
|
||||
decoration: BoxDecoration(
|
||||
color: palette.drawerBackground,
|
||||
border: Border(right: BorderSide(color: palette.border, width: 0.5)),
|
||||
),
|
||||
child: Column(
|
||||
children: [
|
||||
@@ -59,12 +61,10 @@ class MenuDrawer extends StatelessWidget {
|
||||
? null
|
||||
: () => onEditCategory?.call(category),
|
||||
iconColor: Color(
|
||||
category.colorValue ??
|
||||
AppColors.categoryFallback.value,
|
||||
category.colorValue ?? palette.accent.value,
|
||||
),
|
||||
textColor: Color(
|
||||
category.colorValue ??
|
||||
AppColors.categoryFallback.value,
|
||||
category.colorValue ?? palette.accent.value,
|
||||
),
|
||||
trailing: IconButton(
|
||||
padding: const EdgeInsets.all(8),
|
||||
@@ -72,9 +72,9 @@ class MenuDrawer extends StatelessWidget {
|
||||
minWidth: 0,
|
||||
minHeight: 0,
|
||||
),
|
||||
icon: const Icon(
|
||||
icon: Icon(
|
||||
Icons.more_vert,
|
||||
color: AppColors.textSecondary,
|
||||
color: palette.textSecondary,
|
||||
size: 20,
|
||||
),
|
||||
onPressed: () => onEditCategory?.call(category),
|
||||
@@ -97,10 +97,10 @@ class MenuDrawer extends StatelessWidget {
|
||||
label: 'Mis notas borradas',
|
||||
selected: selectedItem == 'deleted_notes',
|
||||
onTap: () => onMenuItemTapped?.call('deleted_notes'),
|
||||
iconColor: AppColors.destructiveAccent,
|
||||
textColor: AppColors.destructiveAccent,
|
||||
iconColor: palette.destructiveAccent,
|
||||
textColor: palette.destructiveAccent,
|
||||
),
|
||||
const Divider(color: AppColors.border, height: 16),
|
||||
Divider(color: palette.border, height: 16),
|
||||
_MenuItemTile(
|
||||
icon: Icons.settings,
|
||||
label: 'Configuración',
|
||||
@@ -143,13 +143,12 @@ class _MenuItemTileState extends State<_MenuItemTile> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final AppPalette palette = Theme.of(context).extension<AppPalette>()!;
|
||||
final bool active = widget.selected || _hovering;
|
||||
final Color backgroundColor = active
|
||||
? AppColors.hover
|
||||
: AppColors.transparent;
|
||||
final Color backgroundColor = active ? palette.hover : palette.transparent;
|
||||
final Color foregroundColor = active
|
||||
? AppColors.textPrimary
|
||||
: AppColors.textSecondary;
|
||||
? palette.textPrimary
|
||||
: palette.textSecondary;
|
||||
final Widget? trailing = _hovering ? widget.trailing : null;
|
||||
|
||||
return MouseRegion(
|
||||
|
||||
Reference in New Issue
Block a user