InspectorAddon color picker fails with assertion
bramp opened this issue · comments
Description
When using the InspectorAddon, color picker the following assertion fails:
_AssertionError ('package:flutter/src/material/scaffold.dart': Failed assertion: line 295 pos 7: '_scaffolds.isNotEmpty': ScaffoldMessenger.showSnackBar was called, but there are currently no descendant Scaffolds to present to.)
Steps To Reproduce
- Create
WidgetbookApp
with the following:
Widget build(BuildContext context) => Widgetbook.material(
directories: directories,
addons: [
InspectorAddon(enabled: true),
],
integrations: const [],
);
- Click the color picker button
- Select a color on your widget, and
- boom assertion.
Expected Behavior
It not crash.
Additional Context
The widget I'm testing does not make use of ScaffoldMessenger, so I suspect InspectorAddon assumes that is available higher up the widget stack.
Sorry I didn't mention my version. I was all up to date before posting this issue:
dependencies:
widgetbook: ^3.7.1
widgetbook_annotation: ^3.1.0
dev_dependencies:
widgetbook_generator: ^3.7.0
So this looks to still be a issue.
Putting a debugDumpApp();
inside showColorPickerResultSnackbar
shows there is indeed no Scaffold above the widget, instead it seems to be Overlay/_OverlayEntryWidget widgets. Please reopen this bug, and investigate. Thanks.