From 6e996d9d2e5fa4b062b3166421431a6b5df15f72 Mon Sep 17 00:00:00 2001 From: bvandeusen Date: Sun, 1 Mar 2026 13:39:06 -0500 Subject: [PATCH] Fix black screen and failed delete when confirming note deletion The dialog builder was discarding its own context (_) and calling Navigator.pop(context, ...) with the outer screen context instead. This popped NoteDetailScreen off the navigator instead of closing the dialog, causing a black screen and returning null to showDialog so the delete operation never ran. Fix: use dialogContext in the builder and pop that instead. Co-Authored-By: Claude Sonnet 4.6 --- lib/screens/notes/note_detail_screen.dart | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/screens/notes/note_detail_screen.dart b/lib/screens/notes/note_detail_screen.dart index ab68025..1de5cef 100644 --- a/lib/screens/notes/note_detail_screen.dart +++ b/lib/screens/notes/note_detail_screen.dart @@ -54,15 +54,17 @@ class NoteDetailScreen extends ConsumerWidget { onPressed: () async { final confirm = await showDialog( context: context, - builder: (_) => AlertDialog( + builder: (dialogContext) => AlertDialog( title: const Text('Delete note?'), actions: [ TextButton( - onPressed: () => Navigator.pop(context, false), + onPressed: () => + Navigator.pop(dialogContext, false), child: const Text('Cancel'), ), TextButton( - onPressed: () => Navigator.pop(context, true), + onPressed: () => + Navigator.pop(dialogContext, true), child: const Text('Delete'), ), ],