From 7b072a219db4b404bc3d49d2756e451190257025 Mon Sep 17 00:00:00 2001 From: Mark M2 Macbook Date: Fri, 22 May 2026 10:12:56 +0200 Subject: [PATCH] feat notes --- .../customers/data/customer_repository.dart | 2 +- lib/features/notes/ui/notes_form_screen.dart | 13 +++++++++++++ lib/features/notes/ui/notes_list_screen.dart | 8 ++++++-- 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/lib/features/customers/data/customer_repository.dart b/lib/features/customers/data/customer_repository.dart index 7da2f60..cd5bd81 100644 --- a/lib/features/customers/data/customer_repository.dart +++ b/lib/features/customers/data/customer_repository.dart @@ -50,7 +50,7 @@ class CustomerRepository { ''') .eq('company_id', companyId) .eq('is_active', true) - .order('name'); + .order('name', ascending: true); return (response as List).map((c) => CustomerModel.fromMap(c)).toList(); } catch (e) { diff --git a/lib/features/notes/ui/notes_form_screen.dart b/lib/features/notes/ui/notes_form_screen.dart index e09fb7d..225e9bc 100644 --- a/lib/features/notes/ui/notes_form_screen.dart +++ b/lib/features/notes/ui/notes_form_screen.dart @@ -109,6 +109,11 @@ class _NoteFormScreenState extends State { } } + void _deleteNote() { + _notesBloc.add(NoteDeletedRequested(widget.note.id!)); + Navigator.pop(context); + } + void _exportNote() { // La logica di export che abbiamo concordato ieri! ScaffoldMessenger.of(context).showSnackBar( @@ -298,6 +303,14 @@ class _NoteFormScreenState extends State { const SizedBox(width: 16), // Azioni spostate dentro la nota! + IconButton( + icon: const Icon( + Icons.delete_outline, + color: Colors.black87, + ), + tooltip: 'Elimina', + onPressed: _deleteNote, + ), IconButton( icon: Icon( _isPinned ? Icons.push_pin : Icons.push_pin_outlined, diff --git a/lib/features/notes/ui/notes_list_screen.dart b/lib/features/notes/ui/notes_list_screen.dart index d483dca..06612ef 100644 --- a/lib/features/notes/ui/notes_list_screen.dart +++ b/lib/features/notes/ui/notes_list_screen.dart @@ -56,7 +56,7 @@ class NotesListScreen extends StatelessWidget { Widget build(BuildContext context) { return Scaffold( backgroundColor: - Colors.grey.shade50, // Sfondo neutro per far risaltare i post-it + Colors.grey.shade900, // Sfondo neutro per far risaltare i post-it appBar: AppBar( title: const Text( 'Bacheca Note', @@ -157,7 +157,11 @@ class NotesListScreen extends StatelessWidget { ); return GestureDetector( - onTap: () => context.push('/notes/edit', extra: note), + onTap: () => context.pushNamed( + Routes.noteForm, + pathParameters: {'id': note.id!}, + extra: note, + ), child: Container( decoration: BoxDecoration( color: noteColor,