Flutter onClosing callback for showModalBottomSheet. Perhaps it’s not the best solution, but showModalBottomSheet return a “Future” so you can used it.
For example:
1 2 3 4 5 6 7 8 9 10 11 12 | void _showModal() { Future<void> future = showModalBottomSheet<void>( context: context, builder: (BuildContext context) { return Container(height: 260.0, child: Text('I am text')); }, ); future.then((void value) => _closeModal(value)); } void _closeModal(void value) { print('modal closed'); } |
If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.