enjoy_route_transitions 0.0.3
enjoy_route_transitions: ^0.0.3 copied to clipboard
A Flutter package project to manage the route transitions between the screens in a easy way.
example/main.dart
import 'package:flutter/material.dart';
import 'package:enjoy_route_transitions/enjoy_route_transitions.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: 'Flutter Demo',
debugShowCheckedModeBanner: false,
initialRoute: 'page1',
routes: {
'page1': (_) => const Page1(),
'page2': (_) => const Page2(),
},
);
}
}
class Page1 extends StatelessWidget {
const Page1({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text("Page1"),
backgroundColor: Colors.transparent,
),
backgroundColor: Colors.blue,
body: Center(
child: MaterialButton(
color: Colors.white,
onPressed: () {
EnjoyRouteTransitions(
context: context,
child: const Page2(),
animation: AnimationType.fadeIn,
duration: const Duration(milliseconds: 100),
replacement: true,
);
},
child: const Text("Go to Page 2"),
),
),
);
}
}
class Page2 extends StatelessWidget {
const Page2({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text("Page2"),
backgroundColor: Colors.transparent,
),
backgroundColor: Colors.blueGrey,
body: const Center(
child: Text("Page2"),
),
);
}
}