Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose onTapOutside-method of underlying TextFormField #94

Closed
philitell opened this issue Aug 1, 2023 · 1 comment
Closed

Expose onTapOutside-method of underlying TextFormField #94

philitell opened this issue Aug 1, 2023 · 1 comment
Labels
easy fix should be relatively easy to fix fixed The issue is fixed in new release P1 High Priority: This is a show stopper and must be addressed immediately severe: new feature Request for a new capability or a feature

Comments

@philitell
Copy link

It would be really helpful if SearchField had a parameter onTapOutside. With this method SearchField could be used in complex Forms. An Implementation should be possible by exposing the onSaved-method of the underlying TextFormField inside SearchField.

Parameter definition:

/// Callback when a tap is performed outside Searchfield (during the time the field has focus)
final void Function(PointerDownEvent)? onTapOutside;

Implementation

    return CompositedTransformTarget(
      link: _layerLink,
      child: TextFormField(
        key: key,
        enabled: widget.enabled,
        autocorrect: widget.autoCorrect,
        readOnly: widget.readOnly,
        onFieldSubmitted: (x) {
          if (widget.onSubmit != null) {
            widget.onSubmit!(x);
          }
        },
        onTap: () {
          /// only call if SuggestionState = [Suggestion.expand]
          if (!isSuggestionExpanded && widget.suggestionState == Suggestion.expand) {
            suggestionStream.sink.add(widget.suggestions);
            if (mounted) {
              setState(() {
                isSuggestionExpanded = true;
              });
            }
          }
        },
        inputFormatters: widget.inputFormatters,
        controller: widget.controller ?? searchController,
        focusNode: _focus,
        validator: widget.validator,
        style: widget.searchStyle,
        textInputAction: widget.textInputAction,
        textCapitalization: widget.textCapitalization,
        keyboardType: widget.inputType,
        decoration:
            widget.searchInputDecoration?.copyWith(hintText: widget.hint) ?? InputDecoration(hintText: widget.hint),
        onSaved: widget.onSaved,
        onTapOutside: widget.onTapOutside,  //************ add this line****************

https://api.flutter.dev/flutter/material/TextField/onTapOutside.html
This would also be very usefull.

@maheshmnj maheshmnj added severe: new feature Request for a new capability or a feature easy fix should be relatively easy to fix P1 High Priority: This is a show stopper and must be addressed immediately labels Aug 7, 2023
maheshmnj added a commit that referenced this issue Nov 21, 2023
@maheshmnj
Copy link
Owner

maheshmnj commented Nov 21, 2023

Closing as fixed in v0.8.8

@maheshmnj maheshmnj added the fixed The issue is fixed in new release label Nov 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
easy fix should be relatively easy to fix fixed The issue is fixed in new release P1 High Priority: This is a show stopper and must be addressed immediately severe: new feature Request for a new capability or a feature
Projects
None yet
Development

No branches or pull requests

2 participants