dwyl / dwyl/app

How to detect `focus` on widgets?

Open
#308 2 comments 1 reaction 1 assignee Claimed by @SimonLab View on GitHub
flutter T2h
Dominant language
Dart
Stars
152
Forks
22
PR merge metrics
No merged PRs in 30d

Description

At the moment to extend the `TextField` to take all the screen see https://github.com/dwyl/app/issues/303 I'm using the `onTap` property of the widget:

```dart
child: TextField(
onTap: () {
extendsFieldText();
},
```

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
- https://stackoverflow.com/questions/49341856/how-to-detect-when-a-textfield-is-selected-in-flutter
- https://api.flutter.dev/flutter/widgets/Focus-class.html
- https://api.flutter.dev/flutter/widgets/FocusScope-class.html
- https://docs.flutter.dev/cookbook/forms/focus
- https://docs.flutter.dev/development/ui/advanced/focus#best-practices-for-creating-focusnode-objects

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.