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

TickerFuture return for AnimationController.toggle #5

Closed
wants to merge 1 commit into from

Conversation

saepire
Copy link

@saepire saepire commented Aug 11, 2024

This breaks while building with latest flutter. Likely due to the toggle addition in flutter/flutter#147801

trying to fix.

This breaks while building with latest flutter. Likely due to the toggle addition in flutter/flutter#147801

trying to fix.
@n-bernat
Copy link
Owner

n-bernat commented Aug 11, 2024

Thanks for noticing it!
I see that you are missing @override and don't return TickerFuture when calling forward - it would be better to return it because it accurately shows the current state of the animation. Do you want to fix it or should I do it?

Also, it would be a good idea to simplify this method while we are editing it.

Basically, we need something like:

@override
TickerFuture toggle({double? from}) {
  if (isCompleted) {
    reset();
  } else if (_isPlaying) {
    stop();
    return TickerFuture.complete();
  }

  return forward(from: from);
}

I can make a new release today if we merge it

@n-bernat
Copy link
Owner

Ok, I've fixed it, I won't waste your time.
Thanks a lot nonetheless!

There should be a new release later today

@n-bernat n-bernat closed this Aug 11, 2024
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.

2 participants