Skip to content

Controlls animation run by controller only #14

@brunodmn

Description

@brunodmn

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions