Skip to content

Instantly share code, notes, and snippets.

@nitishk72
Created December 12, 2018 06:30
Show Gist options
  • Save nitishk72/6fb5ca995038b52c14b84dbc6987e45a to your computer and use it in GitHub Desktop.
Save nitishk72/6fb5ca995038b52c14b84dbc6987e45a to your computer and use it in GitHub Desktop.
import 'package:flutter/material.dart';
// usage for this route
// Navigator.push(context, AppSlideRoute(builder: (context) => new SecondPage(),),);
class AppSlideRoute<T> extends MaterialPageRoute<T> {
AppSlideRoute({WidgetBuilder builder, RouteSettings settings})
: super(builder: builder, settings: settings);
@override
Widget buildTransitions(BuildContext context, Animation<double> animation,
Animation<double> secondaryAnimation, Widget child) {
if (settings.isInitialRoute) return child;
return new FadeTransition(opacity: animation, child: child);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment