mirror of
https://github.com/immich-app/immich.git
synced 2025-07-09 03:06:56 -04:00
Added share partner button
This commit is contained in:
parent
14a5e982e6
commit
c886fcab74
@ -1,13 +1,17 @@
|
|||||||
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';
|
||||||
import 'package:immich_mobile/extensions/build_context_extensions.dart';
|
import 'package:immich_mobile/extensions/build_context_extensions.dart';
|
||||||
|
import 'package:immich_mobile/providers/album/album.provider.dart';
|
||||||
import 'package:immich_mobile/providers/search/people.provider.dart';
|
import 'package:immich_mobile/providers/search/people.provider.dart';
|
||||||
import 'package:immich_mobile/services/api.service.dart';
|
import 'package:immich_mobile/services/api.service.dart';
|
||||||
import 'package:immich_mobile/utils/image_url_builder.dart';
|
import 'package:immich_mobile/utils/image_url_builder.dart';
|
||||||
|
import 'package:immich_mobile/widgets/album/album_thumbnail_card.dart';
|
||||||
import 'package:immich_mobile/widgets/common/immich_app_bar.dart';
|
import 'package:immich_mobile/widgets/common/immich_app_bar.dart';
|
||||||
|
import 'package:immich_mobile/widgets/common/share_partner_button.dart';
|
||||||
|
import 'package:immich_mobile/widgets/map/map_thumbnail.dart';
|
||||||
|
import 'package:maplibre_gl/maplibre_gl.dart';
|
||||||
|
|
||||||
@RoutePage()
|
@RoutePage()
|
||||||
class CollectionsPage extends StatelessWidget {
|
class CollectionsPage extends StatelessWidget {
|
||||||
@ -16,10 +20,11 @@ class CollectionsPage extends StatelessWidget {
|
|||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: const ImmichAppBar(
|
appBar: const ImmichAppBar(
|
||||||
action: CreateNewButton(),
|
showUploadButton: false,
|
||||||
|
actions: [CreateNewButton(), SharePartnerButton()],
|
||||||
),
|
),
|
||||||
body: Padding(
|
body: Padding(
|
||||||
padding: const EdgeInsets.all(8.0),
|
padding: const EdgeInsets.symmetric(vertical: 8.0, horizontal: 16),
|
||||||
child: ListView(
|
child: ListView(
|
||||||
shrinkWrap: true,
|
shrinkWrap: true,
|
||||||
children: [
|
children: [
|
||||||
@ -33,8 +38,8 @@ class CollectionsPage extends StatelessWidget {
|
|||||||
const SizedBox(width: 8),
|
const SizedBox(width: 8),
|
||||||
ActionButton(
|
ActionButton(
|
||||||
onPressed: () {},
|
onPressed: () {},
|
||||||
icon: Icons.delete_outline_rounded,
|
icon: Icons.archive_outlined,
|
||||||
label: 'Trash',
|
label: 'Archive',
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
@ -49,18 +54,22 @@ class CollectionsPage extends StatelessWidget {
|
|||||||
const SizedBox(width: 8),
|
const SizedBox(width: 8),
|
||||||
ActionButton(
|
ActionButton(
|
||||||
onPressed: () {},
|
onPressed: () {},
|
||||||
icon: Icons.archive_outlined,
|
icon: Icons.delete_outline_rounded,
|
||||||
label: 'Archive',
|
label: 'Trash',
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
const SizedBox(height: 16),
|
const SizedBox(height: 24),
|
||||||
const Row(
|
const Wrap(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
spacing: 8,
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
runSpacing: 16,
|
||||||
children: [
|
children: [
|
||||||
PeopleCollectionCard(),
|
PeopleCollectionCard(),
|
||||||
AlbumsCollectionCard(),
|
AlbumsCollectionCard(),
|
||||||
|
AlbumsCollectionCard(
|
||||||
|
isLocal: true,
|
||||||
|
),
|
||||||
|
PlacesCollectionCard(),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@ -81,22 +90,17 @@ class PeopleCollectionCard extends ConsumerWidget {
|
|||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Container(
|
Container(
|
||||||
height: MediaQuery.of(context).size.width * 0.5,
|
height: MediaQuery.of(context).size.width * 0.5 - 20,
|
||||||
width: MediaQuery.of(context).size.width * 0.5 - 12,
|
width: MediaQuery.of(context).size.width * 0.5 - 20,
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
borderRadius: BorderRadius.circular(20),
|
borderRadius: BorderRadius.circular(20),
|
||||||
color: context.colorScheme.surfaceContainer,
|
color: context.colorScheme.secondaryContainer.withAlpha(100),
|
||||||
),
|
),
|
||||||
child: people.widgetWhen(
|
child: people.widgetWhen(
|
||||||
onData: (people) {
|
onData: (people) {
|
||||||
return GridView.count(
|
return GridView.count(
|
||||||
crossAxisCount: 2,
|
crossAxisCount: 2,
|
||||||
padding: const EdgeInsets.only(
|
padding: const EdgeInsets.all(12),
|
||||||
top: 18,
|
|
||||||
left: 12,
|
|
||||||
right: 12,
|
|
||||||
bottom: 0,
|
|
||||||
),
|
|
||||||
crossAxisSpacing: 8,
|
crossAxisSpacing: 8,
|
||||||
mainAxisSpacing: 8,
|
mainAxisSpacing: 8,
|
||||||
physics: const NeverScrollableScrollPhysics(),
|
physics: const NeverScrollableScrollPhysics(),
|
||||||
@ -121,20 +125,85 @@ class PeopleCollectionCard extends ConsumerWidget {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class AlbumsCollectionCard extends StatelessWidget {
|
class AlbumsCollectionCard extends ConsumerWidget {
|
||||||
const AlbumsCollectionCard({super.key});
|
final bool isLocal;
|
||||||
|
|
||||||
|
const AlbumsCollectionCard({super.key, this.isLocal = false});
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context, WidgetRef ref) {
|
||||||
|
final albums = isLocal
|
||||||
|
? ref.watch(albumProvider).where((album) => album.isLocal)
|
||||||
|
: ref.watch(albumProvider).where((album) => album.isRemote);
|
||||||
|
|
||||||
|
return Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
height: MediaQuery.of(context).size.width * 0.5 - 20,
|
||||||
|
width: MediaQuery.of(context).size.width * 0.5 - 20,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
borderRadius: BorderRadius.circular(20),
|
||||||
|
color: context.colorScheme.secondaryContainer.withAlpha(100),
|
||||||
|
),
|
||||||
|
child: GridView.count(
|
||||||
|
crossAxisCount: 2,
|
||||||
|
padding: const EdgeInsets.all(12),
|
||||||
|
crossAxisSpacing: 8,
|
||||||
|
mainAxisSpacing: 8,
|
||||||
|
physics: const NeverScrollableScrollPhysics(),
|
||||||
|
children: albums.take(4).map((album) {
|
||||||
|
return AlbumThumbnailCard(
|
||||||
|
album: album,
|
||||||
|
showTitle: false,
|
||||||
|
);
|
||||||
|
}).toList(),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.all(8.0),
|
||||||
|
child: Text(
|
||||||
|
isLocal ? 'On this device' : 'Albums',
|
||||||
|
style: context.textTheme.labelLarge,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class PlacesCollectionCard extends StatelessWidget {
|
||||||
|
const PlacesCollectionCard({super.key});
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Container(
|
final size = MediaQuery.of(context).size.width * 0.5 - 20;
|
||||||
height: MediaQuery.of(context).size.width * 0.5,
|
return Column(
|
||||||
width: MediaQuery.of(context).size.width * 0.5 - 12,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
decoration: BoxDecoration(
|
children: [
|
||||||
borderRadius: BorderRadius.circular(20),
|
Container(
|
||||||
color: context.colorScheme.surfaceContainer,
|
height: size,
|
||||||
),
|
width: size,
|
||||||
child: const Center(
|
decoration: BoxDecoration(
|
||||||
child: Text('Album Collection'),
|
borderRadius: BorderRadius.circular(20),
|
||||||
),
|
color: context.colorScheme.secondaryContainer.withAlpha(100),
|
||||||
|
),
|
||||||
|
child: IgnorePointer(
|
||||||
|
child: MapThumbnail(
|
||||||
|
zoom: 5,
|
||||||
|
centre: const LatLng(
|
||||||
|
47,
|
||||||
|
5,
|
||||||
|
),
|
||||||
|
showAttribution: false,
|
||||||
|
themeMode: context.isDarkTheme ? ThemeMode.dark : ThemeMode.light,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.all(8.0),
|
||||||
|
child: Text('Places', style: context.textTheme.labelLarge),
|
||||||
|
),
|
||||||
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -157,21 +226,26 @@ class ActionButton extends StatelessWidget {
|
|||||||
child: FilledButton.icon(
|
child: FilledButton.icon(
|
||||||
onPressed: onPressed,
|
onPressed: onPressed,
|
||||||
label: Padding(
|
label: Padding(
|
||||||
padding: const EdgeInsets.only(left: 8.0),
|
padding: const EdgeInsets.only(left: 4.0),
|
||||||
child: Text(
|
child: Text(
|
||||||
label,
|
label,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: context.colorScheme.onSurface,
|
color: context.colorScheme.onSurface,
|
||||||
|
fontSize: 14,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
style: FilledButton.styleFrom(
|
style: FilledButton.styleFrom(
|
||||||
elevation: 0,
|
elevation: 0,
|
||||||
padding: const EdgeInsets.all(16),
|
padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 16),
|
||||||
backgroundColor: context.colorScheme.primary.withAlpha(20),
|
backgroundColor: context.colorScheme.surfaceContainerLow,
|
||||||
alignment: Alignment.centerLeft,
|
alignment: Alignment.centerLeft,
|
||||||
shape: const RoundedRectangleBorder(
|
shape: RoundedRectangleBorder(
|
||||||
borderRadius: BorderRadius.all(Radius.circular(20)),
|
borderRadius: const BorderRadius.all(Radius.circular(25)),
|
||||||
|
side: BorderSide(
|
||||||
|
color: context.colorScheme.onSurface.withAlpha(10),
|
||||||
|
width: 1,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
icon: Icon(
|
icon: Icon(
|
||||||
@ -190,10 +264,9 @@ class CreateNewButton extends StatelessWidget {
|
|||||||
return InkWell(
|
return InkWell(
|
||||||
onTap: () {},
|
onTap: () {},
|
||||||
borderRadius: const BorderRadius.all(Radius.circular(25)),
|
borderRadius: const BorderRadius.all(Radius.circular(25)),
|
||||||
child: Icon(
|
child: const Icon(
|
||||||
Icons.add,
|
Icons.add,
|
||||||
size: 32,
|
size: 32,
|
||||||
semanticLabel: 'profile_drawer_trash'.tr(),
|
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -184,7 +184,7 @@ class LibraryPage extends HookConsumerWidget {
|
|||||||
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();
|
||||||
|
|
||||||
Widget? shareTrashButton() {
|
Widget shareTrashButton() {
|
||||||
return trashEnabled
|
return trashEnabled
|
||||||
? InkWell(
|
? InkWell(
|
||||||
onTap: () => context.pushRoute(const TrashRoute()),
|
onTap: () => context.pushRoute(const TrashRoute()),
|
||||||
@ -195,12 +195,12 @@ class LibraryPage extends HookConsumerWidget {
|
|||||||
semanticLabel: 'profile_drawer_trash'.tr(),
|
semanticLabel: 'profile_drawer_trash'.tr(),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
: null;
|
: const SizedBox.shrink();
|
||||||
}
|
}
|
||||||
|
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: ImmichAppBar(
|
appBar: ImmichAppBar(
|
||||||
action: shareTrashButton(),
|
actions: [shareTrashButton()],
|
||||||
),
|
),
|
||||||
body: CustomScrollView(
|
body: CustomScrollView(
|
||||||
slivers: [
|
slivers: [
|
||||||
|
@ -9,6 +9,7 @@ import 'package:immich_mobile/providers/album/album_sort_by_options.provider.dar
|
|||||||
import 'package:immich_mobile/providers/album/shared_album.provider.dart';
|
import 'package:immich_mobile/providers/album/shared_album.provider.dart';
|
||||||
import 'package:immich_mobile/widgets/album/album_thumbnail_card.dart';
|
import 'package:immich_mobile/widgets/album/album_thumbnail_card.dart';
|
||||||
import 'package:immich_mobile/providers/partner.provider.dart';
|
import 'package:immich_mobile/providers/partner.provider.dart';
|
||||||
|
import 'package:immich_mobile/widgets/common/share_partner_button.dart';
|
||||||
import 'package:immich_mobile/widgets/partner/partner_list.dart';
|
import 'package:immich_mobile/widgets/partner/partner_list.dart';
|
||||||
import 'package:immich_mobile/routing/router.dart';
|
import 'package:immich_mobile/routing/router.dart';
|
||||||
import 'package:immich_mobile/providers/user.provider.dart';
|
import 'package:immich_mobile/providers/user.provider.dart';
|
||||||
@ -215,25 +216,13 @@ class SharingPage extends HookConsumerWidget {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget sharePartnerButton() {
|
|
||||||
return InkWell(
|
|
||||||
onTap: () => context.pushRoute(const PartnerRoute()),
|
|
||||||
borderRadius: const BorderRadius.all(Radius.circular(12)),
|
|
||||||
child: Icon(
|
|
||||||
Icons.swap_horizontal_circle_rounded,
|
|
||||||
size: 25,
|
|
||||||
semanticLabel: 'partner_page_title'.tr(),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
return RefreshIndicator(
|
return RefreshIndicator(
|
||||||
onRefresh: () async {
|
onRefresh: () async {
|
||||||
ref.read(sharedAlbumProvider.notifier).getAllSharedAlbums();
|
ref.read(sharedAlbumProvider.notifier).getAllSharedAlbums();
|
||||||
},
|
},
|
||||||
child: Scaffold(
|
child: Scaffold(
|
||||||
appBar: ImmichAppBar(
|
appBar: const ImmichAppBar(
|
||||||
action: sharePartnerButton(),
|
actions: [SharePartnerButton()],
|
||||||
),
|
),
|
||||||
body: CustomScrollView(
|
body: CustomScrollView(
|
||||||
slivers: [
|
slivers: [
|
||||||
|
@ -12,12 +12,14 @@ class AlbumThumbnailCard extends StatelessWidget {
|
|||||||
/// Whether or not to show the owner of the album (or "Owned")
|
/// Whether or not to show the owner of the album (or "Owned")
|
||||||
/// in the subtitle of the album
|
/// in the subtitle of the album
|
||||||
final bool showOwner;
|
final bool showOwner;
|
||||||
|
final bool showTitle;
|
||||||
|
|
||||||
const AlbumThumbnailCard({
|
const AlbumThumbnailCard({
|
||||||
super.key,
|
super.key,
|
||||||
required this.album,
|
required this.album,
|
||||||
this.onTap,
|
this.onTap,
|
||||||
this.showOwner = false,
|
this.showOwner = false,
|
||||||
|
this.showTitle = true,
|
||||||
});
|
});
|
||||||
|
|
||||||
final Album album;
|
final Album album;
|
||||||
@ -102,21 +104,23 @@ class AlbumThumbnailCard extends StatelessWidget {
|
|||||||
: buildAlbumThumbnail(),
|
: buildAlbumThumbnail(),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Padding(
|
if (showTitle) ...[
|
||||||
padding: const EdgeInsets.only(top: 8.0),
|
Padding(
|
||||||
child: SizedBox(
|
padding: const EdgeInsets.only(top: 8.0),
|
||||||
width: cardSize,
|
child: SizedBox(
|
||||||
child: Text(
|
width: cardSize,
|
||||||
album.name,
|
child: Text(
|
||||||
overflow: TextOverflow.ellipsis,
|
album.name,
|
||||||
style: context.textTheme.bodyMedium?.copyWith(
|
overflow: TextOverflow.ellipsis,
|
||||||
color: context.colorScheme.onSurface,
|
style: context.textTheme.bodyMedium?.copyWith(
|
||||||
fontWeight: FontWeight.w500,
|
color: context.colorScheme.onSurface,
|
||||||
|
fontWeight: FontWeight.w500,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
buildAlbumTextRow(),
|
||||||
buildAlbumTextRow(),
|
],
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@ -18,9 +18,10 @@ import 'package:immich_mobile/providers/server_info.provider.dart';
|
|||||||
class ImmichAppBar extends ConsumerWidget implements PreferredSizeWidget {
|
class ImmichAppBar extends ConsumerWidget implements PreferredSizeWidget {
|
||||||
@override
|
@override
|
||||||
Size get preferredSize => const Size.fromHeight(kToolbarHeight);
|
Size get preferredSize => const Size.fromHeight(kToolbarHeight);
|
||||||
final Widget? action;
|
final List<Widget>? actions;
|
||||||
|
final bool showUploadButton;
|
||||||
|
|
||||||
const ImmichAppBar({super.key, this.action});
|
const ImmichAppBar({super.key, this.actions, this.showUploadButton = true});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context, WidgetRef ref) {
|
Widget build(BuildContext context, WidgetRef ref) {
|
||||||
@ -184,12 +185,18 @@ class ImmichAppBar extends ConsumerWidget implements PreferredSizeWidget {
|
|||||||
},
|
},
|
||||||
),
|
),
|
||||||
actions: [
|
actions: [
|
||||||
if (action != null)
|
if (actions != null)
|
||||||
Padding(padding: const EdgeInsets.only(right: 16), child: action!),
|
...actions!.map(
|
||||||
Padding(
|
(action) => Padding(
|
||||||
padding: const EdgeInsets.only(right: 20),
|
padding: const EdgeInsets.only(right: 16),
|
||||||
child: buildBackupIndicator(),
|
child: action,
|
||||||
),
|
),
|
||||||
|
),
|
||||||
|
if (showUploadButton)
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.only(right: 20),
|
||||||
|
child: buildBackupIndicator(),
|
||||||
|
),
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.only(right: 20),
|
padding: const EdgeInsets.only(right: 20),
|
||||||
child: buildProfileIndicator(),
|
child: buildProfileIndicator(),
|
||||||
|
21
mobile/lib/widgets/common/share_partner_button.dart
Normal file
21
mobile/lib/widgets/common/share_partner_button.dart
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
import 'package:auto_route/auto_route.dart';
|
||||||
|
import 'package:easy_localization/easy_localization.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:immich_mobile/routing/router.dart';
|
||||||
|
|
||||||
|
class SharePartnerButton extends StatelessWidget {
|
||||||
|
const SharePartnerButton({super.key});
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return InkWell(
|
||||||
|
onTap: () => context.pushRoute(const PartnerRoute()),
|
||||||
|
borderRadius: const BorderRadius.all(Radius.circular(12)),
|
||||||
|
child: Icon(
|
||||||
|
Icons.swap_horizontal_circle_rounded,
|
||||||
|
size: 25,
|
||||||
|
semanticLabel: 'partner_page_title'.tr(),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
@ -13,6 +13,7 @@ class SearchMapThumbnail extends StatelessWidget {
|
|||||||
});
|
});
|
||||||
|
|
||||||
final double size;
|
final double size;
|
||||||
|
final bool showTitle = true;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user