mirror of
https://github.com/immich-app/immich.git
synced 2025-01-08 12:56:48 +01:00
69d2fcb43e
* refactor: asset media endpoints * refactor: mobile upload livePhoto as separate request * refactor: change mobile backup flow to use new asset upload endpoints * chore: format and analyze dart code * feat: mark motion as hidden when linked * feat: upload video portion of live photo before image portion * fix: incorrect assetApi calls in mobile code * fix: download asset --------- Co-authored-by: shenlong-tanwen <139912620+shalong-tanwen@users.noreply.github.com> Co-authored-by: Zack Pollard <zackpollard@ymail.com>
66 lines
1.8 KiB
Dart
66 lines
1.8 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:immich_mobile/models/search/search_curated_content.model.dart';
|
|
import 'package:immich_mobile/widgets/search/thumbnail_with_info.dart';
|
|
import 'package:immich_mobile/entities/store.entity.dart';
|
|
|
|
class CuratedRow extends StatelessWidget {
|
|
final List<SearchCuratedContent> content;
|
|
final double imageSize;
|
|
|
|
/// Callback with the content and the index when tapped
|
|
final Function(SearchCuratedContent, int)? onTap;
|
|
|
|
const CuratedRow({
|
|
super.key,
|
|
required this.content,
|
|
this.imageSize = 200,
|
|
this.onTap,
|
|
});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
// Guard empty [content]
|
|
if (content.isEmpty) {
|
|
// Return empty thumbnail
|
|
return Align(
|
|
alignment: Alignment.centerLeft,
|
|
child: Padding(
|
|
padding: const EdgeInsets.symmetric(horizontal: 16.0),
|
|
child: SizedBox(
|
|
width: imageSize,
|
|
height: imageSize,
|
|
child: ThumbnailWithInfo(
|
|
textInfo: '',
|
|
onTap: () {},
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
|
|
return ListView.builder(
|
|
scrollDirection: Axis.horizontal,
|
|
padding: const EdgeInsets.symmetric(
|
|
horizontal: 16,
|
|
),
|
|
itemBuilder: (context, index) {
|
|
final object = content[index];
|
|
final thumbnailRequestUrl =
|
|
'${Store.get(StoreKey.serverEndpoint)}/assets/${object.id}/thumbnail';
|
|
return SizedBox(
|
|
width: imageSize,
|
|
height: imageSize,
|
|
child: Padding(
|
|
padding: const EdgeInsets.only(right: 4.0),
|
|
child: ThumbnailWithInfo(
|
|
imageUrl: thumbnailRequestUrl,
|
|
textInfo: object.label,
|
|
onTap: () => onTap?.call(object, index),
|
|
),
|
|
),
|
|
);
|
|
},
|
|
itemCount: content.length,
|
|
);
|
|
}
|
|
}
|