I'm using a modal sheet with a TextEditingController and a TextField to allow the users to make inputs. When the user submints (presses enter on the keyboard), a function is triggered, the data collected and everything works perfectly. But: If the user clicks outside of the modal sheet, it closes without the onsubmit function being triggered. Can I change that somehow?
In short: I want to treat tapping outside of the modal sheet as if the user hits enter/submits.
Thanks!
CodePudding user response:
wrap the model sheet with WillPopScop widget and onpop you can write your function eg
WillPopScope(
onWillPop: () async {
//enter your function here
return true;
},
child://child);