custom_route_transition_an 0.0.4
custom_route_transition_an: ^0.0.4 copied to clipboard
Este paquete ayuda al manejo de transiciones entre pantallas de forma elegante y fácil.
example/main.dart
import 'package:flutter/material.dart';
import 'package:custom_route_transition_an/custom_route_transition_an.dart';
void main() => runApp(const MyApp());
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
title: 'Material App',
initialRoute: 'page1',
routes: {
'page1': (_) => const Page1Page(),
'page2': (_) => const Page2Page()
},
);
}
}
class Page1Page extends StatelessWidget {
const Page1Page({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('Page 1'),
backgroundColor: Colors.transparent,
),
backgroundColor: Colors.blue,
body: Center(
child: MaterialButton(
color: Colors.white,
child: const Text('Go to page2'),
onPressed: () {
RouteTransitions(
context: context,
child: const Page2Page(),
animation: AnimationType.fadeIn,
duration: const Duration(milliseconds: 100),
// replacement: true
);
},
)
),
);
}
}
class Page2Page extends StatelessWidget {
const Page2Page({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('Page 2'),
backgroundColor: Colors.transparent,
),
backgroundColor: Colors.blueGrey,
body: const Center(
child: Text('Page2Page'),
),
);
}
}