navigator_transitions_route 0.1.3 navigator_transitions_route: ^0.1.3 copied to clipboard
This package helps to manage the transitions between screens in an elegant and easy way.
import 'package:flutter/material.dart';
import "package:navigator_transitions_route/navigator_transitions_route.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(
title: Text("Page 1"),
backgroundColor: Colors.transparent,
),
backgroundColor: Colors.blue,
body: Center(
child: MaterialButton(
child: Text("Go to Page 2"),
color: Colors.white,
onPressed: () {
NavigatorTransitionsRoute(
context: context,
child: Page2(),
animation: AnimationType.fade,
duration: Duration(milliseconds: 300),
//replacement: true
);
}
)
),
);
}
}
class Page2 extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.blueGrey,
appBar: AppBar(
title: Text("Page 2"),
backgroundColor: Colors.transparent,
),
body: Center(
child: Text("Page2"),
),
);
}
}