79706492

Date: 2025-07-18 16:40:39
Score: 0.5
Natty:
Report link

What about this easy to use

extension WidgetExtensions on Widget {
  Page<dynamic> Function(BuildContext, GoRouterState) get transitionPage =>
          (context, state) => CustomTransitionPage<dynamic>(
        key: state.pageKey,
        child: this,
        transitionsBuilder: (context, animation, secondaryAnimation, child) {
          const begin = Offset(1.0, 0.0);
          const end = Offset.zero;
          const curve = Curves.easeInOut;

          final tween = Tween(begin: begin, end: end).chain(CurveTween(curve: curve));
          return SlideTransition(position: animation.drive(tween), child: child);
        }
      );
}

To use

GoRoute(
  path: '/',
  pageBuilder: HomeScreen().transitionPage
),
Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Starts with a question (0.5): What
  • Low reputation (1):
Posted by: JS B