modal_bottom_sheet
modal_bottom_sheet copied to clipboard
Center sheet disappears in visual sheet stack
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:
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?
The answer is that you should use showCupertinoModalBottomSheet(...)
instead of CupertinoScaffold.showCupertinoModalBottomSheet(...)