mirror of
https://github.com/gabehf/Fladder.git
synced 2026-03-07 13:38:13 -08:00
chore: Photoviewer now uses auto routing (#432)
Co-authored-by: PartyDonut <PartyDonut@users.noreply.github.com>
This commit is contained in:
parent
092836328f
commit
7628321e47
9 changed files with 201 additions and 141 deletions
|
|
@ -1,9 +1,10 @@
|
|||
// ignore_for_file: public_member_api_docs, sort_constructors_first
|
||||
import 'package:fladder/jellyfin/jellyfin_open_api.enums.swagger.dart';
|
||||
import 'package:fladder/util/localization_helper.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:dart_mappable/dart_mappable.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
|
||||
// ignore_for_file: public_member_api_docs, sort_constructors_first
|
||||
import 'package:fladder/jellyfin/jellyfin_open_api.enums.swagger.dart';
|
||||
import 'package:fladder/jellyfin/jellyfin_open_api.swagger.dart' as dto;
|
||||
import 'package:fladder/models/item_base_model.dart';
|
||||
import 'package:fladder/models/items/images_models.dart';
|
||||
|
|
@ -11,10 +12,9 @@ import 'package:fladder/models/items/item_shared_models.dart';
|
|||
import 'package:fladder/models/items/overview_model.dart';
|
||||
import 'package:fladder/providers/user_provider.dart';
|
||||
import 'package:fladder/screens/shared/fladder_snackbar.dart';
|
||||
import 'package:fladder/util/localization_helper.dart';
|
||||
import 'package:fladder/util/refresh_state.dart';
|
||||
|
||||
import 'package:dart_mappable/dart_mappable.dart';
|
||||
|
||||
part 'photos_model.mapper.dart';
|
||||
|
||||
@MappableClass()
|
||||
|
|
|
|||
|
|
@ -2,10 +2,10 @@ import 'dart:developer';
|
|||
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:auto_route/auto_route.dart';
|
||||
import 'package:chopper/chopper.dart';
|
||||
import 'package:collection/collection.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:page_transition/page_transition.dart';
|
||||
|
||||
import 'package:fladder/jellyfin/jellyfin_open_api.swagger.dart';
|
||||
import 'package:fladder/models/collection_types.dart';
|
||||
|
|
@ -23,7 +23,7 @@ import 'package:fladder/providers/library_filters_provider.dart';
|
|||
import 'package:fladder/providers/service_provider.dart';
|
||||
import 'package:fladder/providers/settings/client_settings_provider.dart';
|
||||
import 'package:fladder/providers/user_provider.dart';
|
||||
import 'package:fladder/screens/photo_viewer/photo_viewer_screen.dart';
|
||||
import 'package:fladder/routes/auto_router.gr.dart';
|
||||
import 'package:fladder/screens/shared/fladder_snackbar.dart';
|
||||
import 'package:fladder/util/item_base_model/play_item_helpers.dart';
|
||||
import 'package:fladder/util/list_extensions.dart';
|
||||
|
|
@ -657,14 +657,10 @@ class LibrarySearchNotifier extends StateNotifier<LibrarySearchModel> {
|
|||
if (state.fetchingItems == true) {
|
||||
state = state.copyWith(fetchingItems: false);
|
||||
final newItemList = shuffle ? allItems.shuffled() : allItems;
|
||||
await Navigator.of(context, rootNavigator: true).push(
|
||||
PageTransition(
|
||||
child: PhotoViewerScreen(
|
||||
items: newItemList,
|
||||
indexOfSelected: selected != null ? newItemList.indexOf(selected) : 0,
|
||||
),
|
||||
type: PageTransitionType.fade),
|
||||
);
|
||||
await context.navigateTo(PhotoViewerRoute(
|
||||
items: newItemList,
|
||||
selected: selected?.id,
|
||||
));
|
||||
}
|
||||
} else {
|
||||
fladderSnackbar(context, title: context.localized.libraryFetchNoItemsFound);
|
||||
|
|
|
|||
|
|
@ -51,6 +51,7 @@ class AutoRouter extends RootStackRouter {
|
|||
],
|
||||
),
|
||||
AutoRoute(page: LockRoute.page, path: '/locked'),
|
||||
AutoRoute(page: PhotoViewerRoute.page, path: "/album"),
|
||||
];
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -8,11 +8,13 @@
|
|||
// coverage:ignore-file
|
||||
|
||||
// ignore_for_file: no_leading_underscores_for_library_prefixes
|
||||
import 'package:auto_route/auto_route.dart' as _i17;
|
||||
import 'package:fladder/models/item_base_model.dart' as _i18;
|
||||
import 'package:fladder/models/items/photos_model.dart' as _i21;
|
||||
import 'dart:async' as _i23;
|
||||
|
||||
import 'package:auto_route/auto_route.dart' as _i18;
|
||||
import 'package:fladder/models/item_base_model.dart' as _i19;
|
||||
import 'package:fladder/models/items/photos_model.dart' as _i22;
|
||||
import 'package:fladder/models/library_search/library_search_options.dart'
|
||||
as _i20;
|
||||
as _i21;
|
||||
import 'package:fladder/routes/nested_details_screen.dart' as _i4;
|
||||
import 'package:fladder/screens/dashboard/dashboard_screen.dart' as _i3;
|
||||
import 'package:fladder/screens/favourites/favourites_screen.dart' as _i5;
|
||||
|
|
@ -22,22 +24,23 @@ import 'package:fladder/screens/library_search/library_search_screen.dart'
|
|||
as _i8;
|
||||
import 'package:fladder/screens/login/lock_screen.dart' as _i9;
|
||||
import 'package:fladder/screens/login/login_screen.dart' as _i10;
|
||||
import 'package:fladder/screens/photo_viewer/photo_viewer_screen.dart' as _i11;
|
||||
import 'package:fladder/screens/settings/about_settings_page.dart' as _i1;
|
||||
import 'package:fladder/screens/settings/client_settings_page.dart' as _i2;
|
||||
import 'package:fladder/screens/settings/player_settings_page.dart' as _i11;
|
||||
import 'package:fladder/screens/settings/security_settings_page.dart' as _i12;
|
||||
import 'package:fladder/screens/settings/settings_screen.dart' as _i13;
|
||||
import 'package:fladder/screens/settings/player_settings_page.dart' as _i12;
|
||||
import 'package:fladder/screens/settings/security_settings_page.dart' as _i13;
|
||||
import 'package:fladder/screens/settings/settings_screen.dart' as _i14;
|
||||
import 'package:fladder/screens/settings/settings_selection_screen.dart'
|
||||
as _i14;
|
||||
import 'package:fladder/screens/splash_screen.dart' as _i15;
|
||||
import 'package:fladder/screens/syncing/synced_screen.dart' as _i16;
|
||||
import 'package:flutter/foundation.dart' as _i19;
|
||||
import 'package:flutter/material.dart' as _i22;
|
||||
as _i15;
|
||||
import 'package:fladder/screens/splash_screen.dart' as _i16;
|
||||
import 'package:fladder/screens/syncing/synced_screen.dart' as _i17;
|
||||
import 'package:flutter/foundation.dart' as _i20;
|
||||
import 'package:flutter/material.dart' as _i24;
|
||||
|
||||
/// generated route for
|
||||
/// [_i1.AboutSettingsPage]
|
||||
class AboutSettingsRoute extends _i17.PageRouteInfo<void> {
|
||||
const AboutSettingsRoute({List<_i17.PageRouteInfo>? children})
|
||||
class AboutSettingsRoute extends _i18.PageRouteInfo<void> {
|
||||
const AboutSettingsRoute({List<_i18.PageRouteInfo>? children})
|
||||
: super(
|
||||
AboutSettingsRoute.name,
|
||||
initialChildren: children,
|
||||
|
|
@ -45,7 +48,7 @@ class AboutSettingsRoute extends _i17.PageRouteInfo<void> {
|
|||
|
||||
static const String name = 'AboutSettingsRoute';
|
||||
|
||||
static _i17.PageInfo page = _i17.PageInfo(
|
||||
static _i18.PageInfo page = _i18.PageInfo(
|
||||
name,
|
||||
builder: (data) {
|
||||
return const _i1.AboutSettingsPage();
|
||||
|
|
@ -55,8 +58,8 @@ class AboutSettingsRoute extends _i17.PageRouteInfo<void> {
|
|||
|
||||
/// generated route for
|
||||
/// [_i2.ClientSettingsPage]
|
||||
class ClientSettingsRoute extends _i17.PageRouteInfo<void> {
|
||||
const ClientSettingsRoute({List<_i17.PageRouteInfo>? children})
|
||||
class ClientSettingsRoute extends _i18.PageRouteInfo<void> {
|
||||
const ClientSettingsRoute({List<_i18.PageRouteInfo>? children})
|
||||
: super(
|
||||
ClientSettingsRoute.name,
|
||||
initialChildren: children,
|
||||
|
|
@ -64,7 +67,7 @@ class ClientSettingsRoute extends _i17.PageRouteInfo<void> {
|
|||
|
||||
static const String name = 'ClientSettingsRoute';
|
||||
|
||||
static _i17.PageInfo page = _i17.PageInfo(
|
||||
static _i18.PageInfo page = _i18.PageInfo(
|
||||
name,
|
||||
builder: (data) {
|
||||
return const _i2.ClientSettingsPage();
|
||||
|
|
@ -74,8 +77,8 @@ class ClientSettingsRoute extends _i17.PageRouteInfo<void> {
|
|||
|
||||
/// generated route for
|
||||
/// [_i3.DashboardScreen]
|
||||
class DashboardRoute extends _i17.PageRouteInfo<void> {
|
||||
const DashboardRoute({List<_i17.PageRouteInfo>? children})
|
||||
class DashboardRoute extends _i18.PageRouteInfo<void> {
|
||||
const DashboardRoute({List<_i18.PageRouteInfo>? children})
|
||||
: super(
|
||||
DashboardRoute.name,
|
||||
initialChildren: children,
|
||||
|
|
@ -83,7 +86,7 @@ class DashboardRoute extends _i17.PageRouteInfo<void> {
|
|||
|
||||
static const String name = 'DashboardRoute';
|
||||
|
||||
static _i17.PageInfo page = _i17.PageInfo(
|
||||
static _i18.PageInfo page = _i18.PageInfo(
|
||||
name,
|
||||
builder: (data) {
|
||||
return const _i3.DashboardScreen();
|
||||
|
|
@ -93,12 +96,12 @@ class DashboardRoute extends _i17.PageRouteInfo<void> {
|
|||
|
||||
/// generated route for
|
||||
/// [_i4.DetailsScreen]
|
||||
class DetailsRoute extends _i17.PageRouteInfo<DetailsRouteArgs> {
|
||||
class DetailsRoute extends _i18.PageRouteInfo<DetailsRouteArgs> {
|
||||
DetailsRoute({
|
||||
String id = '',
|
||||
_i18.ItemBaseModel? item,
|
||||
_i19.Key? key,
|
||||
List<_i17.PageRouteInfo>? children,
|
||||
_i19.ItemBaseModel? item,
|
||||
_i20.Key? key,
|
||||
List<_i18.PageRouteInfo>? children,
|
||||
}) : super(
|
||||
DetailsRoute.name,
|
||||
args: DetailsRouteArgs(
|
||||
|
|
@ -112,7 +115,7 @@ class DetailsRoute extends _i17.PageRouteInfo<DetailsRouteArgs> {
|
|||
|
||||
static const String name = 'DetailsRoute';
|
||||
|
||||
static _i17.PageInfo page = _i17.PageInfo(
|
||||
static _i18.PageInfo page = _i18.PageInfo(
|
||||
name,
|
||||
builder: (data) {
|
||||
final queryParams = data.queryParams;
|
||||
|
|
@ -140,9 +143,9 @@ class DetailsRouteArgs {
|
|||
|
||||
final String id;
|
||||
|
||||
final _i18.ItemBaseModel? item;
|
||||
final _i19.ItemBaseModel? item;
|
||||
|
||||
final _i19.Key? key;
|
||||
final _i20.Key? key;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
|
|
@ -152,8 +155,8 @@ class DetailsRouteArgs {
|
|||
|
||||
/// generated route for
|
||||
/// [_i5.FavouritesScreen]
|
||||
class FavouritesRoute extends _i17.PageRouteInfo<void> {
|
||||
const FavouritesRoute({List<_i17.PageRouteInfo>? children})
|
||||
class FavouritesRoute extends _i18.PageRouteInfo<void> {
|
||||
const FavouritesRoute({List<_i18.PageRouteInfo>? children})
|
||||
: super(
|
||||
FavouritesRoute.name,
|
||||
initialChildren: children,
|
||||
|
|
@ -161,7 +164,7 @@ class FavouritesRoute extends _i17.PageRouteInfo<void> {
|
|||
|
||||
static const String name = 'FavouritesRoute';
|
||||
|
||||
static _i17.PageInfo page = _i17.PageInfo(
|
||||
static _i18.PageInfo page = _i18.PageInfo(
|
||||
name,
|
||||
builder: (data) {
|
||||
return const _i5.FavouritesScreen();
|
||||
|
|
@ -171,8 +174,8 @@ class FavouritesRoute extends _i17.PageRouteInfo<void> {
|
|||
|
||||
/// generated route for
|
||||
/// [_i6.HomeScreen]
|
||||
class HomeRoute extends _i17.PageRouteInfo<void> {
|
||||
const HomeRoute({List<_i17.PageRouteInfo>? children})
|
||||
class HomeRoute extends _i18.PageRouteInfo<void> {
|
||||
const HomeRoute({List<_i18.PageRouteInfo>? children})
|
||||
: super(
|
||||
HomeRoute.name,
|
||||
initialChildren: children,
|
||||
|
|
@ -180,7 +183,7 @@ class HomeRoute extends _i17.PageRouteInfo<void> {
|
|||
|
||||
static const String name = 'HomeRoute';
|
||||
|
||||
static _i17.PageInfo page = _i17.PageInfo(
|
||||
static _i18.PageInfo page = _i18.PageInfo(
|
||||
name,
|
||||
builder: (data) {
|
||||
return const _i6.HomeScreen();
|
||||
|
|
@ -190,8 +193,8 @@ class HomeRoute extends _i17.PageRouteInfo<void> {
|
|||
|
||||
/// generated route for
|
||||
/// [_i7.LibraryScreen]
|
||||
class LibraryRoute extends _i17.PageRouteInfo<void> {
|
||||
const LibraryRoute({List<_i17.PageRouteInfo>? children})
|
||||
class LibraryRoute extends _i18.PageRouteInfo<void> {
|
||||
const LibraryRoute({List<_i18.PageRouteInfo>? children})
|
||||
: super(
|
||||
LibraryRoute.name,
|
||||
initialChildren: children,
|
||||
|
|
@ -199,7 +202,7 @@ class LibraryRoute extends _i17.PageRouteInfo<void> {
|
|||
|
||||
static const String name = 'LibraryRoute';
|
||||
|
||||
static _i17.PageInfo page = _i17.PageInfo(
|
||||
static _i18.PageInfo page = _i18.PageInfo(
|
||||
name,
|
||||
builder: (data) {
|
||||
return const _i7.LibraryScreen();
|
||||
|
|
@ -209,16 +212,16 @@ class LibraryRoute extends _i17.PageRouteInfo<void> {
|
|||
|
||||
/// generated route for
|
||||
/// [_i8.LibrarySearchScreen]
|
||||
class LibrarySearchRoute extends _i17.PageRouteInfo<LibrarySearchRouteArgs> {
|
||||
class LibrarySearchRoute extends _i18.PageRouteInfo<LibrarySearchRouteArgs> {
|
||||
LibrarySearchRoute({
|
||||
String? viewModelId,
|
||||
List<String>? folderId,
|
||||
bool? favourites,
|
||||
_i20.SortingOrder? sortOrder,
|
||||
_i20.SortingOptions? sortingOptions,
|
||||
_i21.PhotoModel? photoToView,
|
||||
_i19.Key? key,
|
||||
List<_i17.PageRouteInfo>? children,
|
||||
_i21.SortingOrder? sortOrder,
|
||||
_i21.SortingOptions? sortingOptions,
|
||||
_i22.PhotoModel? photoToView,
|
||||
_i20.Key? key,
|
||||
List<_i18.PageRouteInfo>? children,
|
||||
}) : super(
|
||||
LibrarySearchRoute.name,
|
||||
args: LibrarySearchRouteArgs(
|
||||
|
|
@ -242,7 +245,7 @@ class LibrarySearchRoute extends _i17.PageRouteInfo<LibrarySearchRouteArgs> {
|
|||
|
||||
static const String name = 'LibrarySearchRoute';
|
||||
|
||||
static _i17.PageInfo page = _i17.PageInfo(
|
||||
static _i18.PageInfo page = _i18.PageInfo(
|
||||
name,
|
||||
builder: (data) {
|
||||
final queryParams = data.queryParams;
|
||||
|
|
@ -284,13 +287,13 @@ class LibrarySearchRouteArgs {
|
|||
|
||||
final bool? favourites;
|
||||
|
||||
final _i20.SortingOrder? sortOrder;
|
||||
final _i21.SortingOrder? sortOrder;
|
||||
|
||||
final _i20.SortingOptions? sortingOptions;
|
||||
final _i21.SortingOptions? sortingOptions;
|
||||
|
||||
final _i21.PhotoModel? photoToView;
|
||||
final _i22.PhotoModel? photoToView;
|
||||
|
||||
final _i19.Key? key;
|
||||
final _i20.Key? key;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
|
|
@ -300,8 +303,8 @@ class LibrarySearchRouteArgs {
|
|||
|
||||
/// generated route for
|
||||
/// [_i9.LockScreen]
|
||||
class LockRoute extends _i17.PageRouteInfo<void> {
|
||||
const LockRoute({List<_i17.PageRouteInfo>? children})
|
||||
class LockRoute extends _i18.PageRouteInfo<void> {
|
||||
const LockRoute({List<_i18.PageRouteInfo>? children})
|
||||
: super(
|
||||
LockRoute.name,
|
||||
initialChildren: children,
|
||||
|
|
@ -309,7 +312,7 @@ class LockRoute extends _i17.PageRouteInfo<void> {
|
|||
|
||||
static const String name = 'LockRoute';
|
||||
|
||||
static _i17.PageInfo page = _i17.PageInfo(
|
||||
static _i18.PageInfo page = _i18.PageInfo(
|
||||
name,
|
||||
builder: (data) {
|
||||
return const _i9.LockScreen();
|
||||
|
|
@ -319,8 +322,8 @@ class LockRoute extends _i17.PageRouteInfo<void> {
|
|||
|
||||
/// generated route for
|
||||
/// [_i10.LoginScreen]
|
||||
class LoginRoute extends _i17.PageRouteInfo<void> {
|
||||
const LoginRoute({List<_i17.PageRouteInfo>? children})
|
||||
class LoginRoute extends _i18.PageRouteInfo<void> {
|
||||
const LoginRoute({List<_i18.PageRouteInfo>? children})
|
||||
: super(
|
||||
LoginRoute.name,
|
||||
initialChildren: children,
|
||||
|
|
@ -328,7 +331,7 @@ class LoginRoute extends _i17.PageRouteInfo<void> {
|
|||
|
||||
static const String name = 'LoginRoute';
|
||||
|
||||
static _i17.PageInfo page = _i17.PageInfo(
|
||||
static _i18.PageInfo page = _i18.PageInfo(
|
||||
name,
|
||||
builder: (data) {
|
||||
return const _i10.LoginScreen();
|
||||
|
|
@ -337,9 +340,71 @@ class LoginRoute extends _i17.PageRouteInfo<void> {
|
|||
}
|
||||
|
||||
/// generated route for
|
||||
/// [_i11.PlayerSettingsPage]
|
||||
class PlayerSettingsRoute extends _i17.PageRouteInfo<void> {
|
||||
const PlayerSettingsRoute({List<_i17.PageRouteInfo>? children})
|
||||
/// [_i11.PhotoViewerScreen]
|
||||
class PhotoViewerRoute extends _i18.PageRouteInfo<PhotoViewerRouteArgs> {
|
||||
PhotoViewerRoute({
|
||||
List<_i22.PhotoModel>? items,
|
||||
String? selected,
|
||||
_i23.Future<List<_i22.PhotoModel>>? loadingItems,
|
||||
_i24.Key? key,
|
||||
List<_i18.PageRouteInfo>? children,
|
||||
}) : super(
|
||||
PhotoViewerRoute.name,
|
||||
args: PhotoViewerRouteArgs(
|
||||
items: items,
|
||||
selected: selected,
|
||||
loadingItems: loadingItems,
|
||||
key: key,
|
||||
),
|
||||
rawQueryParams: {'selectedId': selected},
|
||||
initialChildren: children,
|
||||
);
|
||||
|
||||
static const String name = 'PhotoViewerRoute';
|
||||
|
||||
static _i18.PageInfo page = _i18.PageInfo(
|
||||
name,
|
||||
builder: (data) {
|
||||
final queryParams = data.queryParams;
|
||||
final args = data.argsAs<PhotoViewerRouteArgs>(
|
||||
orElse: () => PhotoViewerRouteArgs(
|
||||
selected: queryParams.optString('selectedId')));
|
||||
return _i11.PhotoViewerScreen(
|
||||
items: args.items,
|
||||
selected: args.selected,
|
||||
loadingItems: args.loadingItems,
|
||||
key: args.key,
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
class PhotoViewerRouteArgs {
|
||||
const PhotoViewerRouteArgs({
|
||||
this.items,
|
||||
this.selected,
|
||||
this.loadingItems,
|
||||
this.key,
|
||||
});
|
||||
|
||||
final List<_i22.PhotoModel>? items;
|
||||
|
||||
final String? selected;
|
||||
|
||||
final _i23.Future<List<_i22.PhotoModel>>? loadingItems;
|
||||
|
||||
final _i24.Key? key;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'PhotoViewerRouteArgs{items: $items, selected: $selected, loadingItems: $loadingItems, key: $key}';
|
||||
}
|
||||
}
|
||||
|
||||
/// generated route for
|
||||
/// [_i12.PlayerSettingsPage]
|
||||
class PlayerSettingsRoute extends _i18.PageRouteInfo<void> {
|
||||
const PlayerSettingsRoute({List<_i18.PageRouteInfo>? children})
|
||||
: super(
|
||||
PlayerSettingsRoute.name,
|
||||
initialChildren: children,
|
||||
|
|
@ -347,18 +412,18 @@ class PlayerSettingsRoute extends _i17.PageRouteInfo<void> {
|
|||
|
||||
static const String name = 'PlayerSettingsRoute';
|
||||
|
||||
static _i17.PageInfo page = _i17.PageInfo(
|
||||
static _i18.PageInfo page = _i18.PageInfo(
|
||||
name,
|
||||
builder: (data) {
|
||||
return const _i11.PlayerSettingsPage();
|
||||
return const _i12.PlayerSettingsPage();
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/// generated route for
|
||||
/// [_i12.SecuritySettingsPage]
|
||||
class SecuritySettingsRoute extends _i17.PageRouteInfo<void> {
|
||||
const SecuritySettingsRoute({List<_i17.PageRouteInfo>? children})
|
||||
/// [_i13.SecuritySettingsPage]
|
||||
class SecuritySettingsRoute extends _i18.PageRouteInfo<void> {
|
||||
const SecuritySettingsRoute({List<_i18.PageRouteInfo>? children})
|
||||
: super(
|
||||
SecuritySettingsRoute.name,
|
||||
initialChildren: children,
|
||||
|
|
@ -366,18 +431,18 @@ class SecuritySettingsRoute extends _i17.PageRouteInfo<void> {
|
|||
|
||||
static const String name = 'SecuritySettingsRoute';
|
||||
|
||||
static _i17.PageInfo page = _i17.PageInfo(
|
||||
static _i18.PageInfo page = _i18.PageInfo(
|
||||
name,
|
||||
builder: (data) {
|
||||
return const _i12.SecuritySettingsPage();
|
||||
return const _i13.SecuritySettingsPage();
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/// generated route for
|
||||
/// [_i13.SettingsScreen]
|
||||
class SettingsRoute extends _i17.PageRouteInfo<void> {
|
||||
const SettingsRoute({List<_i17.PageRouteInfo>? children})
|
||||
/// [_i14.SettingsScreen]
|
||||
class SettingsRoute extends _i18.PageRouteInfo<void> {
|
||||
const SettingsRoute({List<_i18.PageRouteInfo>? children})
|
||||
: super(
|
||||
SettingsRoute.name,
|
||||
initialChildren: children,
|
||||
|
|
@ -385,18 +450,18 @@ class SettingsRoute extends _i17.PageRouteInfo<void> {
|
|||
|
||||
static const String name = 'SettingsRoute';
|
||||
|
||||
static _i17.PageInfo page = _i17.PageInfo(
|
||||
static _i18.PageInfo page = _i18.PageInfo(
|
||||
name,
|
||||
builder: (data) {
|
||||
return const _i13.SettingsScreen();
|
||||
return const _i14.SettingsScreen();
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/// generated route for
|
||||
/// [_i14.SettingsSelectionScreen]
|
||||
class SettingsSelectionRoute extends _i17.PageRouteInfo<void> {
|
||||
const SettingsSelectionRoute({List<_i17.PageRouteInfo>? children})
|
||||
/// [_i15.SettingsSelectionScreen]
|
||||
class SettingsSelectionRoute extends _i18.PageRouteInfo<void> {
|
||||
const SettingsSelectionRoute({List<_i18.PageRouteInfo>? children})
|
||||
: super(
|
||||
SettingsSelectionRoute.name,
|
||||
initialChildren: children,
|
||||
|
|
@ -404,21 +469,21 @@ class SettingsSelectionRoute extends _i17.PageRouteInfo<void> {
|
|||
|
||||
static const String name = 'SettingsSelectionRoute';
|
||||
|
||||
static _i17.PageInfo page = _i17.PageInfo(
|
||||
static _i18.PageInfo page = _i18.PageInfo(
|
||||
name,
|
||||
builder: (data) {
|
||||
return const _i14.SettingsSelectionScreen();
|
||||
return const _i15.SettingsSelectionScreen();
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/// generated route for
|
||||
/// [_i15.SplashScreen]
|
||||
class SplashRoute extends _i17.PageRouteInfo<SplashRouteArgs> {
|
||||
/// [_i16.SplashScreen]
|
||||
class SplashRoute extends _i18.PageRouteInfo<SplashRouteArgs> {
|
||||
SplashRoute({
|
||||
dynamic Function(bool)? loggedIn,
|
||||
_i22.Key? key,
|
||||
List<_i17.PageRouteInfo>? children,
|
||||
_i24.Key? key,
|
||||
List<_i18.PageRouteInfo>? children,
|
||||
}) : super(
|
||||
SplashRoute.name,
|
||||
args: SplashRouteArgs(
|
||||
|
|
@ -430,12 +495,12 @@ class SplashRoute extends _i17.PageRouteInfo<SplashRouteArgs> {
|
|||
|
||||
static const String name = 'SplashRoute';
|
||||
|
||||
static _i17.PageInfo page = _i17.PageInfo(
|
||||
static _i18.PageInfo page = _i18.PageInfo(
|
||||
name,
|
||||
builder: (data) {
|
||||
final args =
|
||||
data.argsAs<SplashRouteArgs>(orElse: () => const SplashRouteArgs());
|
||||
return _i15.SplashScreen(
|
||||
return _i16.SplashScreen(
|
||||
loggedIn: args.loggedIn,
|
||||
key: args.key,
|
||||
);
|
||||
|
|
@ -451,7 +516,7 @@ class SplashRouteArgs {
|
|||
|
||||
final dynamic Function(bool)? loggedIn;
|
||||
|
||||
final _i22.Key? key;
|
||||
final _i24.Key? key;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
|
|
@ -460,12 +525,12 @@ class SplashRouteArgs {
|
|||
}
|
||||
|
||||
/// generated route for
|
||||
/// [_i16.SyncedScreen]
|
||||
class SyncedRoute extends _i17.PageRouteInfo<SyncedRouteArgs> {
|
||||
/// [_i17.SyncedScreen]
|
||||
class SyncedRoute extends _i18.PageRouteInfo<SyncedRouteArgs> {
|
||||
SyncedRoute({
|
||||
_i22.ScrollController? navigationScrollController,
|
||||
_i19.Key? key,
|
||||
List<_i17.PageRouteInfo>? children,
|
||||
_i24.ScrollController? navigationScrollController,
|
||||
_i20.Key? key,
|
||||
List<_i18.PageRouteInfo>? children,
|
||||
}) : super(
|
||||
SyncedRoute.name,
|
||||
args: SyncedRouteArgs(
|
||||
|
|
@ -477,12 +542,12 @@ class SyncedRoute extends _i17.PageRouteInfo<SyncedRouteArgs> {
|
|||
|
||||
static const String name = 'SyncedRoute';
|
||||
|
||||
static _i17.PageInfo page = _i17.PageInfo(
|
||||
static _i18.PageInfo page = _i18.PageInfo(
|
||||
name,
|
||||
builder: (data) {
|
||||
final args =
|
||||
data.argsAs<SyncedRouteArgs>(orElse: () => const SyncedRouteArgs());
|
||||
return _i16.SyncedScreen(
|
||||
return _i17.SyncedScreen(
|
||||
navigationScrollController: args.navigationScrollController,
|
||||
key: args.key,
|
||||
);
|
||||
|
|
@ -496,9 +561,9 @@ class SyncedRouteArgs {
|
|||
this.key,
|
||||
});
|
||||
|
||||
final _i22.ScrollController? navigationScrollController;
|
||||
final _i24.ScrollController? navigationScrollController;
|
||||
|
||||
final _i19.Key? key;
|
||||
final _i20.Key? key;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
|
|
|
|||
|
|
@ -1,12 +1,14 @@
|
|||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:auto_route/auto_route.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
|
||||
import 'package:fladder/models/item_base_model.dart';
|
||||
import 'package:fladder/models/items/photos_model.dart';
|
||||
import 'package:fladder/providers/items/folder_details_provider.dart';
|
||||
import 'package:fladder/screens/photo_viewer/photo_viewer_screen.dart';
|
||||
import 'package:fladder/routes/auto_router.gr.dart';
|
||||
import 'package:fladder/screens/shared/media/poster_grid.dart';
|
||||
import 'package:fladder/widgets/shared/pull_to_refresh.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:page_transition/page_transition.dart';
|
||||
|
||||
class FolderDetailScreen extends ConsumerWidget {
|
||||
final ItemBaseModel item;
|
||||
|
|
@ -33,12 +35,10 @@ class FolderDetailScreen extends ConsumerWidget {
|
|||
switch (item) {
|
||||
case PhotoModel photoModel:
|
||||
final photoItems = details?.items.whereType<PhotoModel>().toList();
|
||||
await Navigator.of(context, rootNavigator: true).push(PageTransition(
|
||||
child: PhotoViewerScreen(
|
||||
items: photoItems,
|
||||
indexOfSelected: photoItems?.indexOf(photoModel) ?? 0,
|
||||
),
|
||||
type: PageTransitionType.fade));
|
||||
await context.navigateTo(PhotoViewerRoute(
|
||||
items: photoItems,
|
||||
selected: photoModel.id,
|
||||
));
|
||||
break;
|
||||
default:
|
||||
if (context.mounted) {
|
||||
|
|
|
|||
|
|
@ -2,13 +2,13 @@ import 'dart:ui';
|
|||
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:auto_route/auto_route.dart';
|
||||
import 'package:collection/collection.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:flutter_staggered_grid_view/flutter_staggered_grid_view.dart';
|
||||
import 'package:flutter_sticky_header/flutter_sticky_header.dart';
|
||||
import 'package:iconsax_plus/iconsax_plus.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:page_transition/page_transition.dart';
|
||||
import 'package:sliver_tools/sliver_tools.dart';
|
||||
|
||||
import 'package:fladder/models/boxset_model.dart';
|
||||
|
|
@ -18,7 +18,7 @@ import 'package:fladder/models/library_search/library_search_options.dart';
|
|||
import 'package:fladder/models/playlist_model.dart';
|
||||
import 'package:fladder/providers/library_search_provider.dart';
|
||||
import 'package:fladder/providers/settings/client_settings_provider.dart';
|
||||
import 'package:fladder/screens/photo_viewer/photo_viewer_screen.dart';
|
||||
import 'package:fladder/routes/auto_router.gr.dart';
|
||||
import 'package:fladder/screens/shared/media/poster_list_item.dart';
|
||||
import 'package:fladder/screens/shared/media/poster_widget.dart';
|
||||
import 'package:fladder/util/adaptive_layout/adaptive_layout.dart';
|
||||
|
|
@ -336,15 +336,11 @@ class LibraryViews extends ConsumerWidget {
|
|||
case PhotoModel _:
|
||||
final photoList = items.whereType<PhotoModel>().toList();
|
||||
if (context.mounted) {
|
||||
await Navigator.of(context, rootNavigator: true).push(
|
||||
PageTransition(
|
||||
child: PhotoViewerScreen(
|
||||
items: photoList,
|
||||
loadingItems: ref.read(librarySearchProvider(key).notifier).fetchGallery(),
|
||||
indexOfSelected: photoList.indexWhere((element) => element.id == item.id),
|
||||
),
|
||||
type: PageTransitionType.fade),
|
||||
);
|
||||
await context.router.push(PhotoViewerRoute(
|
||||
items: photoList,
|
||||
loadingItems: ref.read(librarySearchProvider(key).notifier).fetchGallery(),
|
||||
selected: item.id,
|
||||
));
|
||||
}
|
||||
if (context.mounted) context.refreshData();
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -130,7 +130,9 @@ class _PhotoViewerControllsState extends ConsumerState<PhotoViewerControls> with
|
|||
@override
|
||||
void dispose() {
|
||||
timerController.dispose();
|
||||
fullScreenHelper.closeFullScreen(ref);
|
||||
if (context.mounted) {
|
||||
fullScreenHelper.closeFullScreen(ref);
|
||||
}
|
||||
windowManager.removeListener(this);
|
||||
super.dispose();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,11 +3,12 @@ import 'dart:async';
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
|
||||
import 'package:auto_route/annotations.dart';
|
||||
import 'package:cached_network_image/cached_network_image.dart';
|
||||
import 'package:extended_image/extended_image.dart';
|
||||
import 'package:iconsax_plus/iconsax_plus.dart';
|
||||
import 'package:flutter_blurhash/flutter_blurhash.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:iconsax_plus/iconsax_plus.dart';
|
||||
|
||||
import 'package:fladder/models/item_base_model.dart';
|
||||
import 'package:fladder/models/items/photos_model.dart';
|
||||
|
|
@ -29,13 +30,14 @@ import 'package:fladder/widgets/shared/hover_widget.dart';
|
|||
import 'package:fladder/widgets/shared/item_actions.dart';
|
||||
import 'package:fladder/widgets/shared/modal_bottom_sheet.dart';
|
||||
|
||||
@RoutePage()
|
||||
class PhotoViewerScreen extends ConsumerStatefulWidget {
|
||||
final List<PhotoModel>? items;
|
||||
final int indexOfSelected;
|
||||
final String? selected;
|
||||
final Future<List<PhotoModel>>? loadingItems;
|
||||
const PhotoViewerScreen({
|
||||
this.items,
|
||||
this.indexOfSelected = 0,
|
||||
@QueryParam("selectedId") this.selected,
|
||||
this.loadingItems,
|
||||
super.key,
|
||||
});
|
||||
|
|
@ -46,9 +48,9 @@ class PhotoViewerScreen extends ConsumerStatefulWidget {
|
|||
|
||||
class _PhotoViewerScreenState extends ConsumerState<PhotoViewerScreen> with WidgetsBindingObserver {
|
||||
late List<PhotoModel> photos = widget.items ?? [];
|
||||
late final ExtendedPageController controller = ExtendedPageController(initialPage: widget.indexOfSelected);
|
||||
late int currentPage = photos.indexWhere((value) => value.id == widget.selected).clamp(0, photos.length - 1);
|
||||
late final ExtendedPageController controller = ExtendedPageController(initialPage: currentPage);
|
||||
double currentScale = 1.0;
|
||||
late int currentPage = widget.indexOfSelected.clamp(0, photos.length - 1);
|
||||
bool showInterface = true;
|
||||
bool toolbarHover = false;
|
||||
|
||||
|
|
@ -78,7 +80,7 @@ class _PhotoViewerScreenState extends ConsumerState<PhotoViewerScreen> with Widg
|
|||
WidgetsBinding.instance.addObserver(this);
|
||||
WidgetsBinding.instance.addPostFrameCallback(
|
||||
(timeStamp) async {
|
||||
cacheNeighbors(widget.indexOfSelected, 2);
|
||||
cacheNeighbors(currentPage, 2);
|
||||
if (widget.loadingItems != null) {
|
||||
setState(() {
|
||||
loadingItems = true;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:auto_route/auto_route.dart';
|
||||
import 'package:collection/collection.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
|
||||
|
|
@ -13,8 +14,8 @@ import 'package:fladder/providers/api_provider.dart';
|
|||
import 'package:fladder/providers/book_viewer_provider.dart';
|
||||
import 'package:fladder/providers/items/book_details_provider.dart';
|
||||
import 'package:fladder/providers/video_player_provider.dart';
|
||||
import 'package:fladder/routes/auto_router.gr.dart';
|
||||
import 'package:fladder/screens/book_viewer/book_viewer_screen.dart';
|
||||
import 'package:fladder/screens/photo_viewer/photo_viewer_screen.dart';
|
||||
import 'package:fladder/screens/shared/fladder_snackbar.dart';
|
||||
import 'package:fladder/screens/video_player/video_player.dart';
|
||||
import 'package:fladder/util/adaptive_layout/adaptive_layout.dart';
|
||||
|
|
@ -170,13 +171,10 @@ extension PhotoAlbumExtension on PhotoAlbumModel? {
|
|||
return;
|
||||
}
|
||||
|
||||
await Navigator.of(context, rootNavigator: true).push(
|
||||
MaterialPageRoute(
|
||||
builder: (context) => PhotoViewerScreen(
|
||||
items: photos.toList(),
|
||||
),
|
||||
),
|
||||
);
|
||||
await context.navigateTo(PhotoViewerRoute(
|
||||
items: photos.toList(),
|
||||
));
|
||||
|
||||
if (context.mounted) {
|
||||
await context.refreshData();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue