Reputation: 1
I have multiple widgets in my flutter app. If I click at another widget, onWillPopScope method which is defined at the top of Widget build(BuildContext context)
does not working. Could you give me advice how to fix it? Thanks
See below code:
ExpansionTile(
initiallyExpanded: false,
title:
Text('Solution', style: basicAlertBlack),
children: <Widget>[
Container(
color: Colors.amber.shade50,
height:
MediaQuery
.of(context)
.size
.height /
7,
child: _solutionTextField(),
)
],
),
Code of second widget:
Widget _solutionTextField() {
return TextField(
focusNode: myFocusNode,
keyboardType: TextInputType.multiline,
maxLines: null,
style: solution,
controller: solutionController,
decoration: new InputDecoration(
contentPadding: EdgeInsets.all(8),
focusedBorder: InputBorder.none,
enabledBorder: InputBorder.none,
errorBorder: InputBorder.none,
disabledBorder: InputBorder.none,
hintText: 'Enter a solution'));
}
Upvotes: 0
Views: 335
Reputation: 1
Can you provide more context, please?
As documentations says:
Registers a callback to veto attempts by the user to dismiss the enclosing ModalRoute.
It means that it will be called on pop
actions. It could be called from android navigation by clicking the return arrow or iOS by swiping from edge left side to right. And every other pop
method that you call via Navigator
. So it doesn't have a connection with clicking at Widget.
Upvotes: 0