widgetbook / widgetbook

Widgetbook is the custom widget library and collaboration platform for Flutter frontend teams.

Home Page:https://widgetbook.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

  1. Create WidgetbookApp with the following:
Widget build(BuildContext context) => Widgetbook.material(
        directories: directories,
        addons: [
          InspectorAddon(enabled: true),
        ],
        integrations: const [],
      );
  1. Click the color picker button
  2. Select a color on your widget, and
  3. 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.

Hello @bramp 👋
There was a related fix (#1091) that was released in v3.7.1, make sure to update to the latest version.
I will close the issue for now due to the potential fix, and re-open if this didn't fix your issue.

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.