custom_route_transition_jacd 0.0.3 custom_route_transition_jacd: ^0.0.3 copied to clipboard
Este paquete ayuda al manejo de las transiciones entre pantallas de forma elegante y fácil.
import 'package:flutter/material.dart';
import 'package:custom_route_transition_jacd/custom_route_transition_jacd.dart';
void main() => runApp(const MyApp());
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Material App',
initialRoute: 'screen1',
debugShowCheckedModeBanner: false,
routes: {
'screen1': ((context) => const Screen1()),
'screen2': ((context) => const Screen2()),
},
);
}
}
class Screen1 extends StatelessWidget {
const Screen1({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('Screen1'),
backgroundColor: Colors.transparent,
),
backgroundColor: Colors.blue,
body: Center(
child: MaterialButton(
child: const Text('Go to screen 2'),
color: Colors.white,
onPressed: () {
RouteTransitions(
child: const Screen2(),
context: context,
animation: AnimationType.fadeIn,
duration: const Duration(milliseconds: 400),
replacement: false,
);
},
),
),
);
}
}
class Screen2 extends StatelessWidget {
const Screen2({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.blueGrey,
appBar: AppBar(
title: const Text('Screen2'),
backgroundColor: Colors.transparent,
),
body: const Center(
child: Text('Screen2'),
),
);
}
}