From bc0f8668bd3d1fbce371360a2af8721737e57fb5 Mon Sep 17 00:00:00 2001 From: Thomas SharedInbox Date: Thu, 4 Jun 2026 04:06:03 +0200 Subject: [PATCH] fix: use Builder to get descendant context for Scaffold.of() in bottom nav Calling Scaffold.of(context) with the widget's own build context crashes when no ancestor Scaffold exists in that context. Wrapping the IconButton in a Builder provides a child context that is a proper descendant of the Scaffold, which is what Scaffold.of() requires. Closes #397 Co-Authored-By: Claude Sonnet 4.6 --- lib/ui/screens/mailbox_list_screen.dart | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/ui/screens/mailbox_list_screen.dart b/lib/ui/screens/mailbox_list_screen.dart index 47fc231..672cda6 100644 --- a/lib/ui/screens/mailbox_list_screen.dart +++ b/lib/ui/screens/mailbox_list_screen.dart @@ -51,10 +51,12 @@ class MailboxListScreen extends ConsumerWidget { ? BottomAppBar( child: Row( children: [ - IconButton( - icon: const Icon(Icons.menu), - tooltip: 'Open folders', - onPressed: () => Scaffold.of(context).openDrawer(), + Builder( + builder: (ctx) => IconButton( + icon: const Icon(Icons.menu), + tooltip: 'Open folders', + onPressed: () => Scaffold.of(ctx).openDrawer(), + ), ), ], ),