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
@@ -17,46 +17,33 @@ class AddToAlbumBottomSheet extends HookConsumerWidget {
/// The asset to add to an album
final List<Asset> assets;
const AddToAlbumBottomSheet({
super.key,
required this.assets,
});
const AddToAlbumBottomSheet({super.key, required this.assets});
@override
Widget build(BuildContext context, WidgetRef ref) {
final albums = ref.watch(albumProvider).where((a) => a.isRemote).toList();
final albumService = ref.watch(albumServiceProvider);
useEffect(
() {
// Fetch album updates, e.g., cover image
ref.read(albumProvider.notifier).refreshRemoteAlbums();
useEffect(() {
// Fetch album updates, e.g., cover image
ref.read(albumProvider.notifier).refreshRemoteAlbums();
return null;
},
[],
);
return null;
}, []);
void addToAlbum(Album album) async {
final result = await albumService.addAssets(
album,
assets,
);
final result = await albumService.addAssets(album, assets);
if (result != null) {
if (result.alreadyInAlbum.isNotEmpty) {
ImmichToast.show(
context: context,
msg: 'add_to_album_bottom_sheet_already_exists'.tr(
namedArgs: {"album": album.name},
),
msg: 'add_to_album_bottom_sheet_already_exists'.tr(namedArgs: {"album": album.name}),
);
} else {
ImmichToast.show(
context: context,
msg: 'add_to_album_bottom_sheet_added'.tr(
namedArgs: {"album": album.name},
),
msg: 'add_to_album_bottom_sheet_added'.tr(namedArgs: {"album": album.name}),
);
}
}
@@ -66,10 +53,7 @@ class AddToAlbumBottomSheet extends HookConsumerWidget {
return Card(
elevation: 0,
shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.only(
topLeft: Radius.circular(15),
topRight: Radius.circular(15),
),
borderRadius: BorderRadius.only(topLeft: Radius.circular(15), topRight: Radius.circular(15)),
),
child: CustomScrollView(
slivers: [
@@ -80,33 +64,17 @@ class AddToAlbumBottomSheet extends HookConsumerWidget {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const SizedBox(height: 12),
const Align(
alignment: Alignment.center,
child: CustomDraggingHandle(),
),
const Align(alignment: Alignment.center, child: CustomDraggingHandle()),
const SizedBox(height: 12),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
'add_to_album'.tr(),
style: context.textTheme.displayMedium,
),
Text('add_to_album'.tr(), style: context.textTheme.displayMedium),
TextButton.icon(
icon: Icon(
Icons.add,
color: context.primaryColor,
),
label: Text(
'common_create_new_album'.tr(),
style: TextStyle(color: context.primaryColor),
),
icon: Icon(Icons.add, color: context.primaryColor),
label: Text('common_create_new_album'.tr(), style: TextStyle(color: context.primaryColor)),
onPressed: () {
context.pushRoute(
CreateAlbumRoute(
assets: assets,
),
);
context.pushRoute(CreateAlbumRoute(assets: assets));
},
),
],
@@ -28,8 +28,10 @@ class AddToAlbumSliverList extends HookConsumerWidget {
final sortedSharedAlbums = albumSortMode.sortFn(sharedAlbums, albumSortIsReverse);
return SliverList(
delegate:
SliverChildBuilderDelegate(childCount: albums.length + (sharedAlbums.isEmpty ? 0 : 1), (context, index) {
delegate: SliverChildBuilderDelegate(childCount: albums.length + (sharedAlbums.isEmpty ? 0 : 1), (
context,
index,
) {
// Build shared expander
if (index == 0 && sortedSharedAlbums.isNotEmpty) {
return Padding(
@@ -56,10 +58,7 @@ class AddToAlbumSliverList extends HookConsumerWidget {
// Build albums list
final offset = index - (sharedAlbums.isNotEmpty ? 1 : 0);
final album = sortedAlbums[offset];
return AlbumThumbnailListTile(
album: album,
onTap: enabled ? () => onAddToAlbum(album) : () {},
);
return AlbumThumbnailListTile(album: album, onTap: enabled ? () => onAddToAlbum(album) : () {});
}),
);
}
@@ -6,12 +6,7 @@ class AlbumActionFilledButton extends StatelessWidget {
final String labelText;
final IconData iconData;
const AlbumActionFilledButton({
super.key,
this.onPressed,
required this.labelText,
required this.iconData,
});
const AlbumActionFilledButton({super.key, this.onPressed, required this.labelText, required this.iconData});
@override
Widget build(BuildContext context) {
@@ -20,24 +15,12 @@ class AlbumActionFilledButton extends StatelessWidget {
child: OutlinedButton.icon(
style: OutlinedButton.styleFrom(
padding: const EdgeInsets.symmetric(vertical: 0, horizontal: 16),
shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.all(Radius.circular(20)),
),
side: BorderSide(
color: context.colorScheme.surfaceContainerHighest,
width: 1,
),
shape: const RoundedRectangleBorder(borderRadius: BorderRadius.all(Radius.circular(20))),
side: BorderSide(color: context.colorScheme.surfaceContainerHighest, width: 1),
backgroundColor: context.colorScheme.surfaceContainerHigh,
),
icon: Icon(
iconData,
size: 18,
color: context.primaryColor,
),
label: Text(
labelText,
style: context.textTheme.labelLarge?.copyWith(),
),
icon: Icon(iconData, size: 18, color: context.primaryColor),
label: Text(labelText, style: context.textTheme.labelLarge?.copyWith()),
onPressed: onPressed,
),
);
@@ -16,13 +16,7 @@ class AlbumThumbnailCard extends ConsumerWidget {
final bool showOwner;
final bool showTitle;
const AlbumThumbnailCard({
super.key,
required this.album,
this.onTap,
this.showOwner = false,
this.showTitle = true,
});
const AlbumThumbnailCard({super.key, required this.album, this.onTap, this.showOwner = false, this.showTitle = true});
final Album album;
@@ -36,24 +30,14 @@ class AlbumThumbnailCard extends ConsumerWidget {
return Container(
height: cardSize,
width: cardSize,
decoration: BoxDecoration(
color: context.colorScheme.surfaceContainerHigh,
),
decoration: BoxDecoration(color: context.colorScheme.surfaceContainerHigh),
child: Center(
child: Icon(
Icons.no_photography,
size: cardSize * .15,
color: context.colorScheme.primary,
),
child: Icon(Icons.no_photography, size: cardSize * .15, color: context.colorScheme.primary),
),
);
}
buildAlbumThumbnail() => ImmichThumbnail(
asset: album.thumbnail.value,
width: cardSize,
height: cardSize,
);
buildAlbumThumbnail() => ImmichThumbnail(asset: album.thumbnail.value, width: cardSize, height: cardSize);
buildAlbumTextRow() {
// Add the owner name to the subtitle
@@ -62,12 +46,7 @@ class AlbumThumbnailCard extends ConsumerWidget {
if (album.ownerId == ref.read(currentUserProvider)?.id) {
owner = 'owned'.tr();
} else if (album.ownerName != null) {
owner = 'shared_by_user'.t(
context: context,
args: {
'user': album.ownerName!,
},
);
owner = 'shared_by_user'.t(context: context, args: {'user': album.ownerName!});
}
}
@@ -75,19 +54,12 @@ class AlbumThumbnailCard extends ConsumerWidget {
TextSpan(
children: [
TextSpan(
text: 'items_count'.t(
context: context,
args: {
'count': album.assetCount,
},
),
text: 'items_count'.t(context: context, args: {'count': album.assetCount}),
),
if (owner != null) const TextSpan(text: ''),
if (owner != null) TextSpan(text: owner),
],
style: context.textTheme.bodyMedium?.copyWith(
color: context.colorScheme.onSurfaceSecondary,
),
style: context.textTheme.bodyMedium?.copyWith(color: context.colorScheme.onSurfaceSecondary),
),
overflow: TextOverflow.fade,
);
@@ -106,9 +78,7 @@ class AlbumThumbnailCard extends ConsumerWidget {
width: cardSize,
height: cardSize,
child: ClipRRect(
borderRadius: const BorderRadius.all(
Radius.circular(20),
),
borderRadius: const BorderRadius.all(Radius.circular(20)),
child: album.thumbnail.value == null ? buildEmptyThumbnail() : buildAlbumThumbnail(),
),
),
@@ -11,11 +11,7 @@ import 'package:immich_mobile/utils/image_url_builder.dart';
import 'package:openapi/api.dart';
class AlbumThumbnailListTile extends StatelessWidget {
const AlbumThumbnailListTile({
super.key,
required this.album,
this.onTap,
});
const AlbumThumbnailListTile({super.key, required this.album, this.onTap});
final Album album;
final void Function()? onTap;
@@ -26,15 +22,11 @@ class AlbumThumbnailListTile extends StatelessWidget {
buildEmptyThumbnail() {
return Container(
decoration: BoxDecoration(
color: context.isDarkTheme ? Colors.grey[800] : Colors.grey[200],
),
decoration: BoxDecoration(color: context.isDarkTheme ? Colors.grey[800] : Colors.grey[200]),
child: SizedBox(
height: cardSize,
width: cardSize,
child: const Center(
child: Icon(Icons.no_photography),
),
child: const Center(child: Icon(Icons.no_photography)),
),
);
}
@@ -45,10 +37,7 @@ class AlbumThumbnailListTile extends StatelessWidget {
height: cardSize,
fit: BoxFit.cover,
fadeInDuration: const Duration(milliseconds: 200),
imageUrl: getAlbumThumbnailUrl(
album,
type: AssetMediaSize.thumbnail,
),
imageUrl: getAlbumThumbnailUrl(album, type: AssetMediaSize.thumbnail),
httpHeaders: ApiService.getRequestHeaders(),
cacheKey: getAlbumThumbNailCacheKey(album, type: AssetMediaSize.thumbnail),
errorWidget: (context, url, error) => const Icon(Icons.image_not_supported_outlined),
@@ -57,7 +46,8 @@ class AlbumThumbnailListTile extends StatelessWidget {
return GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: onTap ??
onTap:
onTap ??
() {
context.pushRoute(AlbumViewerRoute(albumId: album.id));
},
@@ -79,37 +69,18 @@ class AlbumThumbnailListTile extends StatelessWidget {
Text(
album.name,
overflow: TextOverflow.ellipsis,
style: const TextStyle(
fontWeight: FontWeight.bold,
),
style: const TextStyle(fontWeight: FontWeight.bold),
),
Row(
mainAxisSize: MainAxisSize.min,
children: [
Text(
'items_count'.t(
context: context,
args: {
'count': album.assetCount,
},
),
style: const TextStyle(
fontSize: 12,
),
'items_count'.t(context: context, args: {'count': album.assetCount}),
style: const TextStyle(fontSize: 12),
),
if (album.shared) ...[
const Text(
'',
style: TextStyle(
fontSize: 12,
),
),
Text(
'shared'.tr(),
style: const TextStyle(
fontSize: 12,
),
),
const Text('', style: TextStyle(fontSize: 12)),
Text('shared'.tr(), style: const TextStyle(fontSize: 12)),
],
],
),
@@ -31,11 +31,7 @@ class AlbumTitleTextField extends ConsumerWidget {
ref.watch(albumTitleProvider.notifier).setAlbumTitle(v);
},
focusNode: albumTitleTextFieldFocusNode,
style: TextStyle(
fontSize: 28,
color: context.colorScheme.onSurface,
fontWeight: FontWeight.bold,
),
style: TextStyle(fontSize: 28, color: context.colorScheme.onSurface, fontWeight: FontWeight.bold),
controller: albumTitleController,
onTap: () {
isAlbumTitleTextFieldFocus.value = true;
@@ -52,24 +48,17 @@ class AlbumTitleTextField extends ConsumerWidget {
albumTitleController.clear();
isAlbumTitleEmpty.value = true;
},
icon: Icon(
Icons.cancel_rounded,
color: context.primaryColor,
),
icon: Icon(Icons.cancel_rounded, color: context.primaryColor),
splashRadius: 10,
)
: null,
enabledBorder: const OutlineInputBorder(
borderSide: BorderSide(color: Colors.transparent),
borderRadius: BorderRadius.all(
Radius.circular(10),
),
borderRadius: BorderRadius.all(Radius.circular(10)),
),
focusedBorder: const OutlineInputBorder(
borderSide: BorderSide(color: Colors.transparent),
borderRadius: BorderRadius.all(
Radius.circular(10),
),
borderRadius: BorderRadius.all(Radius.circular(10)),
),
hintText: 'add_a_title'.tr(),
hintStyle: context.themeData.inputDecorationTheme.hintStyle?.copyWith(
@@ -82,10 +82,7 @@ class AlbumViewerAppbar extends HookConsumerWidget implements PreferredSizeWidge
onPressed: () => context.pop('Cancel'),
child: Text(
'cancel',
style: TextStyle(
color: context.primaryColor,
fontWeight: FontWeight.bold,
),
style: TextStyle(color: context.primaryColor, fontWeight: FontWeight.bold),
).tr(),
),
TextButton(
@@ -95,10 +92,7 @@ class AlbumViewerAppbar extends HookConsumerWidget implements PreferredSizeWidge
},
child: Text(
'confirm',
style: TextStyle(
fontWeight: FontWeight.bold,
color: context.colorScheme.error,
),
style: TextStyle(fontWeight: FontWeight.bold, color: context.colorScheme.error),
).tr(),
),
],
@@ -128,10 +122,7 @@ class AlbumViewerAppbar extends HookConsumerWidget implements PreferredSizeWidge
album.ownerId == userId
? ListTile(
leading: const Icon(Icons.delete_forever_rounded),
title: const Text(
'delete_album',
style: TextStyle(fontWeight: FontWeight.w500),
).tr(),
title: const Text('delete_album', style: TextStyle(fontWeight: FontWeight.w500)).tr(),
onTap: onDeleteAlbumPressed,
)
: ListTile(
@@ -172,18 +163,12 @@ class AlbumViewerAppbar extends HookConsumerWidget implements PreferredSizeWidge
onAddUsers();
}
},
title: const Text(
"album_viewer_page_share_add_users",
style: TextStyle(fontWeight: FontWeight.w500),
).tr(),
title: const Text("album_viewer_page_share_add_users", style: TextStyle(fontWeight: FontWeight.w500)).tr(),
),
ListTile(
leading: const Icon(Icons.swap_vert_rounded),
onTap: onSortOrderToggled,
title: const Text(
"change_display_order",
style: TextStyle(fontWeight: FontWeight.w500),
).tr(),
title: const Text("change_display_order", style: TextStyle(fontWeight: FontWeight.w500)).tr(),
),
ListTile(
leading: const Icon(Icons.link_rounded),
@@ -191,18 +176,12 @@ class AlbumViewerAppbar extends HookConsumerWidget implements PreferredSizeWidge
context.pushRoute(SharedLinkEditRoute(albumId: album.remoteId));
context.pop();
},
title: const Text(
"control_bottom_app_bar_share_link",
style: TextStyle(fontWeight: FontWeight.w500),
).tr(),
title: const Text("control_bottom_app_bar_share_link", style: TextStyle(fontWeight: FontWeight.w500)).tr(),
),
ListTile(
leading: const Icon(Icons.settings_rounded),
onTap: () => context.navigateTo(const AlbumOptionsRoute()),
title: const Text(
"options",
style: TextStyle(fontWeight: FontWeight.w500),
).tr(),
title: const Text("options", style: TextStyle(fontWeight: FontWeight.w500)).tr(),
),
];
@@ -216,10 +195,7 @@ class AlbumViewerAppbar extends HookConsumerWidget implements PreferredSizeWidge
onAddPhotos();
}
},
title: const Text(
"add_photos",
style: TextStyle(fontWeight: FontWeight.w500),
).tr(),
title: const Text("add_photos", style: TextStyle(fontWeight: FontWeight.w500)).tr(),
),
];
showModalBottomSheet(
@@ -250,18 +226,13 @@ class AlbumViewerAppbar extends HookConsumerWidget implements PreferredSizeWidge
icon: Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
const Icon(
Icons.mode_comment_outlined,
),
const Icon(Icons.mode_comment_outlined),
if (comments != 0)
Padding(
padding: const EdgeInsets.only(left: 5),
child: Text(
comments.toString(),
style: TextStyle(
fontWeight: FontWeight.bold,
color: context.primaryColor,
),
style: TextStyle(fontWeight: FontWeight.bold, color: context.primaryColor),
),
),
],
@@ -285,8 +256,9 @@ class AlbumViewerAppbar extends HookConsumerWidget implements PreferredSizeWidge
}
titleFocusNode.unfocus();
} else if (newAlbumDescription.isNotEmpty) {
bool isSuccessDescription =
await ref.watch(albumViewerProvider.notifier).changeAlbumDescription(album, newAlbumDescription);
bool isSuccessDescription = await ref
.watch(albumViewerProvider.notifier)
.changeAlbumDescription(album, newAlbumDescription);
if (!isSuccessDescription) {
ImmichToast.show(
context: context,
@@ -322,11 +294,7 @@ class AlbumViewerAppbar extends HookConsumerWidget implements PreferredSizeWidge
actions: [
if (album.shared && (album.activityEnabled || comments != 0)) buildActivitiesButton(),
if (album.isRemote) ...[
IconButton(
splashRadius: 25,
onPressed: buildBottomSheet,
icon: const Icon(Icons.more_horiz_rounded),
),
IconButton(splashRadius: 25, onPressed: buildBottomSheet, icon: const Icon(Icons.more_horiz_rounded)),
],
],
);
@@ -8,11 +8,7 @@ import 'package:immich_mobile/providers/album/album_viewer.provider.dart';
class AlbumViewerEditableDescription extends HookConsumerWidget {
final String albumDescription;
final FocusNode descriptionFocusNode;
const AlbumViewerEditableDescription({
super.key,
required this.albumDescription,
required this.descriptionFocusNode,
});
const AlbumViewerEditableDescription({super.key, required this.albumDescription, required this.descriptionFocusNode});
@override
Widget build(BuildContext context, WidgetRef ref) {
@@ -31,15 +27,12 @@ class AlbumViewerEditableDescription extends HookConsumerWidget {
}
}
useEffect(
() {
descriptionFocusNode.addListener(onFocusModeChange);
return () {
descriptionFocusNode.removeListener(onFocusModeChange);
};
},
[],
);
useEffect(() {
descriptionFocusNode.addListener(onFocusModeChange);
return () {
descriptionFocusNode.removeListener(onFocusModeChange);
};
}, []);
return Material(
color: Colors.transparent,
@@ -72,19 +65,12 @@ class AlbumViewerEditableDescription extends HookConsumerWidget {
onPressed: () {
descriptionTextEditController.clear();
},
icon: Icon(
Icons.cancel_rounded,
color: context.primaryColor,
),
icon: Icon(Icons.cancel_rounded, color: context.primaryColor),
splashRadius: 10,
)
: null,
enabledBorder: const OutlineInputBorder(
borderSide: BorderSide(color: Colors.transparent),
),
focusedBorder: const OutlineInputBorder(
borderSide: BorderSide(color: Colors.transparent),
),
enabledBorder: const OutlineInputBorder(borderSide: BorderSide(color: Colors.transparent)),
focusedBorder: const OutlineInputBorder(borderSide: BorderSide(color: Colors.transparent)),
focusColor: Colors.grey[300],
fillColor: context.scaffoldBackgroundColor,
filled: descriptionFocusNode.hasFocus,
@@ -8,11 +8,7 @@ import 'package:immich_mobile/providers/album/album_viewer.provider.dart';
class AlbumViewerEditableTitle extends HookConsumerWidget {
final String albumName;
final FocusNode titleFocusNode;
const AlbumViewerEditableTitle({
super.key,
required this.albumName,
required this.titleFocusNode,
});
const AlbumViewerEditableTitle({super.key, required this.albumName, required this.titleFocusNode});
@override
Widget build(BuildContext context, WidgetRef ref) {
@@ -31,15 +27,12 @@ class AlbumViewerEditableTitle extends HookConsumerWidget {
}
}
useEffect(
() {
titleFocusNode.addListener(onFocusModeChange);
return () {
titleFocusNode.removeListener(onFocusModeChange);
};
},
[],
);
useEffect(() {
titleFocusNode.addListener(onFocusModeChange);
return () {
titleFocusNode.removeListener(onFocusModeChange);
};
}, []);
return Material(
color: Colors.transparent,
@@ -51,9 +44,7 @@ class AlbumViewerEditableTitle extends HookConsumerWidget {
}
},
focusNode: titleFocusNode,
style: context.textTheme.headlineLarge?.copyWith(
fontWeight: FontWeight.w700,
),
style: context.textTheme.headlineLarge?.copyWith(fontWeight: FontWeight.w700),
controller: titleTextEditController,
onTap: () {
context.focusScope.requestFocus(titleFocusNode);
@@ -66,35 +57,23 @@ class AlbumViewerEditableTitle extends HookConsumerWidget {
}
},
decoration: InputDecoration(
contentPadding: const EdgeInsets.symmetric(
horizontal: 8,
vertical: 0,
),
contentPadding: const EdgeInsets.symmetric(horizontal: 8, vertical: 0),
suffixIcon: titleFocusNode.hasFocus
? IconButton(
onPressed: () {
titleTextEditController.clear();
},
icon: Icon(
Icons.cancel_rounded,
color: context.primaryColor,
),
icon: Icon(Icons.cancel_rounded, color: context.primaryColor),
splashRadius: 10,
)
: null,
enabledBorder: const OutlineInputBorder(
borderSide: BorderSide(color: Colors.transparent),
),
focusedBorder: const OutlineInputBorder(
borderSide: BorderSide(color: Colors.transparent),
),
enabledBorder: const OutlineInputBorder(borderSide: BorderSide(color: Colors.transparent)),
focusedBorder: const OutlineInputBorder(borderSide: BorderSide(color: Colors.transparent)),
focusColor: Colors.grey[300],
fillColor: context.scaffoldBackgroundColor,
filled: titleFocusNode.hasFocus,
hintText: 'add_a_title'.tr(),
hintStyle: context.themeData.inputDecorationTheme.hintStyle?.copyWith(
fontSize: 28,
),
hintStyle: context.themeData.inputDecorationTheme.hintStyle?.copyWith(fontSize: 28),
),
),
);
@@ -5,9 +5,7 @@ import 'package:immich_mobile/providers/infrastructure/remote_album.provider.dar
import 'package:immich_mobile/widgets/common/user_circle_avatar.dart';
class RemoteAlbumSharedUserIcons extends ConsumerWidget {
const RemoteAlbumSharedUserIcons({
super.key,
});
const RemoteAlbumSharedUserIcons({super.key});
@override
Widget build(BuildContext context, WidgetRef ref) {
@@ -31,12 +29,7 @@ class RemoteAlbumSharedUserIcons extends ConsumerWidget {
itemBuilder: ((context, index) {
return Padding(
padding: const EdgeInsets.only(right: 4.0),
child: UserCircleAvatar(
user: sharedUsers[index],
radius: 18,
size: 36,
hasBorder: true,
),
child: UserCircleAvatar(user: sharedUsers[index], radius: 18, size: 36, hasBorder: true),
);
}),
itemCount: sharedUsers.length,
@@ -14,15 +14,7 @@ class SharedAlbumThumbnailImage extends HookConsumerWidget {
onTap: () {
// debugPrint("View ${asset.id}");
},
child: Stack(
children: [
ImmichThumbnail(
asset: asset,
width: 500,
height: 500,
),
],
),
child: Stack(children: [ImmichThumbnail(asset: asset, width: 500, height: 500)]),
);
}
}