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 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
09e20dd85f
commit
bc0f8668bd
@@ -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(),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user