refactor: Update color handling to use ARGB format and improve theme consistency

This commit is contained in:
2026-07-01 10:41:59 +02:00
parent 82515960f6
commit 972006c29f
5 changed files with 8 additions and 7 deletions
+1 -1
View File
@@ -212,7 +212,7 @@ class _NotesAppState extends State<NotesApp>
Future<void> _setThemeSeedColor(Color color) async {
final SharedPreferences prefs = await SharedPreferences.getInstance();
await prefs.setInt(_themeSeedColorKey, color.value);
await prefs.setInt(_themeSeedColorKey, color.toARGB32());
if (!mounted) {
return;
+3 -2
View File
@@ -361,7 +361,7 @@ class _SettingsScreenState extends State<SettingsScreen> {
Widget _buildThemeColorButton(Color color) {
final AppPalette palette = Theme.of(context).extension<AppPalette>()!;
final bool isSelected = _selectedSeedColor.value == color.value;
final bool isSelected = _selectedSeedColor.toARGB32() == color.toARGB32();
final Color foregroundColor =
ThemeData.estimateBrightnessForColor(color) == Brightness.dark
? palette.textPrimary
@@ -370,7 +370,7 @@ class _SettingsScreenState extends State<SettingsScreen> {
return Semantics(
button: true,
selected: isSelected,
label: 'Color ${color.value.toRadixString(16)}',
label: 'Color ${color.toARGB32().toRadixString(16)}',
child: Tooltip(
message: isSelected ? 'Color actual' : 'Usar este color',
child: InkWell(
@@ -490,6 +490,7 @@ class _SettingsScreenState extends State<SettingsScreen> {
);
}
@override
Widget build(BuildContext context) {
final AppPalette palette = Theme.of(context).extension<AppPalette>()!;
+1 -1
View File
@@ -24,7 +24,7 @@ class AppTheme {
return ThemeData(
useMaterial3: true,
scaffoldBackgroundColor: scheme.background,
scaffoldBackgroundColor: scheme.surface,
colorScheme: scheme,
extensions: <ThemeExtension<dynamic>>[palette],
brightness: brightness,
+2 -2
View File
@@ -61,10 +61,10 @@ class MenuDrawer extends StatelessWidget {
? null
: () => onEditCategory?.call(category),
iconColor: Color(
category.colorValue ?? palette.accent.value,
category.colorValue ?? palette.accent.toARGB32(),
),
textColor: Color(
category.colorValue ?? palette.accent.value,
category.colorValue ?? palette.accent.toARGB32(),
),
trailing: IconButton(
padding: const EdgeInsets.all(8),
+1 -1
View File
@@ -94,7 +94,7 @@ class _SearchAppBarState extends State<SearchAppBar> {
decoration: InputDecoration(
hintText: widget.searchHint,
hintStyle: TextStyle(
color: palette.textSecondary.withOpacity(0.6),
color: palette.textSecondary.withValues(alpha: 0.6),
),
suffixIcon: _searchController.text.isNotEmpty
? IconButton(