route_transitions_eg 0.0.3 route_transitions_eg: ^0.0.3 copied to clipboard
An easy way to navigate between pages in an elegant mode and interactive
import 'package:route_transitions_eg/route_transitions_eg.dart';
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Material App',
initialRoute: 'page1',
routes: {
'page1': (_) => Page1(),
'page2': (_) => Page2(),
},
);
}
}
class Page1 extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Page1'),
backgroundColor: Colors.transparent,
),
backgroundColor: Colors.green,
body: Center(
child: MaterialButton(
color: Colors.white,
child: Text('Go to page 2'),
onPressed: () {
RouteTransitions(
context: context,
child: Page2(),
animation: AnimationType.fadeIn,
duration: Duration(milliseconds: 200),
replacement: false);
}),
),
);
}
}
class Page2 extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
backgroundColor: Colors.transparent,
title: Text('Page2'),
),
backgroundColor: Colors.blue,
body: Center(
child: Text('Hola Mundo'),
),
);
}
}