transition_pages_jr 0.0.3 transition_pages_jr: ^0.0.3 copied to clipboard
This is my new Flutter Package that contains a Transitions Pages.
import 'package:flutter/material.dart';
import 'package:transition_pages_jr/transition_pages_jr.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 Page1Page(),
'page2': (_) => const Page2Page(),
},
);
}
}
class Page1Page extends StatelessWidget {
const Page1Page({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.blueGrey,
appBar: AppBar(
elevation: 0,
backgroundColor: Colors.transparent,
title: const Text('Page1Page'),
),
body: Center(
child: MaterialButton(
onPressed: () {
RouteTransitions(
context: context,
child: const Page2Page(),
animation: AnimationType.fadeIn,
);
},
child: const Text('Go to Page2Page'),
color: Colors.white,
),
),
);
}
}
class Page2Page extends StatelessWidget {
const Page2Page({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(),
backgroundColor: Colors.blueGrey,
body: const Center(
child: Text('Page2Page'),
),
);
}
}