route_transitions_os 0.0.4
route_transitions_os: ^0.0.4 copied to clipboard
This package helps to make animated transitions between screens, in a practical and easy to implement way.
example/main.dart
import 'package:flutter/material.dart';
import 'package:route_transitions_os/route_transitions_os.dart';
void main() {
runApp(const MainApp());
}
class MainApp extends StatelessWidget {
const MainApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
initialRoute: 'page1',
routes: {'page1': (_) => Page1(), 'page2': (_) => Page2()},
);
}
}
class Page1 extends StatelessWidget {
const Page1({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.blue.shade300,
appBar: AppBar(title: Text('Page1')),
body: Center(
child: MaterialButton(
color: Colors.white,
onPressed: () {
RouteTransitions(
context: context,
child: Page2(),
animation: AnimationType.fadeIn,
duration: Duration(milliseconds: 700),
replacement: false,
);
},
child: Text('Go to Page2'),
),
),
);
}
}
class Page2 extends StatelessWidget {
const Page2({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.blueGrey.shade300,
appBar: AppBar(title: Text('Page2')),
body: Center(
child: MaterialButton(
color: Colors.white,
onPressed: () {
RouteTransitions(
context: context,
child: Page1(),
animation: AnimationType.normal,
duration: Duration(milliseconds: 500),
replacement: true,
);
},
child: Text('Go to Page1'),
),
),
);
}
}