mirror of
https://github.com/immich-app/immich.git
synced 2024-12-21 01:39:59 +02:00
501b96baf7
* Added placeholder for search explore * refactor immich asset grid to use ref and provider * all videos page * got favorites, recently added, videos, and motion videos all using the immich grid * Fixed issue with hero animations * theming * localization * delete empty file * style text * Styling icons * more styling --------- Co-authored-by: Alex Tran <alex.tran1502@gmail.com>
68 lines
1.8 KiB
Dart
68 lines
1.8 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:immich_mobile/modules/search/models/curated_content.dart';
|
|
import 'package:immich_mobile/modules/search/ui/thumbnail_with_info.dart';
|
|
import 'package:immich_mobile/shared/models/store.dart';
|
|
|
|
class CuratedRow extends StatelessWidget {
|
|
final List<CuratedContent> content;
|
|
final double imageSize;
|
|
|
|
/// Callback with the content and the index when tapped
|
|
final Function(CuratedContent, 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)}/asset/thumbnail/${object.id}';
|
|
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,
|
|
);
|
|
}
|
|
}
|