custom_route_transition_p_ca 0.0.3
custom_route_transition_p_ca: ^0.0.3 copied to clipboard
Paquete para manejo de transiciones entre pantallas de forma sencilla.
example/main.dart
import 'package:flutter/material.dart';
import 'package:custom_route_transition_p_ca/custom_route_transition_p_ca.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': (context) => Page1(),
'page2': (context) => Page2(),
},
theme: ThemeData.light().copyWith(
appBarTheme: AppBarTheme(
centerTitle: true,
foregroundColor: Colors.white,
backgroundColor: Colors.transparent,
shadowColor: Colors.black,
elevation: 1
)
),
);
}
}
class Page1 extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Page1'),
),
backgroundColor: Colors.blue,
body: Center(
child: MaterialButton(
color: Colors.white,
onPressed: () {
//Navigator.pushNamed(context, 'page2');
RouteTransitions(
context: context,
child: Page2(),
animation: AnimationType.fadeIn,
animationDuration: Duration(milliseconds: 500),
replacement: true
);
},
child: Text('Go to page2'),
)
),
);
}
}
class RouteTransition {
}
class Page2 extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Page2'),
),
backgroundColor: Colors.blueGrey,
body: Center(
child: Text('page2'),
),
);
}
}