custom_transitions_il 2.0.4 custom_transitions_il: ^2.0.4 copied to clipboard
Transitions package adding animation effects to move between pages
import 'package:flutter/material.dart';
import 'package:custom_transitions_il/custom_transitions_il.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: 'Material App',
initialRoute: 'page1',
routes: {
'page1': (_) => const Page1(),
'page2': (_) => const Page2()
},
);
}
}
class Page1 extends StatelessWidget {
const Page1({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar( title: const Center(child: Text('Page1')), backgroundColor: Colors.transparent ),
backgroundColor: Colors.blue,
body: Center(
child: MaterialButton( color: Colors.white, onPressed: (){
RouteTransitions(
context: context,
child: const Page2(),
replacament: false,
animation: AnimationType.fadeIn,
duration: const Duration( milliseconds: 350 )
);
}, child: const Text('Go to page 2'))
)
);
}
}
class Page2 extends StatelessWidget {
const Page2({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.blueGrey,
appBar: AppBar(title: const Text('Page2'), backgroundColor: Colors.transparent ),
body: const Center(
child: Text('Page2')
)
);
}
}