TextFormField(
decoration: InputDecoration(
prefixIcon: Icon(
Icons.email_outlined,
color: Colors.orange,
),
labelText: 'email',),
onChanged: (v) {
_emailV = v;
},
);
GestureDetector(
onTap: () {},
child: Container(
child: Text(
'emaaail',
)),
);
I have these two widgets inside the Column(). When a user finishes typing an email address and press done, I want the app to execute GestureDetector - onTap() function.
I’d tried with the context and stuff but did not work as expected. So, I wonder if there is any thing that I can make this works?
>Solution :
Create a function
// depending on your needs
void onTapFunction(){
...
}
add the function to the onTap in the gesture part
GestureDetector(
onTap: onTapFunction,
child: Container(
child: Text(
'emaaail',
)),
);
add the function to the onEditingComplete in the TextFormField part
TextFormField(
decoration: InputDecoration(
prefixIcon: Icon(
Icons.email_outlined,
color: Colors.orange,
),
labelText: 'email',),
onChanged: (v) {
_emailV = v;
},
onEditingComplete: onTapFunction,
);