animate_route_transition 0.0.3 animate_route_transition: ^0.0.3 copied to clipboard
Este paquete ayuda al manejo de transición entre pantallas de forma elegante y fácil, brindando flexibilidad al desarrollador para modificar dicha transición.
import 'package:animate_route_transition/animate_route_transition.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": (_) => Page1Page(),
"page2": (_) => Page2Page(),
},
);
}
}
class Page1Page extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.blue,
appBar: AppBar(
title: Text("Page1"),
backgroundColor: Colors.transparent,
),
body: Center(
child: MaterialButton(
child: Text("Go page 2"),
color: Colors.white,
onPressed: () {
AnimateRouteTransition(
context: context,
animation: AnimationType.fadeIn,
duration: Duration(milliseconds: 500),
replacement: false,
animateCurve: Curves.easeInOut,
child: Page2Page());
},
),
),
);
}
}
class Page2Page extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text("Page2"),
backgroundColor: Colors.transparent,
),
backgroundColor: Colors.blueGrey,
body: Center(
child: Text('Hola Mundo'),
),
);
}
}