local albums

This commit is contained in:
Alex 2024-09-08 14:41:00 -05:00
parent f73deae77c
commit bb50ccb1ca
No known key found for this signature in database
GPG Key ID: 53CD082B3A5E1082
5 changed files with 78 additions and 18 deletions

View File

@ -1,4 +1,14 @@
{ {
"collections": "Collections",
"on_this_device": "On this device",
"places": "Places",
"albums": "Albums",
"people": "People",
"shared_links": "Shared links",
"trash": "Trash",
"archived": "Archived",
"favorites": "Favorites",
"search_albums": "Search albums",
"action_common_back": "Back", "action_common_back": "Back",
"action_common_cancel": "Cancel", "action_common_cancel": "Cancel",
"action_common_clear": "Clear", "action_common_clear": "Clear",
@ -589,4 +599,4 @@
"viewer_remove_from_stack": "Remove from Stack", "viewer_remove_from_stack": "Remove from Stack",
"viewer_stack_use_as_main_asset": "Use as Main Asset", "viewer_stack_use_as_main_asset": "Use as Main Asset",
"viewer_unstack": "Un-Stack" "viewer_unstack": "Un-Stack"
} }

View File

@ -83,7 +83,7 @@ class AlbumsCollectionPage extends HookConsumerWidget {
context.colorScheme.surfaceContainer, context.colorScheme.surfaceContainer,
), ),
autoFocus: false, autoFocus: false,
hintText: "Search albums", hintText: "search_albums".tr(),
onChanged: onSearch, onChanged: onSearch,
elevation: const WidgetStatePropertyAll(0.25), elevation: const WidgetStatePropertyAll(0.25),
controller: searchController, controller: searchController,
@ -96,7 +96,7 @@ class AlbumsCollectionPage extends HookConsumerWidget {
borderRadius: BorderRadius.circular(20), borderRadius: BorderRadius.circular(20),
side: BorderSide( side: BorderSide(
color: context.colorScheme.onSurface.withAlpha(10), color: context.colorScheme.onSurface.withAlpha(10),
width: 1, width: 0.5,
), ),
), ),
), ),
@ -127,7 +127,6 @@ class AlbumsCollectionPage extends HookConsumerWidget {
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
const SortButton(), const SortButton(),
const SizedBox(width: 10),
IconButton( IconButton(
icon: Icon( icon: Icon(
isGrid.value isGrid.value
@ -175,7 +174,6 @@ class AlbumsCollectionPage extends HookConsumerWidget {
title: Text( title: Text(
sorted[index].name, sorted[index].name,
style: context.textTheme.titleSmall?.copyWith( style: context.textTheme.titleSmall?.copyWith(
// fontSize: 16,
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
), ),
), ),

View File

@ -1,18 +1,54 @@
import 'package:auto_route/auto_route.dart'; import 'package:auto_route/auto_route.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart'; import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'package:immich_mobile/extensions/build_context_extensions.dart';
import 'package:immich_mobile/providers/album/albumv2.provider.dart';
import 'package:immich_mobile/routing/router.dart';
import 'package:immich_mobile/widgets/common/immich_thumbnail.dart';
@RoutePage() @RoutePage()
class LocalAlbumsCollectionPage extends HookConsumerWidget { class LocalAlbumsCollectionPage extends HookConsumerWidget {
const LocalAlbumsCollectionPage({super.key}); const LocalAlbumsCollectionPage({super.key});
@override @override
Widget build(BuildContext context, WidgetRef ref) { Widget build(BuildContext context, WidgetRef ref) {
final albums = ref.watch(localAlbumsProvider);
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
title: const Text('on_this_device'), title: Text('on_this_device'.tr()),
), ),
body: const Center( body: ListView.builder(
child: Text('on_this_device_content'), padding: const EdgeInsets.all(18.0),
itemCount: albums.length,
itemBuilder: (context, index) {
return Padding(
padding: const EdgeInsets.only(bottom: 8.0),
child: ListTile(
contentPadding: const EdgeInsets.all(0),
dense: false,
visualDensity: VisualDensity.comfortable,
leading: ClipRRect(
borderRadius: const BorderRadius.all(Radius.circular(15)),
child: ImmichThumbnail(
asset: albums[index].thumbnail.value,
width: 60,
height: 90,
),
),
minVerticalPadding: 1,
title: Text(
albums[index].name,
style: context.textTheme.titleSmall?.copyWith(
fontWeight: FontWeight.w600,
),
),
subtitle: Text('${albums[index].assetCount} items'),
onTap: () => context
.pushRoute(AlbumViewerRoute(albumId: albums[index].id)),
),
);
},
), ),
); );
} }

View File

@ -1,4 +1,5 @@
import 'package:auto_route/auto_route.dart'; import 'package:auto_route/auto_route.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart'; import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'package:immich_mobile/extensions/asyncvalue_extensions.dart'; import 'package:immich_mobile/extensions/asyncvalue_extensions.dart';
@ -38,13 +39,13 @@ class CollectionsPage extends ConsumerWidget {
ActionButton( ActionButton(
onPressed: () => context.pushRoute(const FavoritesRoute()), onPressed: () => context.pushRoute(const FavoritesRoute()),
icon: Icons.favorite_outline_rounded, icon: Icons.favorite_outline_rounded,
label: 'Favorite', label: 'favorites'.tr(),
), ),
const SizedBox(width: 8), const SizedBox(width: 8),
ActionButton( ActionButton(
onPressed: () => context.pushRoute(const ArchiveRoute()), onPressed: () => context.pushRoute(const ArchiveRoute()),
icon: Icons.archive_outlined, icon: Icons.archive_outlined,
label: 'Archive', label: 'archived'.tr(),
), ),
], ],
), ),
@ -54,14 +55,14 @@ class CollectionsPage extends ConsumerWidget {
ActionButton( ActionButton(
onPressed: () => context.pushRoute(const SharedLinkRoute()), onPressed: () => context.pushRoute(const SharedLinkRoute()),
icon: Icons.link_outlined, icon: Icons.link_outlined,
label: 'Shared links', label: 'shared_links'.tr(),
), ),
const SizedBox(width: 8), const SizedBox(width: 8),
trashEnabled trashEnabled
? ActionButton( ? ActionButton(
onPressed: () => context.pushRoute(const TrashRoute()), onPressed: () => context.pushRoute(const TrashRoute()),
icon: Icons.delete_outline_rounded, icon: Icons.delete_outline_rounded,
label: 'Trash', label: 'trash'.tr(),
) )
: const SizedBox.shrink(), : const SizedBox.shrink(),
], ],
@ -125,7 +126,13 @@ class PeopleCollectionCard extends ConsumerWidget {
), ),
Padding( Padding(
padding: const EdgeInsets.all(8.0), padding: const EdgeInsets.all(8.0),
child: Text('People', style: context.textTheme.labelLarge), child: Text(
'people'.tr(),
style: context.textTheme.titleSmall?.copyWith(
color: context.colorScheme.onSurface,
fontWeight: FontWeight.w500,
),
),
), ),
], ],
), ),
@ -179,8 +186,11 @@ class AlbumsCollectionCard extends HookConsumerWidget {
Padding( Padding(
padding: const EdgeInsets.all(8.0), padding: const EdgeInsets.all(8.0),
child: Text( child: Text(
isLocal ? 'On this device' : 'Albums', isLocal ? 'on_this_device'.tr() : 'albums'.tr(),
style: context.textTheme.labelLarge, style: context.textTheme.titleSmall?.copyWith(
color: context.colorScheme.onSurface,
fontWeight: FontWeight.w500,
),
), ),
), ),
], ],
@ -221,7 +231,13 @@ class PlacesCollectionCard extends StatelessWidget {
), ),
Padding( Padding(
padding: const EdgeInsets.all(8.0), padding: const EdgeInsets.all(8.0),
child: Text('Places', style: context.textTheme.labelLarge), child: Text(
'places'.tr(),
style: context.textTheme.titleSmall?.copyWith(
color: context.colorScheme.onSurface,
fontWeight: FontWeight.w500,
),
),
), ),
], ],
), ),

View File

@ -98,7 +98,7 @@ class TabControllerPage extends HookConsumerWidget {
padding: const EdgeInsets.all(4), padding: const EdgeInsets.all(4),
icon: const Icon(Icons.photo_album_outlined), icon: const Icon(Icons.photo_album_outlined),
selectedIcon: const Icon(Icons.photo_album), selectedIcon: const Icon(Icons.photo_album),
label: const Text('Collections').tr(), label: const Text('collections').tr(),
), ),
], ],
); );
@ -163,7 +163,7 @@ class TabControllerPage extends HookConsumerWidget {
// ), // ),
// ), // ),
NavigationDestination( NavigationDestination(
label: 'Collections'.tr(), label: 'collections'.tr(),
icon: const Icon( icon: const Icon(
Icons.photo_album_outlined, Icons.photo_album_outlined,
), ),