custom_route_transition_fp 0.0.4 custom_route_transition_fp: ^0.0.4 copied to clipboard
An awesome, elegant and easy page transition between routes in your flutter proyect.
import 'package:flutter/material.dart';
import 'package:custom_route_transition_fp/custom_route_transition_fp.dart';
void main() => runApp(const MyApp());
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
title: 'Material App',
initialRoute: 'screen1',
routes: {
'screen1': (_) => const Screen1(),
'screen2': (_) => const Screen2(),
},
);
}
}
class Screen1 extends StatelessWidget {
const Screen1({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.blue,
appBar: AppBar(
title: const Text('Screen 1'),
backgroundColor: Colors.transparent,
elevation: 0,
centerTitle: true,
),
body: Center(
child: MaterialButton(
color: Colors.white,
onPressed: () {
AwesomeRouteTransitions(
context: context,
child: const Screen2(),
animation: AnimationType.fadeIn,
duration: const Duration(milliseconds: 300),
replacement: false
);
},
child: const Text('Go to Screen 2'),
)
),
);
}
}
class Screen2 extends StatelessWidget {
const Screen2({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.blueGrey,
appBar: AppBar(
title: const Text('Screen2'),
backgroundColor: Colors.transparent,
elevation: 0,
centerTitle: true,
),
body: const Center(
child: Text('Screen 2'),
),
);
}
}