epic_route_transitions 0.0.3 epic_route_transitions: ^0.0.3 copied to clipboard
An epic library to handling screen transitions with animations.
import 'package:epic_route_transitions/epic_route_transitions.dart';
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Material App',
debugShowCheckedModeBanner: false,
initialRoute: 'page1',
routes: {
'page1': (_) => Page1(),
'page2': (_) => Page2(),
},
);
}
}
class Page1 extends StatelessWidget {
const Page1({Key key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Page 1'),
backgroundColor: Colors.transparent,
),
backgroundColor: Colors.blueAccent,
body: Center(
child: MaterialButton(
child: Text('Go to page2'),
color: Colors.white,
onPressed: () {
EpicRouteTransitions(
context: context,
child: Page2(),
animation: AnimationType.fadeIn,
duration: Duration(seconds: 1),
replacement: false,
);
},
),
),
);
}
}
class Page2 extends StatelessWidget {
const Page2({Key key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Page 2'),
backgroundColor: Colors.transparent,
),
backgroundColor: Colors.blueGrey,
body: Center(child: Text('Page 2'),),
);
}
}