next_transitions 0.0.3
next_transitions: ^0.0.3 copied to clipboard
Paquete next_transitions: paquete que ayuda al manejo de transiciones entre pantallas de forma elegante y facil
example/main.dart
import 'package:flutter/material.dart';
import 'package:next_transitions/next_transitions.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": (_) => Page1(),
"page2": (_) => Page2()
},
);
}
}
class Page1 extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text("Page 1", style: TextStyle(color: Colors.white)),
backgroundColor: Colors.transparent,
),
backgroundColor: Colors.blue,
body: Center(
child: MaterialButton(
color: Colors.white,
onPressed: () {
NextTransitions(
context: context,
child: Page2(),
animation: AnimationType.fadeIn,
duration: Duration(milliseconds: 100),
replacement: true
);
},
child: Text("Go to page2"),
)
),
);
}
}
class Page2 extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text("Page 2", style: TextStyle(color: Colors.white)),
backgroundColor: Colors.transparent,
),
backgroundColor: Colors.blueGrey,
body: Center(
child: Text('Page2'),
),
);
}
}