mirror of
https://github.com/immich-app/immich.git
synced 2025-07-09 03:06:56 -04:00
wip: album collections page
This commit is contained in:
parent
34ea42c005
commit
30a3f827a2
@ -20,6 +20,7 @@ class AlbumsCollectionPage extends HookConsumerWidget {
|
|||||||
final remote = albums.where((a) => a.isRemote).toList();
|
final remote = albums.where((a) => a.isRemote).toList();
|
||||||
final sorted = albumSortOption.sortFn(remote, albumSortIsReverse);
|
final sorted = albumSortOption.sortFn(remote, albumSortIsReverse);
|
||||||
final local = albums.where((a) => a.isLocal).toList();
|
final local = albums.where((a) => a.isLocal).toList();
|
||||||
|
final isGrid = useState(false);
|
||||||
|
|
||||||
useEffect(
|
useEffect(
|
||||||
() {
|
() {
|
||||||
@ -29,98 +30,42 @@ class AlbumsCollectionPage extends HookConsumerWidget {
|
|||||||
[],
|
[],
|
||||||
);
|
);
|
||||||
|
|
||||||
|
toggleViewMode() {
|
||||||
|
isGrid.value = !isGrid.value;
|
||||||
|
}
|
||||||
|
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
title: const Text("Albums"),
|
title: const Text("Albums"),
|
||||||
),
|
),
|
||||||
body: SafeArea(
|
body: ListView(
|
||||||
child: CustomScrollView(
|
shrinkWrap: true,
|
||||||
slivers: [
|
children: [
|
||||||
const SliverToBoxAdapter(
|
Row(
|
||||||
child: Padding(
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
padding: EdgeInsets.only(
|
children: [
|
||||||
top: 12.0,
|
const SortButton(),
|
||||||
left: 12.0,
|
IconButton(
|
||||||
right: 12.0,
|
onPressed: toggleViewMode,
|
||||||
bottom: 20.0,
|
icon: Icon(isGrid.value ? Icons.list : Icons.grid_view),
|
||||||
),
|
|
||||||
child: Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
||||||
children: [
|
|
||||||
SortButton(),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
),
|
],
|
||||||
SliverPadding(
|
),
|
||||||
padding: const EdgeInsets.all(12.0),
|
GridView.count(
|
||||||
sliver: SliverGrid(
|
shrinkWrap: true,
|
||||||
gridDelegate: const SliverGridDelegateWithMaxCrossAxisExtent(
|
physics: const ScrollPhysics(),
|
||||||
maxCrossAxisExtent: 250,
|
crossAxisCount: 2,
|
||||||
mainAxisSpacing: 12,
|
mainAxisSpacing: 32,
|
||||||
crossAxisSpacing: 12,
|
crossAxisSpacing: 32,
|
||||||
childAspectRatio: .7,
|
children: sorted.map((album) {
|
||||||
),
|
return AlbumThumbnailCard(
|
||||||
delegate: SliverChildBuilderDelegate(
|
album: album,
|
||||||
childCount: sorted.length,
|
onTap: () =>
|
||||||
(context, index) {
|
context.pushRoute(AlbumViewerRoute(albumId: album.id)),
|
||||||
return AlbumThumbnailCard(
|
);
|
||||||
album: sorted[index],
|
}).toList(),
|
||||||
onTap: () => context.pushRoute(
|
),
|
||||||
AlbumViewerRoute(
|
],
|
||||||
albumId: sorted[index].id,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
SliverToBoxAdapter(
|
|
||||||
child: Padding(
|
|
||||||
padding: const EdgeInsets.only(
|
|
||||||
top: 12.0,
|
|
||||||
left: 12.0,
|
|
||||||
right: 12.0,
|
|
||||||
bottom: 20.0,
|
|
||||||
),
|
|
||||||
child: Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
'library_page_device_albums',
|
|
||||||
style: context.textTheme.bodyLarge?.copyWith(
|
|
||||||
fontWeight: FontWeight.w500,
|
|
||||||
),
|
|
||||||
).tr(),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
SliverPadding(
|
|
||||||
padding: const EdgeInsets.all(12.0),
|
|
||||||
sliver: SliverGrid(
|
|
||||||
gridDelegate: const SliverGridDelegateWithMaxCrossAxisExtent(
|
|
||||||
maxCrossAxisExtent: 250,
|
|
||||||
mainAxisSpacing: 12,
|
|
||||||
crossAxisSpacing: 12,
|
|
||||||
childAspectRatio: .7,
|
|
||||||
),
|
|
||||||
delegate: SliverChildBuilderDelegate(
|
|
||||||
childCount: local.length,
|
|
||||||
(context, index) => AlbumThumbnailCard(
|
|
||||||
album: local[index],
|
|
||||||
onTap: () => context.pushRoute(
|
|
||||||
AlbumViewerRoute(
|
|
||||||
albumId: local[index].id,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user