custom_route_transitions_rmua 0.0.3 custom_route_transitions_rmua: ^0.0.3 copied to clipboard
Custom route transitions with animation, This package helps handle transitions between screens elegantly and easily.
import 'package:flutter/material.dart';
import 'package:custom_route_transitions_rmua/custom_route_transitions_rmua.dart';
void main() => runApp(const MyApp());
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Material App',
initialRoute: 'pageOne',
routes: {
'pageOne': (context) => const PageOne(),
'pageTwo': (context) => const PageTwo()
},
);
}
}
class PageOne extends StatelessWidget {
const PageOne({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('Page one'),
backgroundColor: Colors.transparent,
),
backgroundColor: Colors.blueGrey,
body: Center(
child: MaterialButton(
onPressed: () {
RouteTransitions(
context: context,
child: const PageTwo(),
animation: AnimationType.fadeIn,
animationDuration: const Duration(milliseconds: 500),
replacement: false);
},
color: Colors.white,
child: const Text('Go page two'),
),
),
);
}
}
class PageTwo extends StatelessWidget {
const PageTwo({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('Page two'),
backgroundColor: Colors.transparent,
),
backgroundColor: Colors.cyan,
body: const Center(
child: Text('Page two'),
),
);
}
}