Skip to content

Commit

Permalink
[#376] [DC] Implementation Flow. Unfocus before selector popup
Browse files Browse the repository at this point in the history
  • Loading branch information
lyskouski committed Jan 3, 2024
1 parent 7d674dd commit 0ddca95
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/_classes/controller/focus_controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ class FocusController {

bool isFocused(dynamic item) => key(item) == focus;

void _blur() => scope.forEach((_, value) => value.unfocus());
void blur() => scope.forEach((_, value) => value.unfocus());

void onFocus(dynamic item, [int? idx, bool isForced = true]) {
idx ??= key(item);
Expand All @@ -119,7 +119,7 @@ class FocusController {
scope[idx] != null &&
scope[idx]!.context != null &&
scope[idx]!.context!.mounted) {
_blur();
blur();
scope[idx]?.requestFocus();
if (item != null) {
_scrollTo.run(() => scrollToFocusedElement(item, idx));
Expand Down
1 change: 1 addition & 0 deletions lib/design/form/list_selector.dart
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ class ListSelectorState<T extends ListSelector, K extends ListSelectorItem> exte
FntSelectorCallback? getItemBuilder() => null;

void onTap(BuildContext context) async {
focusController.blur();
FocusController.force = true;
final result = await Navigator.push(
context,
Expand Down

0 comments on commit 0ddca95

Please sign in to comment.