route_transition_red 0.1.0 route_transition_red: ^0.1.0 copied to clipboard
This Flutter package makes easier to create an animated transition between screens.
import 'package:flutter/material.dart';
import 'package:route_transition_red/route_transition_red.dart';
void main() => runApp(const MyApp());
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return const MaterialApp(
title: 'Material App',
home: Screen1(),
);
}
}
class Screen1 extends StatelessWidget {
const Screen1({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text( 'Screen1' ),
backgroundColor: Colors.transparent,
),
backgroundColor: Colors.red.shade100,
body: Center(
child: MaterialButton(
child: const Text( 'Go to Screen2' ),
color: Colors.white,
onPressed: () {
RouteTransition(
context: context,
child: const Screen2(),
animation: RouteTransitionAnimation.fade,
duration: const Duration( milliseconds: 200 ),
type: RouteTransitionType.replaceAll,
// curve: Curves.bounceIn,
// from: 0.6,
);
},
),
),
);
}
}
class Screen2 extends StatelessWidget {
const Screen2({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text( 'Screen2' ),
backgroundColor: Colors.transparent,
),
body: Container(),
);
}
}