-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to detect focus
on widgets?
#308
Comments
Reading the TextField documentation I can see the I don't know what is the However I don't think this is directly related on how to detect focus on a widget. |
After some reading it seems that we can use the Focus(
onFocusChange: (focus) {
if (focus) {
extendsFieldText();
} else {
minimizeFieldText();
}
},
child: TextField(
// onTap: () {
// extendsFieldText();
// },
decoration: const InputDecoration(
hintText: 'Capture what is on your mind..!.',
border: OutlineInputBorder()),
expands: _expands,
maxLines: _maxLines,
textAlignVertical: TextAlignVertical.top,
keyboardType: TextInputType.multiline,
),
), The I'm still not sure if this is the "correct" way to detect focus, there is a lot of documentation that I haven't finished to read and there might be an edge case that I'm not aware of by using |
Wrap TextField widget in a Focus widget to be able to use the onFocusChange callback. see #308
At the moment to extend the
TextField
to take all the screen see #303 I'm using theonTap
property of the widget:This is not ideal (tab, autofocus are two example that put focus on textfield and which aren't using onTap) and it's preferable to detect the
focus
on the text field instead.Looking at learning/implementing this now.
see
The text was updated successfully, but these errors were encountered: