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

fix enabled #12

Closed
wants to merge 1 commit into from
Closed

fix enabled #12

wants to merge 1 commit into from

Conversation

The-Redhat
Copy link

@The-Redhat The-Redhat commented Sep 18, 2019

Hey.. and another pull request.

I tested the new version v1.0.1 and the enabled property didn't worked for me.
For example:
Screenshot_1568844037

In my example the paint method is called. I fixed it. Moreover paint now only calls saveLayer (heavy method), when it's necessary.

@hnvn
Copy link
Owner

hnvn commented Sep 19, 2019

I think we are misunderstanding about enabled feature. In my view, I am implementing it as a way to stop translating animation, I don't remove all gradient blending, so the animation can be resumed from the state it is stopped. As I read from your codes, you want to remove all gradient blending and just draw the child, do you?

@The-Redhat
Copy link
Author

Yes. I try to follow the 5th point of the performance considerations.

@The-Redhat
Copy link
Author

Maybe we could use enabled the way you suggest it and when the gradient colors are null only paint the child.

@Zazo032
Copy link

Zazo032 commented Apr 21, 2020

@hnvn could this be merged and published? This is the desired behaviour we're looking for in our app

@gmaggio
Copy link

gmaggio commented Aug 18, 2020

@hnvn: I really need this ability to remove all gradient blending and just draw the child. I think it will come in handy for a lot of developers.

Anyway, wouldn't it be easier to just do this, @The-Redhat @hnvn:

  @override
  Widget build(BuildContext context) {
    return AnimatedBuilder(
      animation: _controller,
      child: widget.child,
      builder: (BuildContext context, Widget child) {
        return !widget.enabled
            ? child
            : _Shimmer(
                child: child,
                direction: widget.direction,
                gradient: widget.gradient,
                percent: _controller.value,
              );
      },
    );
  }

Or maybe, just in case, have another property for this feature, like hideOnDisabled maybe, so we can have a choice as to how we want it to behave.

@The-Redhat
Copy link
Author

Yes that could be a simple solution. I would suggest that you open a new pr, because I'm currently on vacation.

@gmaggio
Copy link

gmaggio commented Aug 19, 2020

@The-Redhat Okay... I added the PR here: #32

@The-Redhat The-Redhat closed this Nov 24, 2020
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

Successfully merging this pull request may close these issues.

4 participants