@@ -41,17 +41,17 @@ Future<bool> deleteNote(
4141
4242 final wasArchived = note.archived;
4343
44- final succeeded = await ref
45- . read ( notesProvider (status : NoteStatus .available, label : currentLabelFilter).notifier)
46- . setDeleted ([note ], true );
44+ final succeeded = await ref. read ( notesProvider (status : note.status, label : currentLabelFilter).notifier). setDeleted ([
45+ note,
46+ ], true );
4747
4848 if (succeeded && cancel && context.mounted) {
4949 SnackBarUtils ().show (
5050 context,
5151 text: context.l.snack_bar_deleted (1 ),
5252 onCancel: (globalRef) async => wasArchived
53- ? await archiveNote (context , globalRef, note: note, cancel: false )
54- : await restoreNote (context , globalRef, note: note, cancel: false ),
53+ ? await archiveNote (rootNavigatorKey.currentContext ! , globalRef, note: note, cancel: false )
54+ : await restoreNote (rootNavigatorKey.currentContext ! , globalRef, note: note, cancel: false ),
5555 );
5656 }
5757
@@ -74,20 +74,20 @@ Future<bool> deleteNotes(BuildContext context, WidgetRef ref, {required List<Not
7474 final wereArchived = notes.first.archived;
7575
7676 final succeeded = await ref
77- .read (notesProvider (status: NoteStatus .available , label: currentLabelFilter).notifier)
77+ .read (notesProvider (status: notes.first.status , label: currentLabelFilter).notifier)
7878 .setDeleted (notes, true );
7979
8080 if (context.mounted) {
81- exitNotesSelectionMode (context, ref, notesStatus: NoteStatus .available );
81+ exitNotesSelectionMode (context, ref, notesStatus: notes.first.status );
8282 }
8383
8484 if (succeeded && cancel && context.mounted) {
8585 SnackBarUtils ().show (
8686 context,
8787 text: context.l.snack_bar_deleted (notes.length),
8888 onCancel: (globalRef) async => wereArchived
89- ? await archiveNotes (context , ref, notes: notes)
90- : await restoreNotes (context , globalRef, notes: notes, cancel: false ),
89+ ? await archiveNotes (rootNavigatorKey.currentContext ! , ref, notes: notes)
90+ : await restoreNotes (rootNavigatorKey.currentContext ! , globalRef, notes: notes, cancel: false ),
9191 );
9292 }
9393
0 commit comments