custom_route_transition_practice 0.0.3
custom_route_transition_practice: ^0.0.3 copied to clipboard
Paquete de animationes curso fernando herrera
example/main.dart
import 'package:flutter/material.dart';
import 'package:custom_route_transition_practice/custom_route_transition_practice.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
title: 'Flutter Demo',
initialRoute: 'page1',
routes: {
'page1': (context) => Page1(),
'page2': (context) => Page2(),
},
);
}
}
class Page1 extends StatelessWidget {
const Page1({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Page 1'),
backgroundColor: Colors.transparent,
),
backgroundColor: Colors.blue,
body: Center(
child: MaterialButton(
child: Text("Go to Page 2"),
color: Colors.white,
onPressed: () {
RouteTransitions(
context: context,
child: Page2(),
animation: AnimationType.fadeIn,
duration: Duration(seconds: 2),
replacement: true,
);
},
),
),
);
}
}
class Page2 extends StatelessWidget {
const Page2({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Page 2'),
backgroundColor: Colors.transparent,
),
backgroundColor: Colors.blueGrey,
body: Center(
child: Text("Page2"),
),
);
}
}