mirror of
https://github.com/KevinMidboe/immich.git
synced 2025-10-29 17:40:28 +00:00
Enable swiping between assets (#381)
Enable swiping between assets (#381) Co-authored-by: Alex <alex.tran1502@gmail.com> Co-authored-by: Malte Kiefer <59220985+MalteKiefer@users.noreply.github.com> Co-authored-by: Matthias Rupp <matthias.rupp@posteo.de>
This commit is contained in:
committed by
GitHub
parent
e8d1f89a47
commit
8c184dc4d4
@@ -20,7 +20,9 @@ class AlbumNotifier extends StateNotifier<List<AlbumResponseDto>> {
|
||||
}
|
||||
|
||||
Future<AlbumResponseDto?> createAlbum(
|
||||
String albumTitle, Set<AssetResponseDto> assets) async {
|
||||
String albumTitle,
|
||||
Set<AssetResponseDto> assets,
|
||||
) async {
|
||||
AlbumResponseDto? album =
|
||||
await _albumService.createAlbum(albumTitle, assets, []);
|
||||
|
||||
|
||||
@@ -12,8 +12,13 @@ import 'package:openapi/api.dart';
|
||||
|
||||
class AlbumViewerThumbnail extends HookConsumerWidget {
|
||||
final AssetResponseDto asset;
|
||||
final List<AssetResponseDto> assetList;
|
||||
|
||||
const AlbumViewerThumbnail({Key? key, required this.asset}) : super(key: key);
|
||||
const AlbumViewerThumbnail({
|
||||
Key? key,
|
||||
required this.asset,
|
||||
required this.assetList,
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
@@ -28,25 +33,13 @@ class AlbumViewerThumbnail extends HookConsumerWidget {
|
||||
ref.watch(assetSelectionProvider).isMultiselectEnable;
|
||||
|
||||
_viewAsset() {
|
||||
if (asset.type == AssetTypeEnum.IMAGE) {
|
||||
AutoRouter.of(context).push(
|
||||
ImageViewerRoute(
|
||||
imageUrl:
|
||||
'${box.get(serverEndpointKey)}/asset/file?aid=${asset.deviceAssetId}&did=${asset.deviceId}&isThumb=false',
|
||||
heroTag: asset.id,
|
||||
thumbnailUrl: thumbnailRequestUrl,
|
||||
asset: asset,
|
||||
),
|
||||
);
|
||||
} else {
|
||||
AutoRouter.of(context).push(
|
||||
VideoViewerRoute(
|
||||
videoUrl:
|
||||
'${box.get(serverEndpointKey)}/asset/file?aid=${asset.deviceAssetId}&did=${asset.deviceId}',
|
||||
asset: asset,
|
||||
),
|
||||
);
|
||||
}
|
||||
AutoRouter.of(context).push(
|
||||
GalleryViewerRoute(
|
||||
asset: asset,
|
||||
assetList: assetList,
|
||||
thumbnailRequestUrl: thumbnailRequestUrl,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
BoxBorder drawBorderColor() {
|
||||
|
||||
@@ -29,9 +29,7 @@ class AlbumViewerPage extends HookConsumerWidget {
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
FocusNode titleFocusNode = useFocusNode();
|
||||
ScrollController scrollController = useScrollController();
|
||||
|
||||
AsyncValue<AlbumResponseDto?> albumInfo =
|
||||
ref.watch(sharedAlbumDetailProvider(albumId));
|
||||
var albumInfo = ref.watch(sharedAlbumDetailProvider(albumId));
|
||||
|
||||
final userId = ref.watch(authenticationProvider).userId;
|
||||
|
||||
@@ -200,7 +198,10 @@ class AlbumViewerPage extends HookConsumerWidget {
|
||||
),
|
||||
delegate: SliverChildBuilderDelegate(
|
||||
(BuildContext context, int index) {
|
||||
return AlbumViewerThumbnail(asset: albumInfo.assets[index]);
|
||||
return AlbumViewerThumbnail(
|
||||
asset: albumInfo.assets[index],
|
||||
assetList: albumInfo.assets,
|
||||
);
|
||||
},
|
||||
childCount: albumInfo.assets.length,
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user