You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm having an issue when I place a flutter_typeahead inside a KeyboardActions. If I pass the focus node to the TypeAheadFormField, then when I select a suggestion from the dropdown list, this code here clears the focus from the TypeAheadFormField too soon, which causes the onSuggestionSelected callback not to be called, as it can only be called if it has focus:
/// Insert the keyboard bar as an Overlay.
///
/// This will be inserted above everything else in the MaterialApp, including dialog modals.
///
/// Position the overlay based on the current [MediaQuery] to land above the keyboard.
void _insertOverlay() {
OverlayState os = Overlay.of(context);
_inserted = true;
_overlayEntry = OverlayEntry(builder: (context) {
// Update and build footer, if any
_currentFooter = (_currentAction!.footerBuilder != null)
? _currentAction!.footerBuilder!(context)
: null;
final queryData = MediaQuery.of(context);
return Stack(
children: [
if (widget.tapOutsideBehavior != TapOutsideBehavior.none ||
// ignore: deprecated_member_use_from_same_package
widget.tapOutsideToDismiss)
Positioned.fill(
child: Listener(
onPointerDown: (event) {
if (!widget.keepFocusOnTappingNode ||
_currentAction?.focusNode.rect.contains(event.position) !=
true) {
_clearFocus(); ////////////////////////////////////// <- this line prevents onSuggestionSelected callback from running
}
},
If I pass the focus node into my widget that wraps the TypeAheadFormField, the issue seems to resolve; I think because it checks _currentAction?.focusNode.rect.contains(event.position), and the focus node rect is much larger, and includes the drop-down box, so _clearFocus() doesn't run. However, this removes the keyboard_actions keyboard toolbar. Does anyone know of a workaround I can do? I am still investigating options, so I will update this if I figure something out.
The text was updated successfully, but these errors were encountered:
I'm having an issue when I place a flutter_typeahead inside a
KeyboardActions
. If I pass the focus node to theTypeAheadFormField
, then when I select a suggestion from the dropdown list, this code here clears the focus from the TypeAheadFormField too soon, which causes the onSuggestionSelected callback not to be called, as it can only be called if it has focus:If I pass the focus node into my widget that wraps the
TypeAheadFormField
, the issue seems to resolve; I think because it checks_currentAction?.focusNode.rect.contains(event.position)
, and the focus node rect is much larger, and includes the drop-down box, so_clearFocus()
doesn't run. However, this removes the keyboard_actions keyboard toolbar. Does anyone know of a workaround I can do? I am still investigating options, so I will update this if I figure something out.The text was updated successfully, but these errors were encountered: