route_transitions_womo 0.0.4 route_transitions_womo: ^0.0.4 copied to clipboard
This package make transitions beetween pages easier for development.
import 'package:flutter/material.dart';
import 'package:route_transitions_womo/route_transitions_womo.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
title: 'Material App',
initialRoute: 'page1',
routes: {'page1': (_) => Page1(), 'page2': (_) => Page2()},
);
}
}
class Page1 extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
centerTitle: true,
title: Text('Page 1'),
backgroundColor: Colors.transparent,
),
backgroundColor: Colors.blue,
body: Center(
child: MaterialButton(
child: Text('Go to Page 2'),
color: Colors.white,
onPressed: () {
RouteTransitions(
context: context,
child: Page2(),
animation: AnimationType.fadeIn,
replacement: true,
duration: Duration(milliseconds: 800));
},
),
),
);
}
}
class Page2 extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
centerTitle: true,
title: Text('Page 2'),
backgroundColor: Colors.transparent,
),
backgroundColor: Colors.blueGrey,
body: Center(
child: Text('Page 2'),
),
);
}
}