route_transitions_do 0.0.2 route_transitions_do: ^0.0.2 copied to clipboard
A transition package to create good looking page transitions with no pain
import 'package:flutter/material.dart';
import 'package:route_transitions_do/route_transitions_do.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
initialRoute: 'page1',
routes: {
'page1': ( _ ) => Page1(),
'page2': ( _ ) => Page2(),
},
);
}
}
/// A simple page with a button to navigate to page2
class Page1 extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Page 1'),
backgroundColor: Colors.transparent,
),
backgroundColor: Colors.blue,
body: Center(
child: MaterialButton(
color: Colors.white,
child: Text('Navegar'),
onPressed: () {
// Navigator.pushNamed(context, 'page2');
RouteTransitionDo(
context: context,
animationType: AnimationType.fadeIn,
child: Page2()
);
}
),
),
);
}
}
/// A simple page
class Page2 extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Page2'),
backgroundColor: Colors.transparent,
),
backgroundColor: Colors.blueGrey,
body: Center(
child: Text('Page 2', style: TextStyle( color: Colors.white )),
),
);
}
}