Added page transition
This commit is contained in:
@@ -10,6 +10,7 @@ import 'package:linkdy/screens/settings/ui/settings.dart';
|
||||
import 'package:linkdy/screens/tags/ui/tags.dart';
|
||||
import 'package:linkdy/screens/webview/ui/webview.dart';
|
||||
import 'package:linkdy/widgets/layout.dart';
|
||||
import 'package:linkdy/widgets/page_transition.dart';
|
||||
|
||||
import 'package:linkdy/models/data/bookmarks.dart';
|
||||
import 'package:linkdy/router/paths.dart';
|
||||
@@ -36,15 +37,15 @@ final List<RouteBase> appRoutes = [
|
||||
routes: [
|
||||
GoRoute(
|
||||
path: RoutesPaths.bookmarks,
|
||||
builder: (context, state) => const BookmarksScreen(),
|
||||
builder: (context, state) => const PageTransition(child: BookmarksScreen()),
|
||||
),
|
||||
GoRoute(
|
||||
path: RoutesPaths.tags,
|
||||
builder: (context, state) => const TagsScreen(),
|
||||
builder: (context, state) => const PageTransition(child: TagsScreen()),
|
||||
),
|
||||
GoRoute(
|
||||
path: RoutesPaths.settings,
|
||||
builder: (context, state) => const SettingsScreen(),
|
||||
builder: (context, state) => const PageTransition(child: SettingsScreen()),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
@@ -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