refactor: Update color handling to use ARGB format and improve theme consistency
This commit is contained in:
+1
-1
@@ -212,7 +212,7 @@ class _NotesAppState extends State<NotesApp>
|
|||||||
|
|
||||||
Future<void> _setThemeSeedColor(Color color) async {
|
Future<void> _setThemeSeedColor(Color color) async {
|
||||||
final SharedPreferences prefs = await SharedPreferences.getInstance();
|
final SharedPreferences prefs = await SharedPreferences.getInstance();
|
||||||
await prefs.setInt(_themeSeedColorKey, color.value);
|
await prefs.setInt(_themeSeedColorKey, color.toARGB32());
|
||||||
|
|
||||||
if (!mounted) {
|
if (!mounted) {
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -361,7 +361,7 @@ class _SettingsScreenState extends State<SettingsScreen> {
|
|||||||
|
|
||||||
Widget _buildThemeColorButton(Color color) {
|
Widget _buildThemeColorButton(Color color) {
|
||||||
final AppPalette palette = Theme.of(context).extension<AppPalette>()!;
|
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 =
|
final Color foregroundColor =
|
||||||
ThemeData.estimateBrightnessForColor(color) == Brightness.dark
|
ThemeData.estimateBrightnessForColor(color) == Brightness.dark
|
||||||
? palette.textPrimary
|
? palette.textPrimary
|
||||||
@@ -370,7 +370,7 @@ class _SettingsScreenState extends State<SettingsScreen> {
|
|||||||
return Semantics(
|
return Semantics(
|
||||||
button: true,
|
button: true,
|
||||||
selected: isSelected,
|
selected: isSelected,
|
||||||
label: 'Color ${color.value.toRadixString(16)}',
|
label: 'Color ${color.toARGB32().toRadixString(16)}',
|
||||||
child: Tooltip(
|
child: Tooltip(
|
||||||
message: isSelected ? 'Color actual' : 'Usar este color',
|
message: isSelected ? 'Color actual' : 'Usar este color',
|
||||||
child: InkWell(
|
child: InkWell(
|
||||||
@@ -490,6 +490,7 @@ class _SettingsScreenState extends State<SettingsScreen> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final AppPalette palette = Theme.of(context).extension<AppPalette>()!;
|
final AppPalette palette = Theme.of(context).extension<AppPalette>()!;
|
||||||
|
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ class AppTheme {
|
|||||||
|
|
||||||
return ThemeData(
|
return ThemeData(
|
||||||
useMaterial3: true,
|
useMaterial3: true,
|
||||||
scaffoldBackgroundColor: scheme.background,
|
scaffoldBackgroundColor: scheme.surface,
|
||||||
colorScheme: scheme,
|
colorScheme: scheme,
|
||||||
extensions: <ThemeExtension<dynamic>>[palette],
|
extensions: <ThemeExtension<dynamic>>[palette],
|
||||||
brightness: brightness,
|
brightness: brightness,
|
||||||
|
|||||||
@@ -61,10 +61,10 @@ class MenuDrawer extends StatelessWidget {
|
|||||||
? null
|
? null
|
||||||
: () => onEditCategory?.call(category),
|
: () => onEditCategory?.call(category),
|
||||||
iconColor: Color(
|
iconColor: Color(
|
||||||
category.colorValue ?? palette.accent.value,
|
category.colorValue ?? palette.accent.toARGB32(),
|
||||||
),
|
),
|
||||||
textColor: Color(
|
textColor: Color(
|
||||||
category.colorValue ?? palette.accent.value,
|
category.colorValue ?? palette.accent.toARGB32(),
|
||||||
),
|
),
|
||||||
trailing: IconButton(
|
trailing: IconButton(
|
||||||
padding: const EdgeInsets.all(8),
|
padding: const EdgeInsets.all(8),
|
||||||
|
|||||||
@@ -94,7 +94,7 @@ class _SearchAppBarState extends State<SearchAppBar> {
|
|||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
hintText: widget.searchHint,
|
hintText: widget.searchHint,
|
||||||
hintStyle: TextStyle(
|
hintStyle: TextStyle(
|
||||||
color: palette.textSecondary.withOpacity(0.6),
|
color: palette.textSecondary.withValues(alpha: 0.6),
|
||||||
),
|
),
|
||||||
suffixIcon: _searchController.text.isNotEmpty
|
suffixIcon: _searchController.text.isNotEmpty
|
||||||
? IconButton(
|
? IconButton(
|
||||||
|
|||||||
Reference in New Issue
Block a user