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

Controlls animation run by controller only #14

Open
brunodmn opened this issue Oct 15, 2021 · 0 comments
Open

Controlls animation run by controller only #14

brunodmn opened this issue Oct 15, 2021 · 0 comments

Comments

@brunodmn
Copy link

Dear Frezyx,

Really nice package, thank you.

Just an addition, I did a search bar, which I had to search/clean icon animation whether text field was empty or not.
The default behavior of your package is to always animate when icon is clicked, it was undesired in this case, as the user could click on the 'search' icon and it'd change to 'clean' icon (and allow clean action) event if text field was empty.
My workaround was to add following code to your package:
added field:
final bool runAnimationOnPressed;
on constructor:
this.runAnimationOnPressed = true
on buildIconButton() method:

onPressed: () {
        nowIcon.onPressed?.call();
        widget.onPressed?.call();
        if (widget.runAnimationOnPressed) runAnimation(widget.animationDirection);
      },

or as below, to suppress splash behavior

onPressed: widget.onPressed == null && nowIcon.onPressed == null
          ? null
          : () {
              nowIcon.onPressed?.call();
              widget.onPressed?.call();
              if (widget.runAnimationOnPressed)
                runAnimation(widget.animationDirection);
            },

If you thing its useful, could upgrade the package.
Thank you.

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

No branches or pull requests

1 participant