Skip to content

Commit

Permalink
fixed conflict b/w zoom and quick open
Browse files Browse the repository at this point in the history
  • Loading branch information
DattatreyaReddy committed Oct 15, 2023
1 parent eb92165 commit f04a3a0
Show file tree
Hide file tree
Showing 6 changed files with 212 additions and 344 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import 'package:flutter/services.dart';
import 'package:flutter_hooks/flutter_hooks.dart';

import '../../../../utils/extensions/custom_extensions.dart';
import '../../../../widgets/two_finger_pointer.dart';
import '../quick_search/quick_search_screen.dart';

class ShowQuickOpenIntent extends Intent {}
Expand Down Expand Up @@ -87,8 +86,8 @@ class QuickSearchShortcutWrapper extends StatelessWidget {
},
),
},
child: TwoFingerPointerWidget(
onUpdate: (details) => visible.value = (true),
child: GestureDetector(
onLongPress: () => visible.value = (true),
child: child,
),
),
Expand Down
105 changes: 42 additions & 63 deletions lib/src/routes/router_config.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import '../features/manga_book/presentation/manga_details/manga_details_screen.d
import '../features/manga_book/presentation/reader/reader_screen.dart';
import '../features/manga_book/presentation/updates/updates_screen.dart';
import '../features/manga_book/widgets/update_status_summary_sheet.dart';
import '../features/quick_open/presentation/search_stack/search_stack_screen.dart';
import '../features/settings/presentation/appearance/appearance_screen.dart';
import '../features/settings/presentation/backup/backup_screen.dart';
import '../features/settings/presentation/browse/browse_settings_screen.dart';
Expand All @@ -40,9 +39,6 @@ part 'router_config.g.dart';
final GlobalKey<NavigatorState> _rootNavigatorKey =
GlobalKey<NavigatorState>(debugLabel: 'root');

final GlobalKey<NavigatorState> _quickOpenNavigatorKey =
GlobalKey<NavigatorState>(debugLabel: 'Quick Open');

final GlobalKey<NavigatorState> _shellNavigatorKey =
GlobalKey<NavigatorState>(debugLabel: 'shell');

Expand Down Expand Up @@ -83,52 +79,17 @@ GoRouter routerConfig(ref) {
);
}

