I want to add a function when the showModalBottomSheet is close or when the barrier tapped the function run(routing to the main page) but how?
I want to run this when the barrier tapped/modal closed
Navigator.pushNamedAndRemoveUntil(context, '/mainMenuPage', (route) => false);
Modal Code
showModalBottomSheet(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.vertical(
top: Radius.circular(25.0),
),
),
backgroundColor: Colors.white,
context: context,
builder: (context) => Widget(...),
);
}
.then
onshowModalBottomSheet
and do what you want after it closes.