From a8d459ed11a39edc6843ab84b0a597cf1a13eb80 Mon Sep 17 00:00:00 2001 From: Juan Gilsanz Polo Date: Thu, 29 Feb 2024 01:45:26 +0100 Subject: [PATCH] Changed navigation --- lib/router/routes.dart | 30 ++++++-------- lib/screens/bookmarks/ui/bookmarks.dart | 39 +++++++++++++------ .../bookmarks/ui/search_bookmarks.dart | 4 +- .../ui/filtered_bookmarks.dart | 4 +- lib/screens/settings/ui/settings.dart | 2 + lib/widgets/circle_page_transition.dart | 3 +- 6 files changed, 44 insertions(+), 38 deletions(-) diff --git a/lib/router/routes.dart b/lib/router/routes.dart index 4ca5fe8..98c3ca7 100644 --- a/lib/router/routes.dart +++ b/lib/router/routes.dart @@ -28,25 +28,17 @@ final List appRoutes = [ path: RoutesPaths.onboarding, builder: (context, state) => const Onboarding(), ), - ShellRoute( - builder: (context, state, child) => Layout( - state: state, - child: child, - ), - routes: [ - GoRoute( - path: RoutesPaths.bookmarks, - builder: (context, state) => const PageTransition(child: BookmarksScreen()), - ), - GoRoute( - path: RoutesPaths.tags, - builder: (context, state) => const PageTransition(child: TagsScreen()), - ), - GoRoute( - path: RoutesPaths.settings, - builder: (context, state) => const PageTransition(child: SettingsScreen()), - ), - ], + GoRoute( + path: RoutesPaths.bookmarks, + builder: (context, state) => const PageTransition(child: BookmarksScreen()), + ), + GoRoute( + path: RoutesPaths.tags, + builder: (context, state) => const PageTransition(child: TagsScreen()), + ), + GoRoute( + path: RoutesPaths.settings, + builder: (context, state) => const PageTransition(child: SettingsScreen()), ), GoRoute( path: RoutesPaths.tagBookmarks, diff --git a/lib/screens/bookmarks/ui/bookmarks.dart b/lib/screens/bookmarks/ui/bookmarks.dart index 14b2d4d..8affc45 100644 --- a/lib/screens/bookmarks/ui/bookmarks.dart +++ b/lib/screens/bookmarks/ui/bookmarks.dart @@ -12,6 +12,7 @@ import 'package:linkdy/screens/webview/ui/webview.dart'; import 'package:linkdy/widgets/circle_page_transition.dart'; import 'package:linkdy/widgets/error_screen.dart'; import 'package:linkdy/widgets/no_data_screen.dart'; +import 'package:linkdy/widgets/system_overlay_style.dart'; import 'package:linkdy/config/sizes.dart'; import 'package:linkdy/constants/enums.dart'; @@ -38,9 +39,7 @@ class BookmarksScreen extends ConsumerWidget { if (ref.watch(bookmarksProvider).selectedBookmark != null) Expanded( flex: 3, - child: WebViewScreen( - bookmark: ref.watch(bookmarksProvider).selectedBookmark!, - ), + child: WebViewScreen(bookmark: ref.watch(bookmarksProvider).selectedBookmark!), ), if (ref.watch(bookmarksProvider).selectedBookmark == null) const Expanded( @@ -148,6 +147,16 @@ class _List extends ConsumerWidget { icon: const Icon(Icons.search_rounded), tooltip: t.bookmarks.search.searchBookmarks, ), + IconButton( + onPressed: () => showModalBottomSheet( + context: context, + useRootNavigator: true, + builder: (context) => const VisualizationModal(), + isScrollControlled: true, + ), + icon: const Icon(Icons.sort_rounded), + tooltip: t.bookmarks.filterSort, + ), PopupMenuButton( itemBuilder: (context) => [ PopupMenuItem( @@ -172,17 +181,23 @@ class _List extends ConsumerWidget { ), const PopupMenuDivider(height: 1), PopupMenuItem( - onTap: () => showModalBottomSheet( - context: context, - useRootNavigator: true, - builder: (context) => const VisualizationModal(), - isScrollControlled: true, - ), + onTap: () => ref.read(routerProvider).push(RoutesPaths.tags), child: Row( children: [ - const Icon(Icons.sort_rounded), + const Icon(Icons.label_rounded), const SizedBox(width: 16), - Text(t.bookmarks.filterSort), + Text(t.tags.tags), + ], + ), + ), + const PopupMenuDivider(height: 1), + PopupMenuItem( + onTap: () => ref.read(routerProvider).push(RoutesPaths.settings), + child: Row( + children: [ + const Icon(Icons.settings_rounded), + const SizedBox(width: 16), + Text(t.settings.settings), ], ), ), @@ -195,7 +210,7 @@ class _List extends ConsumerWidget { ], body: SafeArea( top: false, - bottom: false, + bottom: true, child: Builder( builder: (context) => RefreshIndicator( displacement: 120, diff --git a/lib/screens/bookmarks/ui/search_bookmarks.dart b/lib/screens/bookmarks/ui/search_bookmarks.dart index 8ff818a..8d37541 100644 --- a/lib/screens/bookmarks/ui/search_bookmarks.dart +++ b/lib/screens/bookmarks/ui/search_bookmarks.dart @@ -40,9 +40,7 @@ class SearchBookmarksModal extends ConsumerWidget { if (ref.watch(searchBookmarksProvider).selectedBookmark != null) Expanded( flex: 3, - child: WebViewScreen( - bookmark: ref.watch(searchBookmarksProvider).selectedBookmark!, - ), + child: WebViewScreen(bookmark: ref.watch(searchBookmarksProvider).selectedBookmark!), ), if (ref.watch(searchBookmarksProvider).selectedBookmark == null) Expanded( diff --git a/lib/screens/filtered_bookmarks/ui/filtered_bookmarks.dart b/lib/screens/filtered_bookmarks/ui/filtered_bookmarks.dart index 3539402..edcba40 100644 --- a/lib/screens/filtered_bookmarks/ui/filtered_bookmarks.dart +++ b/lib/screens/filtered_bookmarks/ui/filtered_bookmarks.dart @@ -85,9 +85,7 @@ class FilteredBookmarksScreen extends HookConsumerWidget { if (ref.watch(filteredBookmarksProvider).selectedBookmark != null) Expanded( flex: 3, - child: WebViewScreen( - bookmark: ref.watch(filteredBookmarksProvider).selectedBookmark!, - ), + child: WebViewScreen(bookmark: ref.watch(filteredBookmarksProvider).selectedBookmark!), ), if (ref.watch(filteredBookmarksProvider).selectedBookmark == null) const Expanded( diff --git a/lib/screens/settings/ui/settings.dart b/lib/screens/settings/ui/settings.dart index 1df3fb4..d6de928 100644 --- a/lib/screens/settings/ui/settings.dart +++ b/lib/screens/settings/ui/settings.dart @@ -12,6 +12,7 @@ import 'package:linkdy/widgets/section_label.dart'; import 'package:linkdy/widgets/custom_list_tile.dart'; import 'package:linkdy/widgets/custom_settings_tile.dart'; +import 'package:linkdy/providers/router.provider.dart'; import 'package:linkdy/providers/app_info.provider.dart'; import 'package:linkdy/utils/open_url.dart'; import 'package:linkdy/constants/strings.dart'; @@ -51,6 +52,7 @@ class _List extends ConsumerWidget { Widget build(BuildContext context, WidgetRef ref) { return Scaffold( appBar: AppBar( + leading: BackButton(onPressed: () => ref.read(routerProvider).pop()), title: Text(t.settings.settings), ), body: ListView( diff --git a/lib/widgets/circle_page_transition.dart b/lib/widgets/circle_page_transition.dart index ef42894..ecdda84 100644 --- a/lib/widgets/circle_page_transition.dart +++ b/lib/widgets/circle_page_transition.dart @@ -14,7 +14,8 @@ Route circlePageBuilder({ fullscreenDialog: fullScreenDialog ?? false, transitionsBuilder: (context, animation, secondaryAnimation, child) { const double beganRadius = 0.0; - final double endRadius = MediaQuery.of(context).size.height * 1.7; + final size = MediaQuery.of(context).size; + final double endRadius = size.height > size.width ? size.height * 1.2 : size.width * 1.2; final radiusTweenAnimation = animation.drive( Tween(begin: beganRadius, end: endRadius),