flutter_transitions 1.0.2 flutter_transitions: ^1.0.2 copied to clipboard
Simple Route Transitions
import 'package:flutter/material.dart';
import 'package:flutter_transitions/flutter_transitions.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Transition Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: Index(),
);
}
}
class Index extends StatelessWidget {
const Index({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Scaffold(
body: Column(
children: [
ElevatedButton(
onPressed: () {
Navigator.push(context, FlutterSizeRoute(page: SecondPage()));
},
child: Text("Size Transition")),
SizedBox(
height: 10,
),
ElevatedButton(
onPressed: () {
Navigator.push(context, FlutterFadeRoute(page: SecondPage()));
},
child: Text("Fade Transition")),
SizedBox(
height: 10,
),
ElevatedButton(
onPressed: () {
Navigator.push(context, FlutterScaleRoute(page: SecondPage()));
},
child: Text("Scale Transition")),
],
),
);
}
}
class SecondPage extends StatelessWidget {
const SecondPage({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Scaffold(
body: Center(
child: Text("Navigated Page"),
),
);
}
}