as_route_transitions 0.0.7
as_route_transitions: ^0.0.7 copied to clipboard
This package helps to handle transitions between screens easily.
example/main.dart
import 'package:flutter/material.dart';
import 'package:as_route_transitions/as_route_transitions.dart';
void main() => runApp(const YourApp());
class YourApp extends StatelessWidget {
const YourApp({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
title: 'Material App',
initialRoute: 'pageone',
routes: {
'pageone': (_) => const PageOne(),
'pagetwo': (_) => const PageTwo(),
},
);
}
}
class PageOne extends StatelessWidget {
const PageOne({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('Page one'),
backgroundColor: Colors.transparent,
),
backgroundColor: Colors.blue,
body: Center(
child: MaterialButton(
color: Colors.white,
child: const Text('Go to Page Two'),
onPressed: () {
RouteTransitions(
context: context,
child: const PageTwo(),
animation: AnimationType.rotateIn,
duration: const Duration(milliseconds: 600),
reverseDuration: const Duration(milliseconds: 600),
alignment: Alignment.center,
replacement: true,
curve: Curves.easeInOutBack,
);
},
),
),
);
}
}
class PageTwo extends StatelessWidget {
const PageTwo({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('Page Two'),
centerTitle: true,
backgroundColor: Colors.transparent,
),
backgroundColor: Colors.blueGrey,
body: const Center(
child: Text('Page Two'),
),
);
}
}