custom_route_transition_ph 0.0.3
custom_route_transition_ph: ^0.0.3 copied to clipboard
This is a simple package for manage Route Transition on the pages in Flutter for free!
example/main.dart
import 'package:flutter/material.dart';
import 'package:custom_route_transition_ph/custom_route_transition_ph.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
title: 'Material App',
initialRoute: 'page1',
routes: {
'page1': (_) => Page1(),
'page2': (_) => Page2(),
},
);
}
}
class Page1 extends StatelessWidget {
const Page1({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Page1'),
backgroundColor: Colors.transparent,
),
backgroundColor: Colors.red,
body: Center(
child: MaterialButton(
color: Colors.white,
child: Text('Page 2'),
onPressed: (){
RouteTransitions(
context: context,
child: Page2(),
animation: AnimationType.fadeIn,
duration: Duration(seconds: 2),
replacement: true
);
}
),
),
);
}
}
class Page2 extends StatelessWidget {
const Page2({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Page2'),
backgroundColor: Colors.transparent,
),
backgroundColor: Colors.lightBlue,
);
}
}