push to screen with route slider left flutter code example

Example: slide left animtion on naviagtor push in flutter

Navigator.push(context, SlideRightRoute(page: Screen2()))
import 'package:flutter/material.dart';class SlideRightRoute extends PageRouteBuilder {  final Widget page;  SlideRightRoute({this.page})      : super(          pageBuilder: (            BuildContext context,            Animation<double> animation,            Animation<double> secondaryAnimation,          ) =>              page,          transitionsBuilder: (            BuildContext context,            Animation<double> animation,            Animation<double> secondaryAnimation,            Widget child,          ) =>              SlideTransition(                position: Tween<Offset>(                  begin: const Offset(-1, 0),                  end: Offset.zero,                ).animate(animation),                child: child,              ),        );}

Tags:

Misc Example