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

CustomRoute's transitionsBuilder called every frame #2079

Open
snackva opened this issue Oct 28, 2024 · 3 comments
Open

CustomRoute's transitionsBuilder called every frame #2079

snackva opened this issue Oct 28, 2024 · 3 comments

Comments

@snackva
Copy link

snackva commented Oct 28, 2024

I'm coding a custom transition for a route by passing the transitionsBuilder argument to the CustomRoute constructor.

CustomRoute(
  page: VerificationRoute.page,
  path: "/verification/:planId/:userId",
  guards: [IsAuthenticatedGuard()],
  durationInMilliseconds: slowAnimationDuration.inMilliseconds,
  reverseDurationInMilliseconds: slowAnimationDuration.inMilliseconds,
  transitionsBuilder: verificationTransitionBuilder,
);

The definition of the RouteTransitionsBuilder is the following:

typedef RouteTransitionsBuilder = Widget Function(BuildContext context, Animation<double> animation, Animation<double> secondaryAnimation, Widget child);

The function receives an animation, which can be used for efficient rebuilding of the transition inside the returned Widget. However, by adding a print statement inside the function, I've seen the function gets called on every frame of the animation, defeating the purpose of receiving the Animation object directly (receiving a double with its value ranging from 0 to 1 would do the same).
Can this behaviour be fixed so that the function gets called only once when building the transition?

@snackva
Copy link
Author

snackva commented Nov 8, 2024

@Milad-Akarie any info?

@snackva
Copy link
Author

snackva commented Nov 29, 2024

@Milad-Akarie no updates?

@snackva
Copy link
Author

snackva commented Nov 29, 2024

This issue is addressed by the pull request flutter/flutter#159615.

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