@TypedShellRoute<QuickSearchRoute>(
// Shell Routes
@TypedShellRoute<ShellRoute>(
routes: [
TypedShellRoute<ShellRoute>(
routes: [
TypedGoRoute<HomeRoute>(path: Routes.home),
TypedGoRoute<LibraryRoute>(path: Routes.library),
TypedGoRoute<UpdatesRoute>(path: Routes.updates),
TypedGoRoute<BrowseRoute>(path: Routes.browse),
TypedGoRoute<DownloadsRoute>(path: Routes.downloads),
TypedGoRoute<MoreRoute>(path: Routes.more),
],
),
TypedGoRoute<MangaRoute>(path: Routes.manga),
TypedGoRoute<UpdateStatusRoute>(path: Routes.updateStatus),
TypedGoRoute<GlobalSearchRoute>(path: Routes.globalSearch),
TypedGoRoute<SourcePreferenceRoute>(path: Routes.sourcePreference),
TypedGoRoute<SourceMangaRoute>(path: Routes.sourceManga),
TypedGoRoute<AboutRoute>(path: Routes.about),
TypedGoRoute<ReaderRoute>(path: Routes.reader),
TypedGoRoute<SettingsRoute>(path: Routes.settings, routes: [
TypedGoRoute<LibrarySettingsRoute>(
path: Routes.librarySettings,
routes: [
TypedGoRoute<EditCategoriesRoute>(path: Routes.editCategories)
],
),
TypedGoRoute<ServerSettingsRoute>(path: Routes.serverSettings),
TypedGoRoute<ReaderSettingsRoute>(path: Routes.readerSettings),
TypedGoRoute<AppearanceSettingsRoute>(path: Routes.appearanceSettings),
TypedGoRoute<GeneralSettingsRoute>(path: Routes.generalSettings),
TypedGoRoute<BrowseSettingsRoute>(path: Routes.browseSettings),
TypedGoRoute<BackupRoute>(path: Routes.backup),
])
TypedGoRoute<HomeRoute>(path: Routes.home),
TypedGoRoute<LibraryRoute>(path: Routes.library),
TypedGoRoute<UpdatesRoute>(path: Routes.updates),
TypedGoRoute<BrowseRoute>(path: Routes.browse),
TypedGoRoute<DownloadsRoute>(path: Routes.downloads),
TypedGoRoute<MoreRoute>(path: Routes.more),
],
)
class QuickSearchRoute extends ShellRouteData {
const QuickSearchRoute();

static final $navigatorKey = _quickOpenNavigatorKey;

@override
Widget builder(context, state, navigator) =>
SearchStackScreen(child: navigator);
}

// Shell Routes
class ShellRoute extends ShellRouteData {
const ShellRoute();

Expand Down Expand Up @@ -181,40 +142,43 @@ class MoreRoute extends GoRouteData {
const NoTransitionPage(child: MoreScreen());
}

//
@TypedGoRoute<MangaRoute>(path: Routes.manga)
class MangaRoute extends GoRouteData {
const MangaRoute({required this.mangaId, this.categoryId});
final int mangaId;
final int? categoryId;

static final $parentNavigatorKey = _quickOpenNavigatorKey;
static final $parentNavigatorKey = _rootNavigatorKey;

@override
Widget build(BuildContext context, GoRouterState state) =>
MangaDetailsScreen(mangaId: mangaId, categoryId: categoryId);
}

@TypedGoRoute<UpdateStatusRoute>(path: Routes.updateStatus)
class UpdateStatusRoute extends GoRouteData {
const UpdateStatusRoute();

static final $parentNavigatorKey = _quickOpenNavigatorKey;
static final $parentNavigatorKey = _rootNavigatorKey;

@override
Widget build(BuildContext context, GoRouterState state) =>
const UpdateStatusSummaryDialog();
}

@TypedGoRoute<GlobalSearchRoute>(path: Routes.globalSearch)
class GlobalSearchRoute extends GoRouteData {
const GlobalSearchRoute({this.query});
final String? query;

static final $parentNavigatorKey = _quickOpenNavigatorKey;
static final $parentNavigatorKey = _rootNavigatorKey;

@override
Widget build(BuildContext context, GoRouterState state) =>
GlobalSearchScreen(key: ValueKey(query), initialQuery: query);
}

@TypedGoRoute<SourceMangaRoute>(path: Routes.sourceManga)
class SourceMangaRoute extends GoRouteData {
const SourceMangaRoute({
required this.sourceId,
Expand All @@ -227,7 +191,7 @@ class SourceMangaRoute extends GoRouteData {
final String? query;
final List<Filter>? $extra;

static final $parentNavigatorKey = _quickOpenNavigatorKey;
static final $parentNavigatorKey = _rootNavigatorKey;

@override
Widget build(BuildContext context, GoRouterState state) =>
Expand All @@ -240,28 +204,31 @@ class SourceMangaRoute extends GoRouteData {
);
}

@TypedGoRoute<SourcePreferenceRoute>(path: Routes.sourcePreference)
class SourcePreferenceRoute extends GoRouteData {
final String sourceId;
const SourcePreferenceRoute({required this.sourceId});

static final $parentNavigatorKey = _quickOpenNavigatorKey;
static final $parentNavigatorKey = _rootNavigatorKey;

@override
Widget build(BuildContext context, GoRouterState state) {
return SourcePreferenceScreen(sourceId: sourceId);
}
}

@TypedGoRoute<AboutRoute>(path: Routes.about)
class AboutRoute extends GoRouteData {
const AboutRoute();

static final $parentNavigatorKey = _quickOpenNavigatorKey;
static final $parentNavigatorKey = _rootNavigatorKey;

@override
Widget build(BuildContext context, GoRouterState state) =>
const AboutScreen();
}

@TypedGoRoute<ReaderRoute>(path: Routes.reader)
class ReaderRoute extends GoRouteData {
const ReaderRoute({
required this.mangaId,
Expand All @@ -276,7 +243,7 @@ class ReaderRoute extends GoRouteData {
final bool? toPrev;
final bool showReaderLayoutAnimation;

static final $parentNavigatorKey = _quickOpenNavigatorKey;
static final $parentNavigatorKey = _rootNavigatorKey;

@override
Page<void> buildPage(BuildContext context, GoRouterState state) {
Expand Down Expand Up @@ -309,10 +276,22 @@ class ReaderRoute extends GoRouteData {
}
}

@TypedGoRoute<SettingsRoute>(path: Routes.settings, routes: [
TypedGoRoute<LibrarySettingsRoute>(
path: Routes.librarySettings,
routes: [TypedGoRoute<EditCategoriesRoute>(path: Routes.editCategories)],
),
TypedGoRoute<ServerSettingsRoute>(path: Routes.serverSettings),
TypedGoRoute<ReaderSettingsRoute>(path: Routes.readerSettings),
TypedGoRoute<AppearanceSettingsRoute>(path: Routes.appearanceSettings),
TypedGoRoute<GeneralSettingsRoute>(path: Routes.generalSettings),
TypedGoRoute<BrowseSettingsRoute>(path: Routes.browseSettings),
TypedGoRoute<BackupRoute>(path: Routes.backup),
])
class SettingsRoute extends GoRouteData {
const SettingsRoute();

static final $parentNavigatorKey = _quickOpenNavigatorKey;
static final $parentNavigatorKey = _rootNavigatorKey;

@override
Widget build(BuildContext context, GoRouterState state) =>
Expand All @@ -322,7 +301,7 @@ class SettingsRoute extends GoRouteData {
class LibrarySettingsRoute extends GoRouteData {
const LibrarySettingsRoute();

static final $parentNavigatorKey = _quickOpenNavigatorKey;
static final $parentNavigatorKey = _rootNavigatorKey;

@override
Widget build(BuildContext context, GoRouterState state) =>
Expand All @@ -332,7 +311,7 @@ class LibrarySettingsRoute extends GoRouteData {
class EditCategoriesRoute extends GoRouteData {
const EditCategoriesRoute();

static final $parentNavigatorKey = _quickOpenNavigatorKey;
static final $parentNavigatorKey = _rootNavigatorKey;

@override
Widget build(BuildContext context, GoRouterState state) =>
Expand All @@ -342,7 +321,7 @@ class EditCategoriesRoute extends GoRouteData {
class ServerSettingsRoute extends GoRouteData {
const ServerSettingsRoute();

static final $parentNavigatorKey = _quickOpenNavigatorKey;
static final $parentNavigatorKey = _rootNavigatorKey;

@override
Widget build(BuildContext context, GoRouterState state) =>
Expand All @@ -352,7 +331,7 @@ class ServerSettingsRoute extends GoRouteData {
class ReaderSettingsRoute extends GoRouteData {
const ReaderSettingsRoute();

static final $parentNavigatorKey = _quickOpenNavigatorKey;
static final $parentNavigatorKey = _rootNavigatorKey;

@override
Widget build(BuildContext context, GoRouterState state) =>
Expand All @@ -362,7 +341,7 @@ class ReaderSettingsRoute extends GoRouteData {
class AppearanceSettingsRoute extends GoRouteData {
const AppearanceSettingsRoute();

static final $parentNavigatorKey = _quickOpenNavigatorKey;
static final $parentNavigatorKey = _rootNavigatorKey;

@override
Widget build(BuildContext context, GoRouterState state) =>
Expand All @@ -372,7 +351,7 @@ class AppearanceSettingsRoute extends GoRouteData {
class GeneralSettingsRoute extends GoRouteData {
const GeneralSettingsRoute();

static final $parentNavigatorKey = _quickOpenNavigatorKey;
static final $parentNavigatorKey = _rootNavigatorKey;

@override
Widget build(BuildContext context, GoRouterState state) =>
Expand All @@ -382,7 +361,7 @@ class GeneralSettingsRoute extends GoRouteData {
class BrowseSettingsRoute extends GoRouteData {
const BrowseSettingsRoute();

static final $parentNavigatorKey = _quickOpenNavigatorKey;
static final $parentNavigatorKey = _rootNavigatorKey;

@override
Widget build(BuildContext context, GoRouterState state) =>
Expand Down
Loading

0 comments on commit f04a3a0

Please sign in to comment.