I'm creating series of modal bottom sheet in my app. When I go to A modal bottom sheet to B modal bottom sheet then A modal bottom sheet should be closed, I'm not getting how to achieve this, when I use navigator.pop
, then it's navigating to A bottom sheet.
Before you go to B bottom sheet, you should call Navigator.pop
Example:
InkWell(
onTap: () {
showModalBottomSheet(
context: context,
builder: (context) {
return InkWell(
onTap: () {
Navigator.of(context).pop();
showModalBottomSheet(
context: context,
builder: (context) {
return const Text("Bottom Sheet B");
});
},
child: const Text("Bottom Sheet A"));
});
},
child: const Text("Home"),
),