-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
33 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# 20. Keyboard is disappeared then appeared if we send message in a chat which found from search | ||
|
||
Date: 2024-03-12 | ||
|
||
## Status | ||
|
||
Accepted | ||
|
||
- Issue: [#1545](https://github.com/linagora/twake-on-matrix/issues/1545) | ||
|
||
## Context | ||
|
||
- In TextField use onTapOutside to hide the keyboard but don't know exactly which screen the keyboard is enabled on. | ||
Therefore, when opening the keyboard on screen A and then switching to screen B, TextField A is still listening onTapOutside. | ||
So Keyboard is disappeared then appears | ||
|
||
## Decision | ||
- Check exactly screen the keyboard is enabled in `dismissKeyboard` function. | ||
|
||
```dart | ||
void dismissKeyboard(BuildContext context) { | ||
if (ModalRoute.of(context)?.isCurrent == true) { | ||
if (FocusManager.instance.primaryFocus?.hasFocus == true) { | ||
FocusManager.instance.primaryFocus?.unfocus(); | ||
} | ||
} | ||
} | ||
``` | ||
|
||
## Consequences | ||
|
||
- The keyboard will not disappear and then reappear when switching screens. |