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,5 +1,5 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:notas/theme/app_colors.dart';
|
||||
import 'package:notas/theme/app_palette.dart';
|
||||
|
||||
class SearchAppBar extends StatefulWidget {
|
||||
const SearchAppBar({
|
||||
@@ -52,10 +52,12 @@ class _SearchAppBarState extends State<SearchAppBar> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final AppPalette palette = Theme.of(context).extension<AppPalette>()!;
|
||||
|
||||
return Container(
|
||||
decoration: BoxDecoration(
|
||||
color: AppColors.transparent,
|
||||
border: Border(bottom: BorderSide(color: AppColors.border, width: 0.5)),
|
||||
color: palette.transparent,
|
||||
border: Border(bottom: BorderSide(color: palette.border, width: 0.5)),
|
||||
),
|
||||
padding: const EdgeInsets.only(left: 8, right: 20, top: 7, bottom: 7),
|
||||
child: Row(
|
||||
@@ -64,7 +66,7 @@ class _SearchAppBarState extends State<SearchAppBar> {
|
||||
onPressed: widget.onLeadingPressed ?? widget.onMenuPressed,
|
||||
icon: Icon(
|
||||
widget.leadingIcon,
|
||||
color: AppColors.textSecondary,
|
||||
color: palette.textSecondary,
|
||||
size: 20,
|
||||
),
|
||||
tooltip: widget.leadingTooltip,
|
||||
@@ -84,23 +86,21 @@ class _SearchAppBarState extends State<SearchAppBar> {
|
||||
child: TextField(
|
||||
controller: _searchController,
|
||||
onChanged: widget.onSearchChanged,
|
||||
style: const TextStyle(
|
||||
color: AppColors.textPrimary,
|
||||
style: TextStyle(
|
||||
color: palette.textPrimary,
|
||||
fontSize: 13,
|
||||
),
|
||||
cursorColor: AppColors.textSecondary,
|
||||
cursorColor: palette.textSecondary,
|
||||
decoration: InputDecoration(
|
||||
hintText: widget.searchHint,
|
||||
hintStyle: TextStyle(
|
||||
color: AppColors.textSecondary.withValues(
|
||||
alpha: 0.5,
|
||||
),
|
||||
color: palette.textSecondary.withOpacity(0.6),
|
||||
),
|
||||
suffixIcon: _searchController.text.isNotEmpty
|
||||
? IconButton(
|
||||
icon: const Icon(
|
||||
icon: Icon(
|
||||
Icons.clear,
|
||||
color: AppColors.textSecondary,
|
||||
color: palette.textSecondary,
|
||||
size: 18,
|
||||
),
|
||||
onPressed: () {
|
||||
@@ -112,37 +112,37 @@ class _SearchAppBarState extends State<SearchAppBar> {
|
||||
minHeight: 36,
|
||||
),
|
||||
)
|
||||
: const Padding(
|
||||
padding: EdgeInsets.only(right: 8),
|
||||
: Padding(
|
||||
padding: const EdgeInsets.only(right: 8),
|
||||
child: Icon(
|
||||
Icons.search,
|
||||
color: AppColors.textSecondary,
|
||||
color: palette.textSecondary,
|
||||
size: 18,
|
||||
),
|
||||
),
|
||||
border: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
borderSide: BorderSide(
|
||||
color: AppColors.borderStrong,
|
||||
color: palette.border,
|
||||
width: 0.5,
|
||||
),
|
||||
),
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
borderSide: BorderSide(
|
||||
color: AppColors.borderStrong,
|
||||
color: palette.border,
|
||||
width: 0.5,
|
||||
),
|
||||
),
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
borderSide: BorderSide(
|
||||
color: AppColors.searchFocusBorder,
|
||||
width: 0.5,
|
||||
color: palette.accent,
|
||||
width: 0.6,
|
||||
),
|
||||
),
|
||||
filled: true,
|
||||
fillColor: AppColors.fill,
|
||||
fillColor: palette.fill,
|
||||
contentPadding: const EdgeInsets.symmetric(
|
||||
horizontal: 12,
|
||||
vertical: 8,
|
||||
@@ -156,8 +156,8 @@ class _SearchAppBarState extends State<SearchAppBar> {
|
||||
alignment: Alignment.centerLeft,
|
||||
child: Text(
|
||||
widget.titleText ?? '',
|
||||
style: const TextStyle(
|
||||
color: AppColors.textPrimary,
|
||||
style: TextStyle(
|
||||
color: palette.textPrimary,
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user