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

Incompatibility with TransitionsBuilder #445

Open
willsmanley opened this issue Dec 22, 2024 · 1 comment
Open

Incompatibility with TransitionsBuilder #445

willsmanley opened this issue Dec 22, 2024 · 1 comment

Comments

@willsmanley
Copy link

willsmanley commented Dec 22, 2024

I would like to do a simple fade transition like this:

navigatorKey.currentState?.pushAndRemoveUntil(
  PageRouteBuilder(
    pageBuilder: (context, animation, secondaryAnimation) => MyWidget(),
    transitionDuration: const Duration(seconds: 2),
    transitionsBuilder: (context, animation, secondaryAnimation, child) {
      return FadeTransition(
        opacity: animation,
        child: child,
      );
    },
  ),
  (Route<dynamic> route) => false,
);

However when I try to implement this with MaterialWithModalsPageRoute, instead of the FadeTransition, there seems to be a permanent right-to-left swipe transition that I can't override, even if I provide my own transitionsBuilder.

@willsmanley
Copy link
Author

willsmanley commented Dec 27, 2024

This is how I tried to implement it with MaterialWithModalsPageRoute:

class FadeModalPageRoute<T> extends MaterialWithModalsPageRoute<T> {
  FadeModalPageRoute({
    required super.builder,
    super.settings,
    super.maintainState,
    super.fullscreenDialog,
  });

  @override
  Widget buildTransitions(BuildContext context, Animation<double> animation,
      Animation<double> secondaryAnimation, Widget child) {
    return FadeTransition(opacity: animation, child: child);
  }
}

but this results in a ghost-y right-to-left transition on top of the fade-in content. basically this is a blocker for using this library since every page needs to be wrapped with this route and every page also needs custom transitions.

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