chore: bump dart sdk to 3.8 (#20355)

* chore: bump dart sdk to 3.8

* chore: make build

* make pigeon

* chore: format files

---------

Co-authored-by: shenlong-tanwen <139912620+shalong-tanwen@users.noreply.github.com>
This commit is contained in:
shenlong
2025-07-29 00:34:03 +05:30
committed by GitHub
parent 9b3718120b
commit e52b9d15b5
643 changed files with 32561 additions and 35292 deletions

View File

@@ -16,15 +16,10 @@ class ArchivePage extends HookConsumerWidget {
final archiveRenderList = ref.watch(archiveTimelineProvider);
final count = archiveRenderList.value?.totalAssets.toString() ?? "?";
return AppBar(
leading: IconButton(
onPressed: () => context.maybePop(),
icon: const Icon(Icons.arrow_back_ios_rounded),
),
leading: IconButton(onPressed: () => context.maybePop(), icon: const Icon(Icons.arrow_back_ios_rounded)),
centerTitle: true,
automaticallyImplyLeading: false,
title: const Text(
'archive_page_title',
).tr(namedArgs: {'count': count}),
title: const Text('archive_page_title').tr(namedArgs: {'count': count}),
);
}

View File

@@ -14,15 +14,10 @@ class FavoritesPage extends HookConsumerWidget {
Widget build(BuildContext context, WidgetRef ref) {
AppBar buildAppBar() {
return AppBar(
leading: IconButton(
onPressed: () => context.maybePop(),
icon: const Icon(Icons.arrow_back_ios_rounded),
),
leading: IconButton(onPressed: () => context.maybePop(), icon: const Icon(Icons.arrow_back_ios_rounded)),
centerTitle: true,
automaticallyImplyLeading: false,
title: const Text(
'favorites',
).tr(),
title: const Text('favorites').tr(),
);
}

View File

@@ -16,10 +16,7 @@ import 'package:immich_mobile/utils/bytes_units.dart';
import 'package:immich_mobile/widgets/asset_grid/thumbnail_image.dart';
import 'package:immich_mobile/widgets/common/immich_toast.dart';
RecursiveFolder? _findFolderInStructure(
RootFolder rootFolder,
RecursiveFolder targetFolder,
) {
RecursiveFolder? _findFolderInStructure(RootFolder rootFolder, RecursiveFolder targetFolder) {
for (final folder in rootFolder.subfolders) {
if (targetFolder.path == '/' && folder.path.isEmpty && folder.name == targetFolder.name) {
return folder;
@@ -49,29 +46,23 @@ class FolderPage extends HookConsumerWidget {
final currentFolder = useState<RecursiveFolder?>(folder);
final sortOrder = useState<SortOrder>(SortOrder.asc);
useEffect(
() {
if (folder == null) {
ref.read(folderStructureProvider.notifier).fetchFolders(sortOrder.value);
}
return null;
},
[],
);
useEffect(() {
if (folder == null) {
ref.read(folderStructureProvider.notifier).fetchFolders(sortOrder.value);
}
return null;
}, []);
// Update current folder when root structure changes
useEffect(
() {
if (folder != null && folderState.hasValue) {
final updatedFolder = _findFolderInStructure(folderState.value!, folder!);
if (updatedFolder != null) {
currentFolder.value = updatedFolder;
}
useEffect(() {
if (folder != null && folderState.hasValue) {
final updatedFolder = _findFolderInStructure(folderState.value!, folder!);
if (updatedFolder != null) {
currentFolder.value = updatedFolder;
}
return null;
},
[folderState],
);
}
return null;
}, [folderState]);
void onToggleSortOrder() {
final newOrder = sortOrder.value == SortOrder.asc ? SortOrder.desc : SortOrder.asc;
@@ -86,38 +77,19 @@ class FolderPage extends HookConsumerWidget {
title: Text(currentFolder.value?.name ?? tr("folders")),
elevation: 0,
centerTitle: false,
actions: [
IconButton(
icon: const Icon(Icons.swap_vert),
onPressed: onToggleSortOrder,
),
],
actions: [IconButton(icon: const Icon(Icons.swap_vert), onPressed: onToggleSortOrder)],
),
body: folderState.when(
data: (rootFolder) {
if (folder == null) {
return FolderContent(
folder: rootFolder,
root: rootFolder,
sortOrder: sortOrder.value,
);
return FolderContent(folder: rootFolder, root: rootFolder, sortOrder: sortOrder.value);
} else {
return FolderContent(
folder: currentFolder.value!,
root: rootFolder,
sortOrder: sortOrder.value,
);
return FolderContent(folder: currentFolder.value!, root: rootFolder, sortOrder: sortOrder.value);
}
},
loading: () => const Center(
child: CircularProgressIndicator(),
),
loading: () => const Center(child: CircularProgressIndicator()),
error: (error, stack) {
ImmichToast.show(
context: context,
msg: "failed_to_load_folder".tr(),
toastType: ToastType.error,
);
ImmichToast.show(context: context, msg: "failed_to_load_folder".tr(), toastType: ToastType.error);
return Center(child: const Text("failed_to_load_folder").tr());
},
),
@@ -130,26 +102,18 @@ class FolderContent extends HookConsumerWidget {
final RootFolder root;
final SortOrder sortOrder;
const FolderContent({
super.key,
this.folder,
required this.root,
this.sortOrder = SortOrder.asc,
});
const FolderContent({super.key, this.folder, required this.root, this.sortOrder = SortOrder.asc});
@override
Widget build(BuildContext context, WidgetRef ref) {
final folderRenderlist = ref.watch(folderRenderListProvider(folder!));
// Initial asset fetch
useEffect(
() {
if (folder == null) return;
ref.read(folderRenderListProvider(folder!).notifier).fetchAssets(sortOrder);
return null;
},
[folder],
);
useEffect(() {
if (folder == null) return;
ref.read(folderRenderListProvider(folder!).notifier).fetchAssets(sortOrder);
return null;
}, [folder]);
if (folder == null) {
return Center(child: const Text("folder_not_found").tr());
@@ -182,18 +146,12 @@ class FolderContent extends HookConsumerWidget {
if (folder!.subfolders.isNotEmpty)
...folder!.subfolders.map(
(subfolder) => LargeLeadingTile(
leading: Icon(
Icons.folder,
color: context.primaryColor,
size: 48,
),
leading: Icon(Icons.folder, color: context.primaryColor, size: 48),
title: Text(
subfolder.name,
softWrap: false,
overflow: TextOverflow.ellipsis,
style: context.textTheme.titleSmall?.copyWith(
fontWeight: FontWeight.w600,
),
style: context.textTheme.titleSmall?.copyWith(fontWeight: FontWeight.w600),
),
subtitle: subfolder.subfolders.isNotEmpty
? Text(
@@ -212,23 +170,15 @@ class FolderContent extends HookConsumerWidget {
onTap: () {
ref.read(currentAssetProvider.notifier).set(asset);
context.pushRoute(
GalleryViewerRoute(
renderList: list,
initialIndex: list.allAssets!.indexOf(asset),
),
GalleryViewerRoute(renderList: list, initialIndex: list.allAssets!.indexOf(asset)),
);
},
leading: ClipRRect(
borderRadius: const BorderRadius.all(
Radius.circular(15),
),
borderRadius: const BorderRadius.all(Radius.circular(15)),
child: SizedBox(
width: 80,
height: 80,
child: ThumbnailImage(
asset: asset,
showStorageIndicator: false,
),
child: ThumbnailImage(asset: asset, showStorageIndicator: false),
),
),
title: Text(
@@ -236,30 +186,20 @@ class FolderContent extends HookConsumerWidget {
maxLines: 2,
softWrap: false,
overflow: TextOverflow.ellipsis,
style: context.textTheme.titleSmall?.copyWith(
fontWeight: FontWeight.w600,
),
style: context.textTheme.titleSmall?.copyWith(fontWeight: FontWeight.w600),
),
subtitle: Text(
"${asset.exifInfo?.fileSize != null ? formatBytes(asset.exifInfo?.fileSize ?? 0) : ""}${DateFormat.yMMMd().format(asset.fileCreatedAt)}",
style: context.textTheme.bodyMedium?.copyWith(
color: context.colorScheme.onSurfaceSecondary,
),
style: context.textTheme.bodyMedium?.copyWith(color: context.colorScheme.onSurfaceSecondary),
),
),
),
],
);
},
loading: () => const Center(
child: CircularProgressIndicator(),
),
loading: () => const Center(child: CircularProgressIndicator()),
error: (error, stack) {
ImmichToast.show(
context: context,
msg: "failed_to_load_assets".tr(),
toastType: ToastType.error,
);
ImmichToast.show(context: context, msg: "failed_to_load_assets".tr(), toastType: ToastType.error);
return Center(child: const Text("failed_to_load_assets").tr());
},
),
@@ -273,11 +213,7 @@ class FolderPath extends StatelessWidget {
final RootFolder currentFolder;
final RootFolder root;
const FolderPath({
super.key,
required this.currentFolder,
required this.root,
});
const FolderPath({super.key, required this.currentFolder, required this.root});
@override
Widget build(BuildContext context) {

View File

@@ -74,17 +74,11 @@ class LibraryPage extends ConsumerWidget {
const Wrap(
spacing: 8,
runSpacing: 8,
children: [
PeopleCollectionCard(),
PlacesCollectionCard(),
LocalAlbumsCollectionCard(),
],
children: [PeopleCollectionCard(), PlacesCollectionCard(), LocalAlbumsCollectionCard()],
),
const SizedBox(height: 12),
const QuickAccessButtons(),
const SizedBox(
height: 32,
),
const SizedBox(height: 32),
],
),
),
@@ -100,13 +94,8 @@ class QuickAccessButtons extends ConsumerWidget {
return Container(
decoration: BoxDecoration(
border: Border.all(
color: context.colorScheme.onSurface.withAlpha(10),
width: 1,
),
borderRadius: const BorderRadius.all(
Radius.circular(20),
),
border: Border.all(color: context.colorScheme.onSurface.withAlpha(10), width: 1),
borderRadius: const BorderRadius.all(Radius.circular(20)),
gradient: LinearGradient(
colors: [
context.colorScheme.primary.withAlpha(10),
@@ -130,41 +119,26 @@ class QuickAccessButtons extends ConsumerWidget {
bottomRight: Radius.circular(partners.isEmpty ? 20 : 0),
),
),
leading: const Icon(
Icons.folder_outlined,
size: 26,
),
leading: const Icon(Icons.folder_outlined, size: 26),
title: Text(
IntlKeys.folders.tr(),
style: context.textTheme.titleSmall?.copyWith(
fontWeight: FontWeight.w500,
),
style: context.textTheme.titleSmall?.copyWith(fontWeight: FontWeight.w500),
),
onTap: () => context.pushRoute(FolderRoute()),
),
ListTile(
leading: const Icon(
Icons.lock_outline_rounded,
size: 26,
),
leading: const Icon(Icons.lock_outline_rounded, size: 26),
title: Text(
IntlKeys.locked_folder.tr(),
style: context.textTheme.titleSmall?.copyWith(
fontWeight: FontWeight.w500,
),
style: context.textTheme.titleSmall?.copyWith(fontWeight: FontWeight.w500),
),
onTap: () => context.pushRoute(const LockedRoute()),
),
ListTile(
leading: const Icon(
Icons.group_outlined,
size: 26,
),
leading: const Icon(Icons.group_outlined, size: 26),
title: Text(
IntlKeys.partners.tr(),
style: context.textTheme.titleSmall?.copyWith(
fontWeight: FontWeight.w500,
),
style: context.textTheme.titleSmall?.copyWith(fontWeight: FontWeight.w500),
),
onTap: () => context.pushRoute(const PartnerRoute()),
),
@@ -196,24 +170,13 @@ class PartnerList extends ConsumerWidget {
bottomRight: Radius.circular(isLastItem ? 20 : 0),
),
),
contentPadding: const EdgeInsets.only(
left: 12.0,
right: 18.0,
),
contentPadding: const EdgeInsets.only(left: 12.0, right: 18.0),
leading: userAvatar(context, partner, radius: 16),
title: const Text(
"partner_list_user_photos",
style: TextStyle(
fontWeight: FontWeight.w500,
),
).tr(
namedArgs: {
'user': partner.name,
},
),
onTap: () => context.pushRoute(
(PartnerDetailRoute(partner: partner)),
),
style: TextStyle(fontWeight: FontWeight.w500),
).tr(namedArgs: {'user': partner.name}),
onTap: () => context.pushRoute((PartnerDetailRoute(partner: partner))),
);
},
);
@@ -241,22 +204,15 @@ class PeopleCollectionCard extends ConsumerWidget {
height: size,
width: size,
decoration: BoxDecoration(
borderRadius: const BorderRadius.all(
Radius.circular(20),
),
borderRadius: const BorderRadius.all(Radius.circular(20)),
gradient: LinearGradient(
colors: [
context.colorScheme.primary.withAlpha(30),
context.colorScheme.primary.withAlpha(25),
],
colors: [context.colorScheme.primary.withAlpha(30), context.colorScheme.primary.withAlpha(25)],
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
),
),
child: people.widgetWhen(
onLoading: () => const Center(
child: CircularProgressIndicator(),
),
onLoading: () => const Center(child: CircularProgressIndicator()),
onData: (people) {
return GridView.count(
crossAxisCount: 2,
@@ -308,9 +264,7 @@ class LocalAlbumsCollectionCard extends HookConsumerWidget {
final size = context.width * widthFactor - 20.0;
return GestureDetector(
onTap: () => context.pushRoute(
const LocalAlbumsRoute(),
),
onTap: () => context.pushRoute(const LocalAlbumsRoute()),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
@@ -321,10 +275,7 @@ class LocalAlbumsCollectionCard extends HookConsumerWidget {
decoration: BoxDecoration(
borderRadius: const BorderRadius.all(Radius.circular(20)),
gradient: LinearGradient(
colors: [
context.colorScheme.primary.withAlpha(30),
context.colorScheme.primary.withAlpha(25),
],
colors: [context.colorScheme.primary.withAlpha(30), context.colorScheme.primary.withAlpha(25)],
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
),
@@ -336,10 +287,7 @@ class LocalAlbumsCollectionCard extends HookConsumerWidget {
mainAxisSpacing: 8,
physics: const NeverScrollableScrollPhysics(),
children: albums.take(4).map((album) {
return AlbumThumbnailCard(
album: album,
showTitle: false,
);
return AlbumThumbnailCard(album: album, showTitle: false);
}).toList(),
),
),
@@ -373,11 +321,7 @@ class PlacesCollectionCard extends StatelessWidget {
final size = context.width * widthFactor - 20.0;
return GestureDetector(
onTap: () => context.pushRoute(
PlacesCollectionRoute(
currentLocation: null,
),
),
onTap: () => context.pushRoute(PlacesCollectionRoute(currentLocation: null)),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
@@ -392,10 +336,7 @@ class PlacesCollectionCard extends StatelessWidget {
child: IgnorePointer(
child: MapThumbnail(
zoom: 8,
centre: const LatLng(
21.44950,
-157.91959,
),
centre: const LatLng(21.44950, -157.91959),
showAttribution: false,
themeMode: context.isDarkTheme ? ThemeMode.dark : ThemeMode.light,
),
@@ -425,12 +366,7 @@ class ActionButton extends StatelessWidget {
final IconData icon;
final String label;
const ActionButton({
super.key,
required this.onPressed,
required this.icon,
required this.label,
});
const ActionButton({super.key, required this.onPressed, required this.icon, required this.label});
@override
Widget build(BuildContext context) {
@@ -439,13 +375,7 @@ class ActionButton extends StatelessWidget {
onPressed: onPressed,
label: Padding(
padding: const EdgeInsets.only(left: 4.0),
child: Text(
label,
style: TextStyle(
color: context.colorScheme.onSurface,
fontSize: 15,
),
),
child: Text(label, style: TextStyle(color: context.colorScheme.onSurface, fontSize: 15)),
),
style: FilledButton.styleFrom(
elevation: 0,
@@ -454,16 +384,10 @@ class ActionButton extends StatelessWidget {
alignment: Alignment.centerLeft,
shape: RoundedRectangleBorder(
borderRadius: const BorderRadius.all(Radius.circular(25)),
side: BorderSide(
color: context.colorScheme.onSurface.withAlpha(10),
width: 1,
),
side: BorderSide(color: context.colorScheme.onSurface.withAlpha(10), width: 1),
),
),
icon: Icon(
icon,
color: context.primaryColor,
),
icon: Icon(icon, color: context.primaryColor),
),
);
}

View File

@@ -18,9 +18,7 @@ class LocalAlbumsPage extends HookConsumerWidget {
final albums = ref.watch(localAlbumsProvider);
return Scaffold(
appBar: AppBar(
title: Text('on_this_device'.tr()),
),
appBar: AppBar(title: Text('on_this_device'.tr())),
body: ListView.builder(
padding: const EdgeInsets.all(18.0),
itemCount: albums.length,
@@ -28,31 +26,18 @@ class LocalAlbumsPage extends HookConsumerWidget {
return Padding(
padding: const EdgeInsets.only(bottom: 8.0),
child: LargeLeadingTile(
leadingPadding: const EdgeInsets.only(
right: 16,
),
leadingPadding: const EdgeInsets.only(right: 16),
leading: ClipRRect(
borderRadius: const BorderRadius.all(Radius.circular(15)),
child: ImmichThumbnail(
asset: albums[index].thumbnail.value,
width: 80,
height: 80,
),
child: ImmichThumbnail(asset: albums[index].thumbnail.value, width: 80, height: 80),
),
title: Text(
albums[index].name,
style: context.textTheme.titleSmall?.copyWith(
fontWeight: FontWeight.w600,
),
style: context.textTheme.titleSmall?.copyWith(fontWeight: FontWeight.w600),
),
subtitle: Text(
'items_count'.t(
context: context,
args: {'count': albums[index].assetCount},
),
style: context.textTheme.bodyMedium?.copyWith(
color: context.colorScheme.onSurfaceSecondary,
),
'items_count'.t(context: context, args: {'count': albums[index].assetCount}),
style: context.textTheme.bodyMedium?.copyWith(color: context.colorScheme.onSurfaceSecondary),
),
onTap: () => context.pushRoute(AlbumViewerRoute(albumId: albums[index].id)),
),

View File

@@ -19,29 +19,23 @@ class LockedPage extends HookConsumerWidget {
final showOverlay = useState(false);
final authProviderNotifier = ref.read(authProvider.notifier);
// lock the page when it is destroyed
useEffect(
() {
return () {
authProviderNotifier.lockPinCode();
};
},
[],
);
useEffect(() {
return () {
authProviderNotifier.lockPinCode();
};
}, []);
useEffect(
() {
if (context.mounted) {
if (appLifeCycle == AppLifecycleState.resumed) {
showOverlay.value = false;
} else {
showOverlay.value = true;
}
useEffect(() {
if (context.mounted) {
if (appLifeCycle == AppLifecycleState.resumed) {
showOverlay.value = false;
} else {
showOverlay.value = true;
}
}
return null;
},
[appLifeCycle],
);
return null;
}, [appLifeCycle]);
return Scaffold(
appBar: ref.watch(multiselectProvider) ? null : const LockPageAppBar(),
@@ -51,12 +45,7 @@ class LockedPage extends HookConsumerWidget {
renderListProvider: lockedTimelineProvider,
topWidget: Padding(
padding: const EdgeInsets.all(16.0),
child: Center(
child: Text(
'no_locked_photos_message'.tr(),
style: context.textTheme.labelLarge,
),
),
child: Center(child: Text('no_locked_photos_message'.tr(), style: context.textTheme.labelLarge)),
),
editEnabled: false,
favoriteEnabled: false,
@@ -84,9 +73,7 @@ class LockPageAppBar extends ConsumerWidget implements PreferredSizeWidget {
),
centerTitle: true,
automaticallyImplyLeading: false,
title: const Text(
'locked_folder',
).tr(),
title: const Text('locked_folder').tr(),
);
}

View File

@@ -23,18 +23,12 @@ class PinAuthPage extends HookConsumerWidget {
final isBetaTimeline = Store.isBetaTimelineEnabled;
Future<void> registerBiometric(String pinCode) async {
final isRegistered = await ref.read(localAuthProvider.notifier).registerBiometric(
context,
pinCode,
);
final isRegistered = await ref.read(localAuthProvider.notifier).registerBiometric(context, pinCode);
if (isRegistered) {
context.showSnackBar(
SnackBar(
content: Text(
'biometric_auth_enabled'.tr(),
style: context.textTheme.labelLarge,
),
content: Text('biometric_auth_enabled'.tr(), style: context.textTheme.labelLarge),
duration: const Duration(seconds: 3),
backgroundColor: context.colorScheme.primaryContainer,
),
@@ -79,20 +73,14 @@ class PinAuthPage extends HookConsumerWidget {
}
return Scaffold(
appBar: AppBar(
title: Text('locked_folder'.tr()),
),
appBar: AppBar(title: Text('locked_folder'.tr())),
body: ListView(
shrinkWrap: true,
children: [
Padding(
padding: const EdgeInsets.only(top: 36.0),
child: showPinRegistrationForm.value
? Center(
child: PinRegistrationForm(
onDone: () => showPinRegistrationForm.value = false,
),
)
? Center(child: PinRegistrationForm(onDone: () => showPinRegistrationForm.value = false))
: Column(
children: [
Center(
@@ -112,17 +100,11 @@ class PinAuthPage extends HookConsumerWidget {
Padding(
padding: const EdgeInsets.only(right: 16.0),
child: TextButton.icon(
icon: const Icon(
Icons.fingerprint,
size: 28,
),
icon: const Icon(Icons.fingerprint, size: 28),
onPressed: enableBiometricAuth,
label: Text(
'use_biometric'.tr(),
style: context.textTheme.labelLarge?.copyWith(
color: context.primaryColor,
fontSize: 18,
),
style: context.textTheme.labelLarge?.copyWith(color: context.primaryColor, fontSize: 18),
),
),
),

View File

@@ -22,10 +22,7 @@ class DriftPartnerPage extends HookConsumerWidget {
addNewUsersHandler() async {
final potentialPartners = potentialPartnersAsync.value;
if (potentialPartners == null || potentialPartners.isEmpty) {
ImmichToast.show(
context: context,
msg: "partner_page_no_more_users".tr(),
);
ImmichToast.show(context: context, msg: "partner_page_no_more_users".tr());
return;
}
@@ -77,18 +74,13 @@ class DriftPartnerPage extends HookConsumerWidget {
centerTitle: false,
actions: [
IconButton(
onPressed: potentialPartnersAsync.whenOrNull(
data: (data) => addNewUsersHandler,
),
onPressed: potentialPartnersAsync.whenOrNull(data: (data) => addNewUsersHandler),
icon: const Icon(Icons.person_add),
tooltip: "add_partner".tr(),
),
],
),
body: _SharedToPartnerList(
onAddPartner: addNewUsersHandler,
onDeletePartner: onDeleteUser,
),
body: _SharedToPartnerList(onAddPartner: addNewUsersHandler, onDeletePartner: onDeleteUser),
);
}
}
@@ -97,10 +89,7 @@ class _SharedToPartnerList extends ConsumerWidget {
final VoidCallback onAddPartner;
final Function(PartnerUserDto partner) onDeletePartner;
const _SharedToPartnerList({
required this.onAddPartner,
required this.onDeletePartner,
});
const _SharedToPartnerList({required this.onAddPartner, required this.onDeletePartner});
@override
Widget build(BuildContext context, WidgetRef ref) {
@@ -116,10 +105,7 @@ class _SharedToPartnerList extends ConsumerWidget {
children: [
Padding(
padding: const EdgeInsets.symmetric(vertical: 8),
child: const Text(
"partner_page_empty_message",
style: TextStyle(fontSize: 14),
).tr(),
child: const Text("partner_page_empty_message", style: TextStyle(fontSize: 14)).tr(),
),
Align(
alignment: Alignment.center,
@@ -142,18 +128,13 @@ class _SharedToPartnerList extends ConsumerWidget {
leading: PartnerUserAvatar(partner: partner),
title: Text(partner.name),
subtitle: Text(partner.email),
trailing: IconButton(
icon: const Icon(Icons.person_remove),
onPressed: () => onDeletePartner(partner),
),
trailing: IconButton(icon: const Icon(Icons.person_remove), onPressed: () => onDeletePartner(partner)),
);
},
);
},
loading: () => const Center(child: CircularProgressIndicator()),
error: (error, stack) => Center(
child: Text("Error loading partners: $error"),
),
error: (error, stack) => Center(child: Text("Error loading partners: $error")),
);
}
}

View File

@@ -22,10 +22,7 @@ class PartnerPage extends HookConsumerWidget {
addNewUsersHandler() async {
final users = availableUsers.value;
if (users == null || users.isEmpty) {
ImmichToast.show(
context: context,
msg: "partner_page_no_more_users".tr(),
);
ImmichToast.show(context: context, msg: "partner_page_no_more_users".tr());
return;
}
@@ -40,10 +37,7 @@ class PartnerPage extends HookConsumerWidget {
onPressed: () => context.pop(u),
child: Row(
children: [
Padding(
padding: const EdgeInsets.only(right: 8),
child: userAvatar(context, u),
),
Padding(padding: const EdgeInsets.only(right: 8), child: userAvatar(context, u)),
Text(u.name),
],
),
@@ -57,11 +51,7 @@ class PartnerPage extends HookConsumerWidget {
if (ok) {
ref.invalidate(partnerSharedByProvider);
} else {
ImmichToast.show(
context: context,
msg: "partner_page_partner_add_failed".tr(),
toastType: ToastType.error,
);
ImmichToast.show(context: context, msg: "partner_page_partner_add_failed".tr(), toastType: ToastType.error);
}
}
}
@@ -87,9 +77,7 @@ class PartnerPage extends HookConsumerWidget {
padding: const EdgeInsets.only(left: 16.0, top: 16.0),
child: Text(
"partner_page_shared_to_title",
style: context.textTheme.titleSmall?.copyWith(
color: context.colorScheme.onSurface.withAlpha(200),
),
style: context.textTheme.titleSmall?.copyWith(color: context.colorScheme.onSurface.withAlpha(200)),
).tr(),
),
if (users.isNotEmpty)
@@ -99,10 +87,7 @@ class PartnerPage extends HookConsumerWidget {
itemBuilder: ((context, index) {
return ListTile(
leading: userAvatar(context, users[index]),
title: Text(
users[index].email,
style: context.textTheme.bodyLarge,
),
title: Text(users[index].email, style: context.textTheme.bodyLarge),
trailing: IconButton(
icon: const Icon(Icons.person_remove),
onPressed: () => onDeleteUser(users[index]),
@@ -118,17 +103,12 @@ class PartnerPage extends HookConsumerWidget {
children: [
Padding(
padding: const EdgeInsets.symmetric(vertical: 8),
child: const Text(
"partner_page_empty_message",
style: TextStyle(fontSize: 14),
).tr(),
child: const Text("partner_page_empty_message", style: TextStyle(fontSize: 14)).tr(),
),
Align(
alignment: Alignment.center,
child: ElevatedButton.icon(
onPressed: availableUsers.whenOrNull(
data: (data) => addNewUsersHandler,
),
onPressed: availableUsers.whenOrNull(data: (data) => addNewUsersHandler),
icon: const Icon(Icons.person_add),
label: const Text("add_partner").tr(),
),

View File

@@ -22,24 +22,18 @@ class PartnerDetailPage extends HookConsumerWidget {
final inTimeline = useState(partner.inTimeline);
bool toggleInProcess = false;
useEffect(
() {
Future.microtask(
() async => {
await ref.read(assetProvider.notifier).getAllAsset(),
},
);
return null;
},
[],
);
useEffect(() {
Future.microtask(() async => {await ref.read(assetProvider.notifier).getAllAsset()});
return null;
}, []);
void toggleInTimeline() async {
if (toggleInProcess) return;
toggleInProcess = true;
try {
final ok =
await ref.read(partnerSharedWithProvider.notifier).updatePartner(partner, inTimeline: !inTimeline.value);
final ok = await ref
.read(partnerSharedWithProvider.notifier)
.updatePartner(partner, inTimeline: !inTimeline.value);
if (ok) {
inTimeline.value = !inTimeline.value;
final action = inTimeline.value ? "shown on" : "hidden from";
@@ -65,28 +59,16 @@ class PartnerDetailPage extends HookConsumerWidget {
return Scaffold(
appBar: ref.watch(multiselectProvider)
? null
: AppBar(
title: Text(partner.name),
elevation: 0,
centerTitle: false,
),
: AppBar(title: Text(partner.name), elevation: 0, centerTitle: false),
body: MultiselectGrid(
topWidget: Padding(
padding: const EdgeInsets.only(left: 8.0, right: 8.0, top: 16.0),
child: Container(
decoration: BoxDecoration(
border: Border.all(
color: context.colorScheme.onSurface.withAlpha(10),
width: 1,
),
borderRadius: const BorderRadius.all(
Radius.circular(20),
),
border: Border.all(color: context.colorScheme.onSurface.withAlpha(10), width: 1),
borderRadius: const BorderRadius.all(Radius.circular(20)),
gradient: LinearGradient(
colors: [
context.colorScheme.primary.withAlpha(10),
context.colorScheme.primary.withAlpha(15),
],
colors: [context.colorScheme.primary.withAlpha(10), context.colorScheme.primary.withAlpha(15)],
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
),
@@ -96,18 +78,13 @@ class PartnerDetailPage extends HookConsumerWidget {
child: ListTile(
title: Text(
"Show in timeline",
style: context.textTheme.titleSmall?.copyWith(
color: context.colorScheme.primary,
),
style: context.textTheme.titleSmall?.copyWith(color: context.colorScheme.primary),
),
subtitle: Text(
"Show photos and videos from this user in your timeline",
style: context.textTheme.bodyMedium,
),
trailing: Switch(
value: inTimeline.value,
onChanged: (_) => toggleInTimeline(),
),
trailing: Switch(value: inTimeline.value, onChanged: (_) => toggleInTimeline()),
),
),
),

View File

@@ -21,10 +21,7 @@ class PeopleCollectionPage extends HookConsumerWidget {
final formFocus = useFocusNode();
final ValueNotifier<String?> search = useState(null);
showNameEditModel(
String personId,
String personName,
) {
showNameEditModel(String personId, String personName) {
return showDialog(
context: context,
useRootNavigator: false,
@@ -84,22 +81,14 @@ class PeopleCollectionPage extends HookConsumerWidget {
children: [
GestureDetector(
onTap: () {
context.pushRoute(
PersonResultRoute(
personId: person.id,
personName: person.name,
),
);
context.pushRoute(PersonResultRoute(personId: person.id, personName: person.name));
},
child: Material(
shape: const CircleBorder(side: BorderSide.none),
elevation: 3,
child: CircleAvatar(
maxRadius: isTablet ? 120 / 2 : 96 / 2,
backgroundImage: NetworkImage(
getFaceThumbnailUrl(person.id),
headers: headers,
),
backgroundImage: NetworkImage(getFaceThumbnailUrl(person.id), headers: headers),
),
),
),
@@ -115,15 +104,11 @@ class PeopleCollectionPage extends HookConsumerWidget {
),
)
: Padding(
padding: const EdgeInsets.symmetric(
horizontal: 16.0,
),
padding: const EdgeInsets.symmetric(horizontal: 16.0),
child: Text(
person.name,
overflow: TextOverflow.ellipsis,
style: context.textTheme.titleSmall?.copyWith(
fontWeight: FontWeight.w500,
),
style: context.textTheme.titleSmall?.copyWith(fontWeight: FontWeight.w500),
),
),
),

View File

@@ -61,11 +61,7 @@ class PlacesCollectionPage extends HookConsumerWidget {
child: MapThumbnail(
onTap: (_, __) => context.pushRoute(MapRoute(initialLocation: currentLocation)),
zoom: 8,
centre: currentLocation ??
const LatLng(
21.44950,
-157.91959,
),
centre: currentLocation ?? const LatLng(21.44950, -157.91959),
showAttribution: false,
themeMode: context.isDarkTheme ? ThemeMode.dark : ThemeMode.light,
),
@@ -113,16 +109,10 @@ class PlaceTile extends StatelessWidget {
SearchRoute(
prefilter: SearchFilter(
people: {},
location: SearchLocationFilter(
city: name,
),
location: SearchLocationFilter(city: name),
camera: SearchCameraFilter(),
date: SearchDateFilter(),
display: SearchDisplayFilters(
isNotInAlbum: false,
isArchive: false,
isFavorite: false,
),
display: SearchDisplayFilters(isNotInAlbum: false, isArchive: false, isFavorite: false),
mediaType: AssetType.other,
),
),
@@ -131,16 +121,9 @@ class PlaceTile extends StatelessWidget {
return LargeLeadingTile(
onTap: () => navigateToPlace(),
title: Text(
name,
style: context.textTheme.titleMedium?.copyWith(
fontWeight: FontWeight.w500,
),
),
title: Text(name, style: context.textTheme.titleMedium?.copyWith(fontWeight: FontWeight.w500)),
leading: ClipRRect(
borderRadius: const BorderRadius.all(
Radius.circular(20),
),
borderRadius: const BorderRadius.all(Radius.circular(20)),
child: CachedNetworkImage(
width: 80,
height: 80,

View File

@@ -17,16 +17,13 @@ class SharedLinkPage extends HookConsumerWidget {
Widget build(BuildContext context, WidgetRef ref) {
final sharedLinks = ref.watch(sharedLinksStateProvider);
useEffect(
() {
ref.read(sharedLinksStateProvider.notifier).fetchLinks();
return () {
if (!context.mounted) return;
ref.invalidate(sharedLinksStateProvider);
};
},
[],
);
useEffect(() {
ref.read(sharedLinksStateProvider.notifier).fetchLinks();
return () {
if (!context.mounted) return;
ref.invalidate(sharedLinksStateProvider);
};
}, []);
Widget buildNoShares() {
return Column(
@@ -36,30 +33,19 @@ class SharedLinkPage extends HookConsumerWidget {
padding: const EdgeInsets.only(left: 16.0, top: 16.0),
child: const Text(
"shared_link_manage_links",
style: TextStyle(
fontSize: 14,
color: Colors.grey,
fontWeight: FontWeight.bold,
),
style: TextStyle(fontSize: 14, color: Colors.grey, fontWeight: FontWeight.bold),
).tr(),
),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 16.0),
child: Padding(
padding: const EdgeInsets.symmetric(vertical: 10),
child: const Text(
"you_dont_have_any_shared_links",
style: TextStyle(fontSize: 14),
).tr(),
child: const Text("you_dont_have_any_shared_links", style: TextStyle(fontSize: 14)).tr(),
),
),
Expanded(
child: Center(
child: Icon(
Icons.link_off,
size: 100,
color: context.themeData.iconTheme.color?.withValues(alpha: 0.5),
),
child: Icon(Icons.link_off, size: 100, color: context.themeData.iconTheme.color?.withValues(alpha: 0.5)),
),
),
],
@@ -74,9 +60,7 @@ class SharedLinkPage extends HookConsumerWidget {
padding: const EdgeInsets.only(left: 16.0, top: 16.0, bottom: 30.0),
child: Text(
"shared_link_manage_links",
style: context.textTheme.labelLarge?.copyWith(
color: context.textTheme.labelLarge?.color?.withAlpha(200),
),
style: context.textTheme.labelLarge?.copyWith(color: context.textTheme.labelLarge?.color?.withAlpha(200)),
).tr(),
),
Expanded(
@@ -111,11 +95,7 @@ class SharedLinkPage extends HookConsumerWidget {
}
return Scaffold(
appBar: AppBar(
title: const Text("shared_link_app_bar_title").tr(),
elevation: 0,
centerTitle: false,
),
appBar: AppBar(title: const Text("shared_link_app_bar_title").tr(), elevation: 0, centerTitle: false),
body: SafeArea(
child: sharedLinks.widgetWhen(
onError: (error, stackTrace) => buildNoShares(),

View File

@@ -19,12 +19,7 @@ class SharedLinkEditPage extends HookConsumerWidget {
final List<String>? assetsList;
final String? albumId;
const SharedLinkEditPage({
super.key,
this.existingLink,
this.assetsList,
this.albumId,
});
const SharedLinkEditPage({super.key, this.existingLink, this.assetsList, this.albumId});
@override
Widget build(BuildContext context, WidgetRef ref) {
@@ -46,20 +41,11 @@ class SharedLinkEditPage extends HookConsumerWidget {
if (existingLink!.type == SharedLinkSource.album) {
return Row(
children: [
const Text(
'public_album',
style: TextStyle(fontWeight: FontWeight.bold),
).tr(),
const Text(
" | ",
style: TextStyle(fontWeight: FontWeight.bold),
),
const Text('public_album', style: TextStyle(fontWeight: FontWeight.bold)).tr(),
const Text(" | ", style: TextStyle(fontWeight: FontWeight.bold)),
Text(
existingLink!.title,
style: TextStyle(
color: colorScheme.primary,
fontWeight: FontWeight.bold,
),
style: TextStyle(color: colorScheme.primary, fontWeight: FontWeight.bold),
),
],
);
@@ -68,21 +54,12 @@ class SharedLinkEditPage extends HookConsumerWidget {
if (existingLink!.type == SharedLinkSource.individual) {
return Row(
children: [
const Text(
'shared_link_individual_shared',
style: TextStyle(fontWeight: FontWeight.bold),
).tr(),
const Text(
" | ",
style: TextStyle(fontWeight: FontWeight.bold),
),
const Text('shared_link_individual_shared', style: TextStyle(fontWeight: FontWeight.bold)).tr(),
const Text(" | ", style: TextStyle(fontWeight: FontWeight.bold)),
Expanded(
child: Text(
existingLink!.description ?? "--",
style: TextStyle(
color: colorScheme.primary,
fontWeight: FontWeight.bold,
),
style: TextStyle(color: colorScheme.primary, fontWeight: FontWeight.bold),
overflow: TextOverflow.ellipsis,
),
),
@@ -91,10 +68,7 @@ class SharedLinkEditPage extends HookConsumerWidget {
}
}
return const Text(
"create_link_to_share_description",
style: TextStyle(fontWeight: FontWeight.bold),
).tr();
return const Text("create_link_to_share_description", style: TextStyle(fontWeight: FontWeight.bold)).tr();
}
Widget buildDescriptionField() {
@@ -106,20 +80,12 @@ class SharedLinkEditPage extends HookConsumerWidget {
autofocus: false,
decoration: InputDecoration(
labelText: 'description'.tr(),
labelStyle: TextStyle(
fontWeight: FontWeight.bold,
color: colorScheme.primary,
),
labelStyle: TextStyle(fontWeight: FontWeight.bold, color: colorScheme.primary),
floatingLabelBehavior: FloatingLabelBehavior.always,
border: const OutlineInputBorder(),
hintText: 'shared_link_edit_description_hint'.tr(),
hintStyle: const TextStyle(
fontWeight: FontWeight.normal,
fontSize: 14,
),
disabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: Colors.grey.withValues(alpha: 0.5)),
),
hintStyle: const TextStyle(fontWeight: FontWeight.normal, fontSize: 14),
disabledBorder: OutlineInputBorder(borderSide: BorderSide(color: Colors.grey.withValues(alpha: 0.5))),
),
onTapOutside: (_) => descriptionFocusNode.unfocus(),
);
@@ -132,20 +98,12 @@ class SharedLinkEditPage extends HookConsumerWidget {
autofocus: false,
decoration: InputDecoration(
labelText: 'password'.tr(),
labelStyle: TextStyle(
fontWeight: FontWeight.bold,
color: colorScheme.primary,
),
labelStyle: TextStyle(fontWeight: FontWeight.bold, color: colorScheme.primary),
floatingLabelBehavior: FloatingLabelBehavior.always,
border: const OutlineInputBorder(),
hintText: 'shared_link_edit_password_hint'.tr(),
hintStyle: const TextStyle(
fontWeight: FontWeight.normal,
fontSize: 14,
),
disabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: Colors.grey.withValues(alpha: 0.5)),
),
hintStyle: const TextStyle(fontWeight: FontWeight.normal, fontSize: 14),
disabledBorder: OutlineInputBorder(borderSide: BorderSide(color: Colors.grey.withValues(alpha: 0.5))),
),
);
}
@@ -156,10 +114,7 @@ class SharedLinkEditPage extends HookConsumerWidget {
onChanged: newShareLink.value.isEmpty ? (value) => showMetadata.value = value : null,
activeColor: colorScheme.primary,
dense: true,
title: Text(
"show_metadata",
style: themeData.textTheme.labelLarge?.copyWith(fontWeight: FontWeight.bold),
).tr(),
title: Text("show_metadata", style: themeData.textTheme.labelLarge?.copyWith(fontWeight: FontWeight.bold)).tr(),
);
}
@@ -206,10 +161,7 @@ class SharedLinkEditPage extends HookConsumerWidget {
return DropdownMenu(
label: Text(
"expire_after",
style: TextStyle(
fontWeight: FontWeight.bold,
color: colorScheme.primary,
),
style: TextStyle(fontWeight: FontWeight.bold, color: colorScheme.primary),
).tr(),
enableSearch: false,
enableFilter: false,
@@ -220,26 +172,17 @@ class SharedLinkEditPage extends HookConsumerWidget {
expiryAfter.value = value!;
},
dropdownMenuEntries: [
DropdownMenuEntry(
value: 0,
label: "never".tr(),
),
DropdownMenuEntry(value: 0, label: "never".tr()),
DropdownMenuEntry(
value: 30,
label: "shared_link_edit_expire_after_option_minutes".tr(namedArgs: {'count': "30"}),
),
DropdownMenuEntry(
value: 60,
label: "shared_link_edit_expire_after_option_hour".tr(),
),
DropdownMenuEntry(value: 60, label: "shared_link_edit_expire_after_option_hour".tr()),
DropdownMenuEntry(
value: 60 * 6,
label: "shared_link_edit_expire_after_option_hours".tr(namedArgs: {'count': "6"}),
),
DropdownMenuEntry(
value: 60 * 24,
label: "shared_link_edit_expire_after_option_day".tr(),
),
DropdownMenuEntry(value: 60 * 24, label: "shared_link_edit_expire_after_option_day".tr()),
DropdownMenuEntry(
value: 60 * 24 * 7,
label: "shared_link_edit_expire_after_option_days".tr(namedArgs: {'count': "7"}),
@@ -266,9 +209,7 @@ class SharedLinkEditPage extends HookConsumerWidget {
SnackBar(
content: Text(
"shared_link_clipboard_copied_massage",
style: context.textTheme.bodyLarge?.copyWith(
color: context.primaryColor,
),
style: context.textTheme.bodyLarge?.copyWith(color: context.primaryColor),
).tr(),
duration: const Duration(seconds: 2),
),
@@ -279,23 +220,14 @@ class SharedLinkEditPage extends HookConsumerWidget {
Widget buildNewLinkField() {
return Column(
children: [
const Padding(
padding: EdgeInsets.only(
top: 20,
bottom: 20,
),
child: Divider(),
),
const Padding(padding: EdgeInsets.only(top: 20, bottom: 20), child: Divider()),
TextFormField(
readOnly: true,
initialValue: newShareLink.value,
decoration: InputDecoration(
border: const OutlineInputBorder(),
enabledBorder: themeData.inputDecorationTheme.focusedBorder,
suffixIcon: IconButton(
onPressed: copyLinkToClipboard,
icon: const Icon(Icons.copy),
),
suffixIcon: IconButton(onPressed: copyLinkToClipboard, icon: const Icon(Icons.copy)),
),
),
Padding(
@@ -306,13 +238,7 @@ class SharedLinkEditPage extends HookConsumerWidget {
onPressed: () {
context.maybePop();
},
child: const Text(
"done",
style: TextStyle(
fontSize: 14,
fontWeight: FontWeight.bold,
),
).tr(),
child: const Text("done", style: TextStyle(fontSize: 14, fontWeight: FontWeight.bold)).tr(),
),
),
),
@@ -325,7 +251,9 @@ class SharedLinkEditPage extends HookConsumerWidget {
}
Future<void> handleNewLink() async {
final newLink = await ref.read(sharedLinkServiceProvider).createSharedLink(
final newLink = await ref
.read(sharedLinkServiceProvider)
.createSharedLink(
albumId: albumId,
assetIds: assetsList,
showMeta: showMetadata.value,
@@ -336,9 +264,7 @@ class SharedLinkEditPage extends HookConsumerWidget {
expiresAt: expiryAfter.value == 0 ? null : calculateExpiry(),
);
ref.invalidate(sharedLinksStateProvider);
final externalDomain = ref.read(
serverInfoProvider.select((s) => s.serverConfig.externalDomain),
);
final externalDomain = ref.read(serverInfoProvider.select((s) => s.serverConfig.externalDomain));
var serverUrl = externalDomain.isNotEmpty ? externalDomain : getServerUrl();
if (serverUrl != null && !serverUrl.endsWith('/')) {
serverUrl += '/';
@@ -390,7 +316,9 @@ class SharedLinkEditPage extends HookConsumerWidget {
changeExpiry = true;
}
await ref.read(sharedLinkServiceProvider).updateSharedLink(
await ref
.read(sharedLinkServiceProvider)
.updateSharedLink(
existingLink!.id,
showMeta: meta,
allowDownload: download,
@@ -406,9 +334,7 @@ class SharedLinkEditPage extends HookConsumerWidget {
return Scaffold(
appBar: AppBar(
title: Text(
existingLink == null ? "create_link_to_share" : "edit_link",
).tr(),
title: Text(existingLink == null ? "create_link_to_share" : "edit_link").tr(),
elevation: 0,
leading: const CloseButton(),
centerTitle: false,
@@ -416,32 +342,15 @@ class SharedLinkEditPage extends HookConsumerWidget {
body: SafeArea(
child: ListView(
children: [
Padding(padding: const EdgeInsets.all(padding), child: buildLinkTitle()),
Padding(padding: const EdgeInsets.all(padding), child: buildDescriptionField()),
Padding(padding: const EdgeInsets.all(padding), child: buildPasswordField()),
Padding(
padding: const EdgeInsets.all(padding),
child: buildLinkTitle(),
),
Padding(
padding: const EdgeInsets.all(padding),
child: buildDescriptionField(),
),
Padding(
padding: const EdgeInsets.all(padding),
child: buildPasswordField(),
),
Padding(
padding: const EdgeInsets.only(
left: padding,
right: padding,
bottom: padding,
),
padding: const EdgeInsets.only(left: padding, right: padding, bottom: padding),
child: buildShowMetaButton(),
),
Padding(
padding: const EdgeInsets.only(
left: padding,
right: padding,
bottom: padding,
),
padding: const EdgeInsets.only(left: padding, right: padding, bottom: padding),
child: buildAllowDownloadButton(),
),
Padding(
@@ -450,48 +359,30 @@ class SharedLinkEditPage extends HookConsumerWidget {
),
if (existingLink != null)
Padding(
padding: const EdgeInsets.only(
left: padding,
right: padding,
bottom: padding,
),
padding: const EdgeInsets.only(left: padding, right: padding, bottom: padding),
child: buildEditExpiryButton(),
),
Padding(
padding: const EdgeInsets.only(
left: padding,
right: padding,
bottom: padding,
),
padding: const EdgeInsets.only(left: padding, right: padding, bottom: padding),
child: buildExpiryAfterButton(),
),
if (newShareLink.value.isEmpty)
Align(
alignment: Alignment.bottomRight,
child: Padding(
padding: const EdgeInsets.only(
right: padding + 10,
bottom: padding,
),
padding: const EdgeInsets.only(right: padding + 10, bottom: padding),
child: ElevatedButton(
onPressed: existingLink != null ? handleEditLink : handleNewLink,
child: Text(
existingLink != null ? "shared_link_edit_submit_button" : "create_link",
style: const TextStyle(
fontSize: 14,
fontWeight: FontWeight.bold,
),
style: const TextStyle(fontSize: 14, fontWeight: FontWeight.bold),
).tr(),
),
),
),
if (newShareLink.value.isNotEmpty)
Padding(
padding: const EdgeInsets.only(
left: padding,
right: padding,
bottom: padding,
),
padding: const EdgeInsets.only(left: padding, right: padding, bottom: padding),
child: buildNewLinkField(),
),
],

View File

@@ -29,10 +29,7 @@ class TrashPage extends HookConsumerWidget {
final selection = useState(<Asset>{});
final processing = useProcessingOverlay();
void selectionListener(
bool multiselect,
Set<Asset> selectedAssets,
) {
void selectionListener(bool multiselect, Set<Asset> selectedAssets) {
selectionEnabledHook.value = multiselect;
selection.value = selectedAssets;
}
@@ -43,11 +40,7 @@ class TrashPage extends HookConsumerWidget {
processing.value = false;
selectionEnabledHook.value = false;
if (context.mounted) {
ImmichToast.show(
context: context,
msg: 'trash_emptied'.tr(),
gravity: ToastGravity.BOTTOM,
);
ImmichToast.show(context: context, msg: 'trash_emptied'.tr(), gravity: ToastGravity.BOTTOM);
}
}
@@ -88,10 +81,7 @@ class TrashPage extends HookConsumerWidget {
handlePermanentDelete() async {
await showDialog(
context: context,
builder: (context) => DeleteDialog(
alert: "delete_dialog_alert_remote",
onDelete: () => onPermanentlyDelete(),
),
builder: (context) => DeleteDialog(alert: "delete_dialog_alert_remote", onDelete: () => onPermanentlyDelete()),
);
}
@@ -138,8 +128,9 @@ class TrashPage extends HookConsumerWidget {
selectionEnabledHook.value = false;
selection.value = {};
},
icon:
!selectionEnabledHook.value ? const Icon(Icons.arrow_back_ios_rounded) : const Icon(Icons.close_rounded),
icon: !selectionEnabledHook.value
? const Icon(Icons.arrow_back_ios_rounded)
: const Icon(Icons.close_rounded),
),
centerTitle: !selectionEnabledHook.value,
automaticallyImplyLeading: false,
@@ -149,14 +140,8 @@ class TrashPage extends HookConsumerWidget {
PopupMenuButton<void Function()>(
itemBuilder: (context) {
return [
PopupMenuItem(
value: () => selectionEnabledHook.value = true,
child: const Text('select').tr(),
),
PopupMenuItem(
value: handleEmptyTrash,
child: const Text('empty_trash').tr(),
),
PopupMenuItem(value: () => selectionEnabledHook.value = true, child: const Text('select').tr()),
PopupMenuItem(value: handleEmptyTrash, child: const Text('empty_trash').tr()),
];
},
onSelected: (fn) => fn(),
@@ -177,40 +162,28 @@ class TrashPage extends HookConsumerWidget {
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
TextButton.icon(
icon: Icon(
Icons.delete_forever,
color: Colors.red[400],
),
icon: Icon(Icons.delete_forever, color: Colors.red[400]),
label: Text(
selection.value.isEmpty ? 'trash_page_delete_all'.tr() : 'delete'.tr(),
style: TextStyle(
fontSize: 14,
color: Colors.red[400],
fontWeight: FontWeight.bold,
),
style: TextStyle(fontSize: 14, color: Colors.red[400], fontWeight: FontWeight.bold),
),
onPressed: processing.value
? null
: selection.value.isEmpty
? handleEmptyTrash
: handlePermanentDelete,
? handleEmptyTrash
: handlePermanentDelete,
),
TextButton.icon(
icon: const Icon(
Icons.history_rounded,
),
icon: const Icon(Icons.history_rounded),
label: Text(
selection.value.isEmpty ? 'trash_page_restore_all'.tr() : 'restore'.tr(),
style: const TextStyle(
fontSize: 14,
fontWeight: FontWeight.bold,
),
style: const TextStyle(fontSize: 14, fontWeight: FontWeight.bold),
),
onPressed: processing.value
? null
: selection.value.isEmpty
? handleRestoreAll
: handleRestore,
? handleRestoreAll
: handleRestore,
),
],
),
@@ -227,9 +200,7 @@ class TrashPage extends HookConsumerWidget {
),
body: trashRenderList.widgetWhen(
onData: (data) => data.isEmpty
? Center(
child: Text('trash_page_no_assets'.tr()),
)
? Center(child: Text('trash_page_no_assets'.tr()))
: Stack(
children: [
SafeArea(
@@ -240,13 +211,8 @@ class TrashPage extends HookConsumerWidget {
showMultiSelectIndicator: false,
showStack: true,
topWidget: Padding(
padding: const EdgeInsets.symmetric(
horizontal: 12,
vertical: 24,
),
child: const Text(
"trash_page_info",
).tr(namedArgs: {"days": "$trashDays"}),
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 24),
child: const Text("trash_page_info").tr(namedArgs: {"days": "$trashDays"}),
),
),
),