modal_bottom_sheet icon indicating copy to clipboard operation
modal_bottom_sheet copied to clipboard

Center sheet disappears in visual sheet stack

Open cmkramer opened this issue 2 years ago • 1 comments

I've setup a CupertinoScaffolded screen and push a showCupertinoModalBottomSheet to show my first modal. I put the contents of that modal in a CupertinoScaffold. Then open a second modal sheet on top of it, also placed within a CupertinoScaffold. Here I get the following resulting animation glitch:

Double route visual glitch

So the structure is as follows:

CupertinoScaffold(body: SomeWidget) -> CupertinoScaffold.showCupertinoModalBottomSheet(CupertinoScaffold(body: SomeWidget)) -> CupertinoScaffold.showCupertinoModalBottomSheet(CupertinoScaffold(body: SomeWidget))

I'm trying to figure out what's happening here. I can see in the animation that the stack consists of only 2 sheets, while it should be 3, the animation glitch seems to be happening on the "in between" sheet, so I'm missing that one in the visual stack. This looks like a bug of sorts, but I can't wrap my head around what exactly is causing this.

When I change this structure to:

CupertinoScaffold(body: SomeWidget) -> CupertinoScaffold.showCupertinoModalBottomSheet(SomeWidget) -> CupertinoScaffold.showCupertinoModalBottomSheet(CupertinoScaffold(body: SomeWidget))

I get an "Unhandled Exception: Null check operator used on a null value" on CupertinoScaffold.of(context)!.topRadius; (cupertino_bottom_sheet.dart: 357).

Is there someone with an idea on what's happening here and how it can be resolved?

cmkramer avatar Nov 06 '22 10:11 cmkramer

The answer is that you should use showCupertinoModalBottomSheet(...) instead of CupertinoScaffold.showCupertinoModalBottomSheet(...)

mark8044 avatar Jan 12 '23 00:01 mark8044