I maked a flutter app in windows and all works, but when i tried to compile to iOS throw a unexpected error. In the Textfield detects that the 'onTap' isn´t a a correct parameter. I don´t know what happens, in windows doesn´t return this error. Anyway. anybody know how fix this and what is the correct way to detect 'onTap' on texfield?
new Container(
color: Colors.blue[300],
child: new Padding(
padding: const EdgeInsets.all(8.0),
child: new Card(
child: new ListTile(
leading: new Icon(Icons.search),
title: new TextField(
onTap: () { <--- The named parameter 'onTap' isn´t defined
Navigator.push(
context,
UPDATE
I tried this but doesn´t work
title: new GestureDetector(
child: new TextField(
controller: searchController,
decoration: new InputDecoration(
hintText: 'Buscar parcela', border: InputBorder.none),
)),
onTap: () {
Navigator.push(
context,
new MaterialPageRoute(
builder: (context) => new EstatesPage(
parcela: widget.parcela,
dropdownItem: dropdownSelection)));
},
UPDATE 2: SOLUTION
I updated flutter and brew. The error disappeared.
you can wrap your textfield in IgnorePointer
widget. It disables all the gestures on its children. This will make gesture detector work.
title: new GestureDetector(
child: new IgnorePointer (
child: new TextField(
controller: searchController,
decoration: new InputDecoration(
hintText: 'Buscar parcela', border: InputBorder.none),
))),
onTap: () {
Navigator.push(
context,
new MaterialPageRoute(
builder: (context) => new EstatesPage(
parcela: widget.parcela,
dropdownItem: dropdownSelection)));
},
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With