Added page transition
This commit is contained in:
@@ -24,15 +24,7 @@ class Layout extends ConsumerWidget {
|
||||
|
||||
return OverlayStyle(
|
||||
child: Scaffold(
|
||||
body: PageTransitionSwitcher(
|
||||
duration: const Duration(milliseconds: 200),
|
||||
transitionBuilder: (child, primaryAnimation, secondaryAnimation) => FadeThroughTransition(
|
||||
animation: primaryAnimation,
|
||||
secondaryAnimation: secondaryAnimation,
|
||||
child: child,
|
||||
),
|
||||
child: child,
|
||||
),
|
||||
body: child,
|
||||
bottomNavigationBar: NavigationBar(
|
||||
onDestinationSelected: (s) => ref.watch(routerProvider).replace(appScreens[s].route),
|
||||
selectedIndex: screenIndex,
|
||||
|
||||
24
lib/widgets/page_transition.dart
Normal file
24
lib/widgets/page_transition.dart
Normal file
@@ -0,0 +1,24 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:animations/animations.dart';
|
||||
|
||||
class PageTransition extends StatelessWidget {
|
||||
final Widget child;
|
||||
|
||||
const PageTransition({
|
||||
Key? key,
|
||||
required this.child,
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return PageTransitionSwitcher(
|
||||
duration: const Duration(milliseconds: 200),
|
||||
transitionBuilder: (child, primaryAnimation, secondaryAnimation) => FadeThroughTransition(
|
||||
animation: primaryAnimation,
|
||||
secondaryAnimation: secondaryAnimation,
|
||||
child: child,
|
||||
),
|
||||
child: child,
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user