Skip to content

Update closeKeyboardWhenScrolling documentation#163

Open
julien-levarlet wants to merge 1 commit intokoukibadr:mainfrom
julien-levarlet:doc/close_keyboard
Open

Update closeKeyboardWhenScrolling documentation#163
julien-levarlet wants to merge 1 commit intokoukibadr:mainfrom
julien-levarlet:doc/close_keyboard

Conversation

@julien-levarlet
Copy link
Contributor

Hi,
I was working with the closeKeyboardWhenScrolling attribute and I noticed that the documentation doesn't mention that the focusNode has to be set to make it work. It updated the doc string to make it clearer.

In the code below, if no focusNode is set, the condition will always be false

if (widget.closeKeyboardWhenScrolling &&
          widget.focusNode?.hasFocus == true) {
    FocusScope.of(context).requestFocus(FocusNode());
}

@koukibadr
Copy link
Owner

@julien-levarlet good catch thank you, but looking back at this maybe it's better if the check on the focus node is removed to ease the usage of the flag closeKeyboardWhenScrolling because it may cause conflict with the app code

@julien-levarlet
Copy link
Contributor Author

Yes, simplifying its use can be great.
But removing the check will probably remove focus on other widget if the search bar was not on focus. Will it be ok ?

@koukibadr
Copy link
Owner

Yes that make sense since the flag is called closeKeyboardWhenScrolling so it's intended that the focus will reset in the screen

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants