route_transition_dev 0.0.3
route_transition_dev: ^0.0.3 copied to clipboard
A new flutter package that allows using transitions between screens.
example/main.dart
import 'package:flutter/material.dart';
import 'package:route_transition_dev/route_transition_dev.dart';
void main() => runApp(const MyApp());
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Route Transition',
debugShowCheckedModeBanner: false,
initialRoute: 'page1',
routes: {
'page1': (context) => const FirstPage(),
'page2': (context) => const SecondPage(),
},
);
}
}
class FirstPage extends StatelessWidget {
const FirstPage({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('First Page'),
elevation: 0,
centerTitle: true,
backgroundColor: Colors.black87,
),
backgroundColor: Colors.blue,
body: Center(
child: MaterialButton(
color: Colors.black,
onPressed: () {
RouteTransition(
context: context,
child: const SecondPage(),
animation: AnimationType.fadeIn,
duration: const Duration(milliseconds: 150),
replacement: true
);
},
child: const Text('Go to page 2', style: TextStyle(color: Colors.white)),
)
),
);
}
}
class SecondPage extends StatelessWidget {
const SecondPage({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('Second Page'),
elevation: 0,
centerTitle: true,
backgroundColor: Colors.black87,
),
backgroundColor: Colors.green,
body: const Center(
child: Text('Second')),
);
}
}