route_transitions_fm 0.0.3 route_transitions_fm: ^0.0.3 copied to clipboard
Este paquete ayuda al manejo de transiciones entre pantallas de forma elegante y facil.
import 'package:flutter/material.dart';
import 'package:route_transitions_fm/route_transitions_fm.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Material App',
debugShowCheckedModeBanner: false,
initialRoute: 'page1',
routes: {
'page1' :(_)=>Page1(),
'page2' :(_)=>Page2()
},
);
}
}
class Page1 extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Page 1'),
),
body: Container(
width: double.infinity,
height: double.infinity,
color:Colors.blue,
child: Center(
child: MaterialButton(
color: Colors.white,
onPressed: (){
RouteTransition(
context: context,
child: Page2(),
animation: AnimationType.fadeIn,
replacement: true
);
},
child: Text('Go')
,
),
),
),
);
}
}
class Page2 extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Page 2'),
),
body: Container(
width: double.infinity,
height: double.infinity,
color:Colors.red,
child: Center(
child: MaterialButton(
color: Colors.white,
onPressed: (){
},
child: Text('Go')
,
),
),
),
);
}
}