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:
2026-05-23 13:55:40 +02:00
parent 29881183ed
commit 1dede9eb78
16 changed files with 1031 additions and 618 deletions
+12 -11
View File
@@ -1,7 +1,7 @@
import 'package:flutter/material.dart';
import 'package:notas/models/note.dart';
import 'package:notas/theme/app_colors.dart';
import 'package:notas/theme/app_palette.dart';
// Small presentational widget for a note inside the grid.
// Keep this widget lightweight and layout-agnostic: it should not force
@@ -31,6 +31,7 @@ class _NoteCardState extends State<NoteCard> {
@override
Widget build(BuildContext context) {
final AppPalette palette = Theme.of(context).extension<AppPalette>()!;
final bool showGrabbing = widget.isDragging || _isPressed;
return MouseRegion(
@@ -63,10 +64,10 @@ class _NoteCardState extends State<NoteCard> {
child: Container(
padding: const EdgeInsets.all(16),
decoration: BoxDecoration(
color: AppColors.cardBackground,
color: palette.cardBackground,
borderRadius: BorderRadius.circular(12),
border: Border.all(
color: widget.borderColor ?? AppColors.textDisabled,
color: widget.borderColor ?? palette.textDisabled,
width: 1,
),
),
@@ -90,8 +91,8 @@ class _NoteCardState extends State<NoteCard> {
final TextPainter textPainter = TextPainter(
text: TextSpan(
text: widget.note.body,
style: const TextStyle(
color: AppColors.textSecondary,
style: TextStyle(
color: palette.textSecondary,
fontSize: 14,
),
),
@@ -110,8 +111,8 @@ class _NoteCardState extends State<NoteCard> {
children: [
Text(
widget.note.title,
style: const TextStyle(
color: AppColors.textPrimary,
style: TextStyle(
color: palette.textPrimary,
fontSize: 16,
fontWeight: FontWeight.bold,
),
@@ -121,8 +122,8 @@ class _NoteCardState extends State<NoteCard> {
const SizedBox(height: 8),
Text(
widget.note.body,
style: const TextStyle(
color: AppColors.textSecondary,
style: TextStyle(
color: palette.textSecondary,
fontSize: 14,
),
maxLines: 20,
@@ -130,10 +131,10 @@ class _NoteCardState extends State<NoteCard> {
),
if (isBodyTruncated) ...[
const SizedBox(height: 4),
const Text(
Text(
'...',
style: TextStyle(
color: AppColors.textMuted,
color: palette.textMuted,
fontSize: 18,
height: 1,
),