diff --git a/lib/app.dart b/lib/app.dart index 5bba32c..0e30d4f 100644 --- a/lib/app.dart +++ b/lib/app.dart @@ -101,7 +101,8 @@ class _NotesAppState extends State } final AppPalette palette = _activePalette(); - final String message = _syncErrorMessage ?? _syncDetailMessage ?? 'Sincronizando...'; + final String message = + _syncErrorMessage ?? _syncDetailMessage ?? 'Sincronizando...'; final double? progress = _syncProgress; final IconData icon; final Color accentColor; @@ -138,7 +139,9 @@ class _NotesAppState extends State child: Container( padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 10), decoration: BoxDecoration( - border: Border(top: BorderSide(color: accentColor.withValues(alpha: 0.45))), + border: Border( + top: BorderSide(color: accentColor.withValues(alpha: 0.45)), + ), ), child: Column( mainAxisSize: MainAxisSize.min, @@ -591,17 +594,15 @@ class _NotesAppState extends State if (available) { bool activated = await _vaultService.enableBiometricProtection(); while (!activated) { - // Ask the user to retry or skip - final BuildContext? dialogCtx = _navigatorKey.currentContext; - if (dialogCtx == null) { - break; - } + // Ask the user to retry or skip - pass currentContext directly in builder + final NavigatorState? navigator = _navigatorKey.currentState; - final NavigatorState navigator = Navigator.of(dialogCtx); + if (navigator == null) break; + if (!mounted) return; final bool? retry = await showDialog( - context: dialogCtx, - builder: (BuildContext context) { + context: context, + builder: (BuildContext dialogContext) { final AppPalette palette = _activePalette(); return AlertDialog( backgroundColor: palette.cardBackground, @@ -1076,10 +1077,11 @@ class _NotesAppState extends State switchOutCurve: Curves.easeInCubic, transitionBuilder: (Widget child, Animation animation) { - final Animation slideAnimation = Tween( - begin: const Offset(0.0, 0.35), - end: Offset.zero, - ).animate(animation); + final Animation slideAnimation = + Tween( + begin: const Offset(0.0, 0.35), + end: Offset.zero, + ).animate(animation); return FadeTransition( opacity: animation, diff --git a/lib/data/note_repository.dart b/lib/data/note_repository.dart index 5f06297..857a12e 100644 --- a/lib/data/note_repository.dart +++ b/lib/data/note_repository.dart @@ -676,7 +676,7 @@ Future>> _decryptNoteBatch( masterKey, ); } catch (e) { - print('Failed to decrypt note ${note['id']}: $e'); + debugPrint('Failed to decrypt note ${note['id']}: $e'); } } else { decryptedTitle = ''; diff --git a/lib/screens/home_screen.dart b/lib/screens/home_screen.dart index 0d4ba47..0cec6bf 100644 --- a/lib/screens/home_screen.dart +++ b/lib/screens/home_screen.dart @@ -316,7 +316,7 @@ class _HomeScreenState extends State { ), boxShadow: [ BoxShadow( - color: color.withOpacity(0.18), + color: color.withValues(alpha: 0.0), blurRadius: 10, offset: const Offset(0, 4), ), @@ -362,7 +362,7 @@ class _HomeScreenState extends State { height: 50, decoration: BoxDecoration( color: selectedIconCodePoint == icon.codePoint - ? previewColor.withOpacity(0.14) + ? previewColor.withValues(alpha: 0.14) : palette.fill, borderRadius: BorderRadius.circular(14), border: Border.all( @@ -613,10 +613,10 @@ class _HomeScreenState extends State { duration: const Duration(milliseconds: 160), padding: const EdgeInsets.all(2), decoration: BoxDecoration( - color: selected ? color.withOpacity(0.05) : Colors.transparent, + color: selected ? color.withValues(alpha: 0.05) : Colors.transparent, borderRadius: BorderRadius.circular(12), border: Border.all( - color: selected ? color.withOpacity(0.42) : Colors.transparent, + color: selected ? color.withValues(alpha: 0.42) : Colors.transparent, width: selected ? 1 : 1, ), ), @@ -945,7 +945,7 @@ class _HomeScreenState extends State { style: IconButton.styleFrom( backgroundColor: _selectedCategoryId == null ? Colors.transparent - : palette.accent.withOpacity(0.08), + : palette.accent.withValues(alpha: 0.08), shape: const CircleBorder(), ), icon: Stack( @@ -1067,7 +1067,7 @@ class _HomeScreenState extends State { padding: const EdgeInsets.fromLTRB(10, 10, 10, 14), buildDefaultDragHandles: false, itemCount: visibleNotes.length, - onReorder: _handleReorder, + onReorderItem: _handleReorder, footer: Padding( padding: const EdgeInsets.only(top: 4, bottom: 72), child: Center( @@ -1104,16 +1104,14 @@ class _HomeScreenState extends State { Widget _buildEmptyDetailPane(BuildContext context) { final AppPalette palette = _paletteOf(context); - return Container( - child: Center( - child: Text( - 'Selecciona una nota o\ncrea una nueva para empezar.', - textAlign: TextAlign.center, - style: TextStyle( - color: palette.textSecondary, - fontSize: 18, - fontWeight: FontWeight.w500, - ), + return Center( + child: Text( + 'Selecciona una nota o\ncrea una nueva para empezar.', + textAlign: TextAlign.center, + style: TextStyle( + color: palette.textSecondary, + fontSize: 18, + fontWeight: FontWeight.w500, ), ), ); diff --git a/lib/screens/settings_screen.dart b/lib/screens/settings_screen.dart index 0a5dcb0..c2ec108 100644 --- a/lib/screens/settings_screen.dart +++ b/lib/screens/settings_screen.dart @@ -98,10 +98,11 @@ class _SettingsScreenState extends State { SnackBar(content: Text('Error al borrar los datos: $error')), ); } finally { - if (!mounted) return; - setState(() { - _isBusy = false; - }); + if (mounted) { + setState(() { + _isBusy = false; + }); + } } } @@ -168,10 +169,11 @@ class _SettingsScreenState extends State { SnackBar(content: Text('Error al borrar la info del servidor: $error')), ); } finally { - if (!mounted) return; - setState(() { - _isServerDeleting = false; - }); + if (mounted) { + setState(() { + _isServerDeleting = false; + }); + } } } @@ -199,11 +201,11 @@ class _SettingsScreenState extends State { SnackBar(content: Text('Error al forzar la sincronización: $error')), ); } finally { - if (!mounted) return; - - setState(() { - _isSyncing = false; - }); + if (mounted) { + setState(() { + _isSyncing = false; + }); + } } } @@ -576,26 +578,31 @@ class _SettingsScreenState extends State { const SizedBox(height: 8), Column( children: [ - RadioListTile( - title: const Text('Seguir modo del sistema'), - value: ThemeMode.system, + RadioGroup( groupValue: _selectedThemeMode, - onChanged: (ThemeMode? v) => - _selectThemeMode(ThemeMode.system), - ), - RadioListTile( - title: const Text('Modo claro'), - value: ThemeMode.light, - groupValue: _selectedThemeMode, - onChanged: (ThemeMode? v) => - _selectThemeMode(ThemeMode.light), - ), - RadioListTile( - title: const Text('Modo oscuro'), - value: ThemeMode.dark, - groupValue: _selectedThemeMode, - onChanged: (ThemeMode? v) => - _selectThemeMode(ThemeMode.dark), + onChanged: (ThemeMode? v) { + if (v != null) { + _selectThemeMode(v); + } + }, + child: Column( + children: [ + RadioListTile( + title: const Text( + 'Seguir modo del sistema', + ), + value: ThemeMode.system, + ), + RadioListTile( + title: const Text('Modo claro'), + value: ThemeMode.light, + ), + RadioListTile( + title: const Text('Modo oscuro'), + value: ThemeMode.dark, + ), + ], + ), ), ], ), diff --git a/lib/widgets/note_card.dart b/lib/widgets/note_card.dart index 5591904..fd71e67 100644 --- a/lib/widgets/note_card.dart +++ b/lib/widgets/note_card.dart @@ -72,7 +72,7 @@ class NoteCard extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.center, children: [ if (categoryIcon != null) ...[ - Container( + SizedBox( width: 18, height: 18, child: Icon( diff --git a/pubspec.lock b/pubspec.lock index b85056a..e63da78 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -359,7 +359,7 @@ packages: source: hosted version: "6.0.0" flutter_localizations: - dependency: transitive + dependency: "direct main" description: flutter source: sdk version: "0.0.0" diff --git a/pubspec.yaml b/pubspec.yaml index 79e4353..bef5dc3 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -50,6 +50,9 @@ dependencies: uuid: ^4.0.0 flutter_quill: ^11.5.1 + flutter_localizations: + sdk: flutter + dev_dependencies: flutter_test: sdk: flutter diff --git a/test/note_editor_screen_test.dart b/test/note_editor_screen_test.dart index 5755cc7..8fbd23b 100644 --- a/test/note_editor_screen_test.dart +++ b/test/note_editor_screen_test.dart @@ -2,8 +2,6 @@ import 'package:flutter/material.dart'; import 'package:flutter_localizations/flutter_localizations.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:flutter_quill/flutter_quill.dart'; - -import 'package:notas/models/category.dart'; import 'package:notas/models/note.dart'; import 'package:notas/screens/note_editor_screen.dart';