mirror of
https://github.com/immich-app/immich.git
synced 2025-12-27 09:14:55 +03:00
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:
@@ -8,11 +8,7 @@ class AdvancedBottomSheet extends HookConsumerWidget {
|
||||
final Asset assetDetail;
|
||||
final ScrollController? scrollController;
|
||||
|
||||
const AdvancedBottomSheet({
|
||||
super.key,
|
||||
required this.assetDetail,
|
||||
this.scrollController,
|
||||
});
|
||||
const AdvancedBottomSheet({super.key, required this.assetDetail, this.scrollController});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
@@ -26,27 +22,15 @@ class AdvancedBottomSheet extends HookConsumerWidget {
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
const Align(
|
||||
child: Text(
|
||||
"ADVANCED INFO",
|
||||
style: TextStyle(fontSize: 12.0),
|
||||
),
|
||||
),
|
||||
const Align(child: Text("ADVANCED INFO", style: TextStyle(fontSize: 12.0))),
|
||||
const SizedBox(height: 32.0),
|
||||
Container(
|
||||
decoration: BoxDecoration(
|
||||
color: context.isDarkTheme ? Colors.grey[900] : Colors.grey[200],
|
||||
borderRadius: const BorderRadius.all(
|
||||
Radius.circular(15.0),
|
||||
),
|
||||
borderRadius: const BorderRadius.all(Radius.circular(15.0)),
|
||||
),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
right: 16.0,
|
||||
left: 16,
|
||||
top: 8,
|
||||
bottom: 16,
|
||||
),
|
||||
padding: const EdgeInsets.only(right: 16.0, left: 16, top: 8, bottom: 16),
|
||||
child: ListView(
|
||||
shrinkWrap: true,
|
||||
physics: const NeverScrollableScrollPhysics(),
|
||||
@@ -55,28 +39,18 @@ class AdvancedBottomSheet extends HookConsumerWidget {
|
||||
alignment: Alignment.centerRight,
|
||||
child: IconButton(
|
||||
onPressed: () {
|
||||
Clipboard.setData(
|
||||
ClipboardData(
|
||||
text: assetDetail.toString(),
|
||||
),
|
||||
).then((_) {
|
||||
Clipboard.setData(ClipboardData(text: assetDetail.toString())).then((_) {
|
||||
context.scaffoldMessenger.showSnackBar(
|
||||
SnackBar(
|
||||
content: Text(
|
||||
"Copied to clipboard",
|
||||
style: context.textTheme.bodyLarge?.copyWith(
|
||||
color: context.primaryColor,
|
||||
),
|
||||
style: context.textTheme.bodyLarge?.copyWith(color: context.primaryColor),
|
||||
),
|
||||
),
|
||||
);
|
||||
});
|
||||
},
|
||||
icon: Icon(
|
||||
Icons.copy,
|
||||
size: 16.0,
|
||||
color: context.primaryColor,
|
||||
),
|
||||
icon: Icon(Icons.copy, size: 16.0, color: context.primaryColor),
|
||||
),
|
||||
),
|
||||
SelectableText(
|
||||
|
||||
@@ -2,12 +2,7 @@ import 'package:flutter/material.dart';
|
||||
|
||||
/// A widget that animates implicitly between a play and a pause icon.
|
||||
class AnimatedPlayPause extends StatefulWidget {
|
||||
const AnimatedPlayPause({
|
||||
super.key,
|
||||
required this.playing,
|
||||
this.size,
|
||||
this.color,
|
||||
});
|
||||
const AnimatedPlayPause({super.key, required this.playing, this.size, this.color});
|
||||
|
||||
final double? size;
|
||||
final bool playing;
|
||||
|
||||
@@ -72,10 +72,7 @@ class BottomGalleryBar extends ConsumerWidget {
|
||||
|
||||
void handleDelete() async {
|
||||
Future<bool> onDelete(bool force) async {
|
||||
final isDeleted = await ref.read(assetProvider.notifier).deleteAssets(
|
||||
{asset},
|
||||
force: force,
|
||||
);
|
||||
final isDeleted = await ref.read(assetProvider.notifier).deleteAssets({asset}, force: force);
|
||||
if (isDeleted && isStackPrimaryAsset) {
|
||||
// Workaround for asset remaining in the gallery
|
||||
renderList.deleteAsset(asset);
|
||||
@@ -101,12 +98,7 @@ class BottomGalleryBar extends ConsumerWidget {
|
||||
if (isDeleted) {
|
||||
// Can only trash assets stored in server. Local assets are always permanently removed for now
|
||||
if (context.mounted && asset.isRemote && isStackPrimaryAsset) {
|
||||
ImmichToast.show(
|
||||
durationInSecond: 1,
|
||||
context: context,
|
||||
msg: 'Asset trashed',
|
||||
gravity: ToastGravity.BOTTOM,
|
||||
);
|
||||
ImmichToast.show(durationInSecond: 1, context: context, msg: 'Asset trashed', gravity: ToastGravity.BOTTOM);
|
||||
}
|
||||
removeAssetFromStack();
|
||||
}
|
||||
@@ -149,19 +141,13 @@ class BottomGalleryBar extends ConsumerWidget {
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
ListTile(
|
||||
leading: const Icon(
|
||||
Icons.filter_none_outlined,
|
||||
size: 18,
|
||||
),
|
||||
leading: const Icon(Icons.filter_none_outlined, size: 18),
|
||||
onTap: () async {
|
||||
await unStack();
|
||||
ctx.pop();
|
||||
context.maybePop();
|
||||
},
|
||||
title: const Text(
|
||||
"viewer_unstack",
|
||||
style: TextStyle(fontWeight: FontWeight.bold),
|
||||
).tr(),
|
||||
title: const Text("viewer_unstack", style: TextStyle(fontWeight: FontWeight.bold)).tr(),
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -189,11 +175,7 @@ class BottomGalleryBar extends ConsumerWidget {
|
||||
|
||||
context.navigator.push(
|
||||
MaterialPageRoute(
|
||||
builder: (context) => EditImagePage(
|
||||
asset: asset,
|
||||
image: image,
|
||||
isEdited: false,
|
||||
),
|
||||
builder: (context) => EditImagePage(asset: asset, image: image, isEdited: false),
|
||||
),
|
||||
);
|
||||
}
|
||||
@@ -221,9 +203,7 @@ class BottomGalleryBar extends ConsumerWidget {
|
||||
return;
|
||||
}
|
||||
|
||||
ref.read(downloadStateProvider.notifier).downloadAsset(
|
||||
asset,
|
||||
);
|
||||
ref.read(downloadStateProvider.notifier).downloadAsset(asset);
|
||||
}
|
||||
|
||||
handleRemoveFromAlbum() async {
|
||||
@@ -258,12 +238,11 @@ class BottomGalleryBar extends ConsumerWidget {
|
||||
final List<Map<BottomNavigationBarItem, Function(int)>> albumActions = [
|
||||
{
|
||||
BottomNavigationBarItem(
|
||||
icon: Icon(
|
||||
Platform.isAndroid ? Icons.share_rounded : Icons.ios_share_rounded,
|
||||
),
|
||||
icon: Icon(Platform.isAndroid ? Icons.share_rounded : Icons.ios_share_rounded),
|
||||
label: 'share'.tr(),
|
||||
tooltip: 'share'.tr(),
|
||||
): (_) => shareAsset(),
|
||||
): (_) =>
|
||||
shareAsset(),
|
||||
},
|
||||
if (asset.isImage && !isInLockedView)
|
||||
{
|
||||
@@ -271,7 +250,8 @@ class BottomGalleryBar extends ConsumerWidget {
|
||||
icon: const Icon(Icons.tune_outlined),
|
||||
label: 'edit'.tr(),
|
||||
tooltip: 'edit'.tr(),
|
||||
): (_) => handleEdit(),
|
||||
): (_) =>
|
||||
handleEdit(),
|
||||
},
|
||||
if (isOwner && !isInLockedView)
|
||||
{
|
||||
@@ -285,7 +265,8 @@ class BottomGalleryBar extends ConsumerWidget {
|
||||
icon: const Icon(Icons.archive_outlined),
|
||||
label: 'archive'.tr(),
|
||||
tooltip: 'archive'.tr(),
|
||||
): (_) => handleArchive(),
|
||||
): (_) =>
|
||||
handleArchive(),
|
||||
},
|
||||
if (isOwner && asset.stackCount > 0 && !isInLockedView)
|
||||
{
|
||||
@@ -293,7 +274,8 @@ class BottomGalleryBar extends ConsumerWidget {
|
||||
icon: const Icon(Icons.burst_mode_outlined),
|
||||
label: 'stack'.tr(),
|
||||
tooltip: 'stack'.tr(),
|
||||
): (_) => showStackActionItems(),
|
||||
): (_) =>
|
||||
showStackActionItems(),
|
||||
},
|
||||
if (isOwner && !isInAlbum)
|
||||
{
|
||||
@@ -301,7 +283,8 @@ class BottomGalleryBar extends ConsumerWidget {
|
||||
icon: const Icon(Icons.delete_outline),
|
||||
label: 'delete'.tr(),
|
||||
tooltip: 'delete'.tr(),
|
||||
): (_) => handleDelete(),
|
||||
): (_) =>
|
||||
handleDelete(),
|
||||
},
|
||||
if (!isOwner)
|
||||
{
|
||||
@@ -309,7 +292,8 @@ class BottomGalleryBar extends ConsumerWidget {
|
||||
icon: const Icon(Icons.download_outlined),
|
||||
label: 'download'.tr(),
|
||||
tooltip: 'download'.tr(),
|
||||
): (_) => handleDownload(),
|
||||
): (_) =>
|
||||
handleDownload(),
|
||||
},
|
||||
if (isInAlbum)
|
||||
{
|
||||
@@ -317,7 +301,8 @@ class BottomGalleryBar extends ConsumerWidget {
|
||||
icon: const Icon(Icons.remove_circle_outline),
|
||||
label: 'remove_from_album'.tr(),
|
||||
tooltip: 'remove_from_album'.tr(),
|
||||
): (_) => handleRemoveFromAlbum(),
|
||||
): (_) =>
|
||||
handleRemoveFromAlbum(),
|
||||
},
|
||||
];
|
||||
return IgnorePointer(
|
||||
@@ -344,16 +329,8 @@ class BottomGalleryBar extends ConsumerWidget {
|
||||
backgroundColor: Colors.transparent,
|
||||
unselectedIconTheme: const IconThemeData(color: Colors.white),
|
||||
selectedIconTheme: const IconThemeData(color: Colors.white),
|
||||
unselectedLabelStyle: const TextStyle(
|
||||
color: Colors.white,
|
||||
fontWeight: FontWeight.w500,
|
||||
height: 2.3,
|
||||
),
|
||||
selectedLabelStyle: const TextStyle(
|
||||
color: Colors.white,
|
||||
fontWeight: FontWeight.w500,
|
||||
height: 2.3,
|
||||
),
|
||||
unselectedLabelStyle: const TextStyle(color: Colors.white, fontWeight: FontWeight.w500, height: 2.3),
|
||||
selectedLabelStyle: const TextStyle(color: Colors.white, fontWeight: FontWeight.w500, height: 2.3),
|
||||
unselectedFontSize: 14,
|
||||
selectedFontSize: 14,
|
||||
selectedItemColor: Colors.white,
|
||||
|
||||
@@ -21,10 +21,7 @@ class CastDialog extends ConsumerWidget {
|
||||
}
|
||||
|
||||
return AlertDialog(
|
||||
title: const Text(
|
||||
"cast",
|
||||
style: TextStyle(fontWeight: FontWeight.bold),
|
||||
).tr(),
|
||||
title: const Text("cast", style: TextStyle(fontWeight: FontWeight.bold)).tr(),
|
||||
content: SizedBox(
|
||||
width: 250,
|
||||
height: 250,
|
||||
@@ -32,20 +29,13 @@ class CastDialog extends ConsumerWidget {
|
||||
future: ref.read(castProvider.notifier).getDevices(),
|
||||
builder: (context, snapshot) {
|
||||
if (snapshot.hasError) {
|
||||
return Text(
|
||||
'Error: ${snapshot.error.toString()}',
|
||||
);
|
||||
return Text('Error: ${snapshot.error.toString()}');
|
||||
} else if (!snapshot.hasData) {
|
||||
return const SizedBox(
|
||||
height: 48,
|
||||
child: Center(child: CircularProgressIndicator()),
|
||||
);
|
||||
return const SizedBox(height: 48, child: Center(child: CircularProgressIndicator()));
|
||||
}
|
||||
|
||||
if (snapshot.data!.isEmpty) {
|
||||
return const Text(
|
||||
'no_cast_devices_found',
|
||||
).tr();
|
||||
return const Text('no_cast_devices_found').tr();
|
||||
}
|
||||
|
||||
final devices = snapshot.data!;
|
||||
@@ -74,13 +64,7 @@ class CastDialog extends ConsumerWidget {
|
||||
// It's a section header
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 8.0),
|
||||
child: Text(
|
||||
item,
|
||||
style: const TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 16,
|
||||
),
|
||||
).tr(),
|
||||
child: Text(item, style: const TextStyle(fontWeight: FontWeight.bold, fontSize: 16)).tr(),
|
||||
);
|
||||
} else {
|
||||
final (deviceName, type, deviceObj) = item as (String, CastDestinationType, dynamic);
|
||||
@@ -88,9 +72,7 @@ class CastDialog extends ConsumerWidget {
|
||||
return ListTile(
|
||||
title: Text(
|
||||
deviceName,
|
||||
style: TextStyle(
|
||||
color: isCurrentDevice(deviceName) ? context.colorScheme.primary : null,
|
||||
),
|
||||
style: TextStyle(color: isCurrentDevice(deviceName) ? context.colorScheme.primary : null),
|
||||
),
|
||||
leading: Icon(
|
||||
type == CastDestinationType.googleCast ? Icons.cast : Icons.cast_connected,
|
||||
@@ -99,8 +81,8 @@ class CastDialog extends ConsumerWidget {
|
||||
trailing: isCurrentDevice(deviceName)
|
||||
? Icon(Icons.check, color: context.colorScheme.primary)
|
||||
: isDeviceConnecting(deviceName)
|
||||
? const CircularProgressIndicator()
|
||||
: null,
|
||||
? const CircularProgressIndicator()
|
||||
: null,
|
||||
onTap: () async {
|
||||
if (isDeviceConnecting(deviceName)) {
|
||||
return;
|
||||
@@ -127,20 +109,14 @@ class CastDialog extends ConsumerWidget {
|
||||
onPressed: () => ref.read(castProvider.notifier).disconnect(),
|
||||
child: Text(
|
||||
"stop_casting",
|
||||
style: TextStyle(
|
||||
color: context.colorScheme.secondary,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
style: TextStyle(color: context.colorScheme.secondary, fontWeight: FontWeight.bold),
|
||||
).tr(),
|
||||
),
|
||||
TextButton(
|
||||
onPressed: () => context.pop(),
|
||||
child: Text(
|
||||
"close",
|
||||
style: TextStyle(
|
||||
color: context.colorScheme.primary,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
style: TextStyle(color: context.colorScheme.primary, fontWeight: FontWeight.bold),
|
||||
).tr(),
|
||||
),
|
||||
],
|
||||
|
||||
@@ -29,19 +29,13 @@ class CenterPlayButton extends StatelessWidget {
|
||||
opacity: show ? 1.0 : 0.0,
|
||||
duration: const Duration(milliseconds: 100),
|
||||
child: DecoratedBox(
|
||||
decoration: BoxDecoration(
|
||||
color: backgroundColor,
|
||||
shape: BoxShape.circle,
|
||||
),
|
||||
decoration: BoxDecoration(color: backgroundColor, shape: BoxShape.circle),
|
||||
child: IconButton(
|
||||
iconSize: 32,
|
||||
padding: const EdgeInsets.all(12.0),
|
||||
icon: isFinished
|
||||
? Icon(Icons.replay, color: iconColor)
|
||||
: AnimatedPlayPause(
|
||||
color: iconColor,
|
||||
playing: isPlaying,
|
||||
),
|
||||
: AnimatedPlayPause(color: iconColor, playing: isPlaying),
|
||||
onPressed: onPressed,
|
||||
),
|
||||
),
|
||||
|
||||
@@ -13,36 +13,28 @@ import 'package:immich_mobile/widgets/common/delayed_loading_indicator.dart';
|
||||
class CustomVideoPlayerControls extends HookConsumerWidget {
|
||||
final Duration hideTimerDuration;
|
||||
|
||||
const CustomVideoPlayerControls({
|
||||
super.key,
|
||||
this.hideTimerDuration = const Duration(seconds: 5),
|
||||
});
|
||||
const CustomVideoPlayerControls({super.key, this.hideTimerDuration = const Duration(seconds: 5)});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
final assetIsVideo = ref.watch(
|
||||
currentAssetProvider.select((asset) => asset != null && asset.isVideo),
|
||||
);
|
||||
final assetIsVideo = ref.watch(currentAssetProvider.select((asset) => asset != null && asset.isVideo));
|
||||
final showControls = ref.watch(showControlsProvider);
|
||||
final VideoPlaybackState state = ref.watch(videoPlaybackValueProvider.select((value) => value.state));
|
||||
|
||||
final cast = ref.watch(castProvider);
|
||||
|
||||
// A timer to hide the controls
|
||||
final hideTimer = useTimer(
|
||||
hideTimerDuration,
|
||||
() {
|
||||
if (!context.mounted) {
|
||||
return;
|
||||
}
|
||||
final state = ref.read(videoPlaybackValueProvider).state;
|
||||
final hideTimer = useTimer(hideTimerDuration, () {
|
||||
if (!context.mounted) {
|
||||
return;
|
||||
}
|
||||
final state = ref.read(videoPlaybackValueProvider).state;
|
||||
|
||||
// Do not hide on paused
|
||||
if (state != VideoPlaybackState.paused && state != VideoPlaybackState.completed && assetIsVideo) {
|
||||
ref.read(showControlsProvider.notifier).show = false;
|
||||
}
|
||||
},
|
||||
);
|
||||
// Do not hide on paused
|
||||
if (state != VideoPlaybackState.paused && state != VideoPlaybackState.completed && assetIsVideo) {
|
||||
ref.read(showControlsProvider.notifier).show = false;
|
||||
}
|
||||
});
|
||||
final showBuffering = state == VideoPlaybackState.buffering && !cast.isCasting;
|
||||
|
||||
/// Shows the controls and starts the timer to hide them
|
||||
@@ -93,11 +85,7 @@ class CustomVideoPlayerControls extends HookConsumerWidget {
|
||||
child: Stack(
|
||||
children: [
|
||||
if (showBuffering)
|
||||
const Center(
|
||||
child: DelayedLoadingIndicator(
|
||||
fadeInDuration: Duration(milliseconds: 400),
|
||||
),
|
||||
)
|
||||
const Center(child: DelayedLoadingIndicator(fadeInDuration: Duration(milliseconds: 400)))
|
||||
else
|
||||
GestureDetector(
|
||||
onTap: () => ref.read(showControlsProvider.notifier).show = false,
|
||||
|
||||
@@ -14,11 +14,7 @@ import 'package:immich_mobile/widgets/common/immich_toast.dart';
|
||||
import 'package:logging/logging.dart';
|
||||
|
||||
class DescriptionInput extends HookConsumerWidget {
|
||||
DescriptionInput({
|
||||
super.key,
|
||||
required this.asset,
|
||||
this.exifInfo,
|
||||
});
|
||||
DescriptionInput({super.key, required this.asset, this.exifInfo});
|
||||
|
||||
final Asset asset;
|
||||
final ExifInfo? exifInfo;
|
||||
@@ -37,16 +33,13 @@ class DescriptionInput extends HookConsumerWidget {
|
||||
final hasDescription = useState(false);
|
||||
final isOwner = fastHash(owner?.id ?? '') == asset.ownerId;
|
||||
|
||||
useEffect(
|
||||
() {
|
||||
assetService.getDescription(asset).then((value) {
|
||||
controller.text = value;
|
||||
hasDescription.value = value.isNotEmpty;
|
||||
});
|
||||
return null;
|
||||
},
|
||||
[assetWithExif.value],
|
||||
);
|
||||
useEffect(() {
|
||||
assetService.getDescription(asset).then((value) {
|
||||
controller.text = value;
|
||||
hasDescription.value = value.isNotEmpty;
|
||||
});
|
||||
return null;
|
||||
}, [assetWithExif.value]);
|
||||
|
||||
if (!isOwner && !hasDescription.value) {
|
||||
return const SizedBox.shrink();
|
||||
@@ -55,19 +48,12 @@ class DescriptionInput extends HookConsumerWidget {
|
||||
submitDescription(String description) async {
|
||||
hasError.value = false;
|
||||
try {
|
||||
await assetService.setDescription(
|
||||
asset,
|
||||
description,
|
||||
);
|
||||
await assetService.setDescription(asset, description);
|
||||
controller.text = description;
|
||||
} catch (error, stack) {
|
||||
hasError.value = true;
|
||||
_log.severe("Error updating description", error, stack);
|
||||
ImmichToast.show(
|
||||
context: context,
|
||||
msg: "description_input_submit_error".tr(),
|
||||
toastType: ToastType.error,
|
||||
);
|
||||
ImmichToast.show(context: context, msg: "description_input_submit_error".tr(), toastType: ToastType.error);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -80,10 +66,7 @@ class DescriptionInput extends HookConsumerWidget {
|
||||
controller.clear();
|
||||
isTextEmpty.value = true;
|
||||
},
|
||||
icon: Icon(
|
||||
Icons.cancel_rounded,
|
||||
color: context.colorScheme.onSurfaceSecondary,
|
||||
),
|
||||
icon: Icon(Icons.cancel_rounded, color: context.colorScheme.onSurfaceSecondary),
|
||||
splashRadius: 10,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -36,18 +36,8 @@ class AssetDateTime extends ConsumerWidget {
|
||||
return Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
formattedDateTime,
|
||||
style: context.textTheme.bodyMedium?.copyWith(
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
if (asset.isRemote)
|
||||
IconButton(
|
||||
onPressed: editDateTime,
|
||||
icon: const Icon(Icons.edit_outlined),
|
||||
iconSize: 20,
|
||||
),
|
||||
Text(formattedDateTime, style: context.textTheme.bodyMedium?.copyWith(fontWeight: FontWeight.w600)),
|
||||
if (asset.isRemote) IconButton(onPressed: editDateTime, icon: const Icon(Icons.edit_outlined), iconSize: 20),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
@@ -12,11 +12,7 @@ class AssetDetails extends ConsumerWidget {
|
||||
final Asset asset;
|
||||
final ExifInfo? exifInfo;
|
||||
|
||||
const AssetDetails({
|
||||
super.key,
|
||||
required this.asset,
|
||||
this.exifInfo,
|
||||
});
|
||||
const AssetDetails({super.key, required this.asset, this.exifInfo});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
|
||||
@@ -11,10 +11,7 @@ import 'package:immich_mobile/widgets/asset_viewer/detail_panel/exif_map.dart';
|
||||
class AssetLocation extends HookConsumerWidget {
|
||||
final Asset asset;
|
||||
|
||||
const AssetLocation({
|
||||
super.key,
|
||||
required this.asset,
|
||||
});
|
||||
const AssetLocation({super.key, required this.asset});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
@@ -35,10 +32,7 @@ class AssetLocation extends HookConsumerWidget {
|
||||
leading: const Icon(Icons.location_on),
|
||||
title: Text(
|
||||
"add_a_location",
|
||||
style: context.textTheme.bodyMedium?.copyWith(
|
||||
fontWeight: FontWeight.w600,
|
||||
color: context.primaryColor,
|
||||
),
|
||||
style: context.textTheme.bodyMedium?.copyWith(fontWeight: FontWeight.w600, color: context.primaryColor),
|
||||
).tr(),
|
||||
onTap: editLocation,
|
||||
)
|
||||
@@ -56,10 +50,7 @@ class AssetLocation extends HookConsumerWidget {
|
||||
bool hasLocationName = (cityName != null && stateName != null);
|
||||
|
||||
return hasLocationName
|
||||
? Text(
|
||||
"$cityName, $stateName",
|
||||
style: context.textTheme.labelLarge,
|
||||
)
|
||||
? Text("$cityName, $stateName", style: context.textTheme.labelLarge)
|
||||
: const SizedBox.shrink();
|
||||
}
|
||||
|
||||
@@ -79,25 +70,16 @@ class AssetLocation extends HookConsumerWidget {
|
||||
),
|
||||
).tr(),
|
||||
if (asset.isRemote)
|
||||
IconButton(
|
||||
onPressed: editLocation,
|
||||
icon: const Icon(Icons.edit_outlined),
|
||||
iconSize: 20,
|
||||
),
|
||||
IconButton(onPressed: editLocation, icon: const Icon(Icons.edit_outlined), iconSize: 20),
|
||||
],
|
||||
),
|
||||
asset.isRemote ? const SizedBox.shrink() : const SizedBox(height: 16),
|
||||
ExifMap(
|
||||
exifInfo: exifInfo!,
|
||||
markerId: asset.remoteId,
|
||||
),
|
||||
ExifMap(exifInfo: exifInfo!, markerId: asset.remoteId),
|
||||
const SizedBox(height: 16),
|
||||
getLocationName(),
|
||||
Text(
|
||||
"${exifInfo.latitude!.toStringAsFixed(4)}, ${exifInfo.longitude!.toStringAsFixed(4)}",
|
||||
style: context.textTheme.labelMedium?.copyWith(
|
||||
color: context.textTheme.labelMedium?.color?.withAlpha(150),
|
||||
),
|
||||
style: context.textTheme.labelMedium?.copyWith(color: context.textTheme.labelMedium?.color?.withAlpha(150)),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
@@ -5,10 +5,7 @@ import 'package:immich_mobile/extensions/build_context_extensions.dart';
|
||||
class CameraInfo extends StatelessWidget {
|
||||
final ExifInfo exifInfo;
|
||||
|
||||
const CameraInfo({
|
||||
super.key,
|
||||
required this.exifInfo,
|
||||
});
|
||||
const CameraInfo({super.key, required this.exifInfo});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -16,14 +13,8 @@ class CameraInfo extends StatelessWidget {
|
||||
return ListTile(
|
||||
contentPadding: const EdgeInsets.all(0),
|
||||
dense: true,
|
||||
leading: Icon(
|
||||
Icons.camera,
|
||||
color: textColor.withAlpha(200),
|
||||
),
|
||||
title: Text(
|
||||
"${exifInfo.make} ${exifInfo.model}",
|
||||
style: context.textTheme.labelLarge,
|
||||
),
|
||||
leading: Icon(Icons.camera, color: textColor.withAlpha(200)),
|
||||
title: Text("${exifInfo.make} ${exifInfo.model}", style: context.textTheme.labelLarge),
|
||||
subtitle: exifInfo.f != null || exifInfo.exposureSeconds != null || exifInfo.mm != null || exifInfo.iso != null
|
||||
? Text(
|
||||
"ƒ/${exifInfo.fNumber} ${exifInfo.exposureTime} ${exifInfo.focalLength} mm ISO ${exifInfo.iso ?? ''} ",
|
||||
|
||||
@@ -11,12 +11,7 @@ class ExifMap extends StatelessWidget {
|
||||
final String? markerId;
|
||||
final MapCreatedCallback? onMapCreated;
|
||||
|
||||
const ExifMap({
|
||||
super.key,
|
||||
required this.exifInfo,
|
||||
this.markerId = 'marker',
|
||||
this.onMapCreated,
|
||||
});
|
||||
const ExifMap({super.key, required this.exifInfo, this.markerId = 'marker', this.onMapCreated});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -35,20 +30,13 @@ class ExifMap extends StatelessWidget {
|
||||
Uri uri = Uri(
|
||||
scheme: 'geo',
|
||||
host: '$latitude,$longitude',
|
||||
queryParameters: {
|
||||
'z': '$zoomLevel',
|
||||
'q': '$latitude,$longitude',
|
||||
},
|
||||
queryParameters: {'z': '$zoomLevel', 'q': '$latitude,$longitude'},
|
||||
);
|
||||
if (await canLaunchUrl(uri)) {
|
||||
return uri;
|
||||
}
|
||||
} else if (Platform.isIOS) {
|
||||
var params = {
|
||||
'll': '$latitude,$longitude',
|
||||
'q': '$latitude,$longitude',
|
||||
'z': '$zoomLevel',
|
||||
};
|
||||
var params = {'ll': '$latitude,$longitude', 'q': '$latitude,$longitude', 'z': '$zoomLevel'};
|
||||
Uri uri = Uri.https('maps.apple.com', '/', params);
|
||||
if (await canLaunchUrl(uri)) {
|
||||
return uri;
|
||||
@@ -66,10 +54,7 @@ class ExifMap extends StatelessWidget {
|
||||
return LayoutBuilder(
|
||||
builder: (context, constraints) {
|
||||
return MapThumbnail(
|
||||
centre: LatLng(
|
||||
exifInfo.latitude ?? 0,
|
||||
exifInfo.longitude ?? 0,
|
||||
),
|
||||
centre: LatLng(exifInfo.latitude ?? 0, exifInfo.longitude ?? 0),
|
||||
height: 150,
|
||||
width: constraints.maxWidth,
|
||||
zoom: 12.0,
|
||||
|
||||
@@ -6,10 +6,7 @@ import 'package:immich_mobile/utils/bytes_units.dart';
|
||||
class FileInfo extends StatelessWidget {
|
||||
final Asset asset;
|
||||
|
||||
const FileInfo({
|
||||
super.key,
|
||||
required this.asset,
|
||||
});
|
||||
const FileInfo({super.key, required this.asset});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -41,15 +38,9 @@ class FileInfo extends StatelessWidget {
|
||||
return ListTile(
|
||||
contentPadding: const EdgeInsets.all(0),
|
||||
dense: true,
|
||||
leading: Icon(
|
||||
Icons.image,
|
||||
color: textColor.withAlpha(200),
|
||||
),
|
||||
leading: Icon(Icons.image, color: textColor.withAlpha(200)),
|
||||
titleAlignment: ListTileTitleAlignment.center,
|
||||
title: Text(
|
||||
title,
|
||||
style: context.textTheme.labelLarge,
|
||||
),
|
||||
title: Text(title, style: context.textTheme.labelLarge),
|
||||
subtitle: subtitle == null ? null : Text(subtitle),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -21,10 +21,7 @@ class PeopleInfo extends ConsumerWidget {
|
||||
final peopleProvider = ref.watch(assetPeopleNotifierProvider(asset).notifier);
|
||||
final people = ref.watch(assetPeopleNotifierProvider(asset)).value?.where((p) => !p.isHidden);
|
||||
|
||||
showPersonNameEditModel(
|
||||
String personId,
|
||||
String personName,
|
||||
) {
|
||||
showPersonNameEditModel(String personId, String personName) {
|
||||
return showDialog(
|
||||
context: context,
|
||||
useRootNavigator: false,
|
||||
@@ -37,7 +34,8 @@ class PeopleInfo extends ConsumerWidget {
|
||||
});
|
||||
}
|
||||
|
||||
final curatedPeople = people
|
||||
final curatedPeople =
|
||||
people
|
||||
?.map(
|
||||
(p) => SearchCuratedContent(
|
||||
id: p.id,
|
||||
@@ -78,17 +76,10 @@ class PeopleInfo extends ConsumerWidget {
|
||||
content: curatedPeople,
|
||||
onTap: (content, index) {
|
||||
context
|
||||
.pushRoute(
|
||||
PersonResultRoute(
|
||||
personId: content.id,
|
||||
personName: content.label,
|
||||
),
|
||||
)
|
||||
.pushRoute(PersonResultRoute(personId: content.id, personName: content.label))
|
||||
.then((_) => peopleProvider.refresh());
|
||||
},
|
||||
onNameTap: (person, index) => {
|
||||
showPersonNameEditModel(person.id, person.label),
|
||||
},
|
||||
onNameTap: (person, index) => {showPersonNameEditModel(person.id, person.label)},
|
||||
),
|
||||
),
|
||||
],
|
||||
|
||||
@@ -11,11 +11,7 @@ class FormattedDuration extends StatelessWidget {
|
||||
width: data.inHours > 0 ? 70 : 60, // use a fixed width to prevent jitter
|
||||
child: Text(
|
||||
data.format(),
|
||||
style: const TextStyle(
|
||||
fontSize: 14.0,
|
||||
color: Colors.white,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
style: const TextStyle(fontSize: 14.0, color: Colors.white, fontWeight: FontWeight.w500),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
);
|
||||
|
||||
@@ -51,11 +51,7 @@ class GalleryAppBar extends ConsumerWidget {
|
||||
final result = await ref.read(trashProvider.notifier).restoreAssets([asset]);
|
||||
|
||||
if (result && context.mounted) {
|
||||
ImmichToast.show(
|
||||
context: context,
|
||||
msg: 'asset_restored_successfully'.tr(),
|
||||
gravity: ToastGravity.BOTTOM,
|
||||
);
|
||||
ImmichToast.show(context: context, msg: 'asset_restored_successfully'.tr(), gravity: ToastGravity.BOTTOM);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -75,16 +71,10 @@ class GalleryAppBar extends ConsumerWidget {
|
||||
addToAlbum(Asset addToAlbumAsset) {
|
||||
showModalBottomSheet(
|
||||
elevation: 0,
|
||||
shape: const RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.all(
|
||||
Radius.circular(15.0),
|
||||
),
|
||||
),
|
||||
shape: const RoundedRectangleBorder(borderRadius: BorderRadius.all(Radius.circular(15.0))),
|
||||
context: context,
|
||||
builder: (BuildContext _) {
|
||||
return AddToAlbumBottomSheet(
|
||||
assets: [addToAlbumAsset],
|
||||
);
|
||||
return AddToAlbumBottomSheet(assets: [addToAlbumAsset]);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
@@ -58,10 +58,7 @@ class TopControlAppBar extends HookConsumerWidget {
|
||||
Widget buildFavoriteButton(a) {
|
||||
return IconButton(
|
||||
onPressed: () => onFavorite(a),
|
||||
icon: Icon(
|
||||
a.isFavorite ? Icons.favorite : Icons.favorite_border,
|
||||
color: Colors.grey[200],
|
||||
),
|
||||
icon: Icon(a.isFavorite ? Icons.favorite : Icons.favorite_border, color: Colors.grey[200]),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -70,10 +67,7 @@ class TopControlAppBar extends HookConsumerWidget {
|
||||
onPressed: () {
|
||||
onLocatePressed();
|
||||
},
|
||||
icon: Icon(
|
||||
Icons.image_search,
|
||||
color: Colors.grey[200],
|
||||
),
|
||||
icon: Icon(Icons.image_search, color: Colors.grey[200]),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -82,20 +76,14 @@ class TopControlAppBar extends HookConsumerWidget {
|
||||
onPressed: () {
|
||||
onMoreInfoPressed();
|
||||
},
|
||||
icon: Icon(
|
||||
Icons.info_outline_rounded,
|
||||
color: Colors.grey[200],
|
||||
),
|
||||
icon: Icon(Icons.info_outline_rounded, color: Colors.grey[200]),
|
||||
);
|
||||
}
|
||||
|
||||
Widget buildDownloadButton() {
|
||||
return IconButton(
|
||||
onPressed: onDownloadPressed,
|
||||
icon: Icon(
|
||||
Icons.cloud_download_outlined,
|
||||
color: Colors.grey[200],
|
||||
),
|
||||
icon: Icon(Icons.cloud_download_outlined, color: Colors.grey[200]),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -104,10 +92,7 @@ class TopControlAppBar extends HookConsumerWidget {
|
||||
onPressed: () {
|
||||
onAddToAlbumPressed();
|
||||
},
|
||||
icon: Icon(
|
||||
Icons.add,
|
||||
color: Colors.grey[200],
|
||||
),
|
||||
icon: Icon(Icons.add, color: Colors.grey[200]),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -116,10 +101,7 @@ class TopControlAppBar extends HookConsumerWidget {
|
||||
onPressed: () {
|
||||
onRestorePressed();
|
||||
},
|
||||
icon: Icon(
|
||||
Icons.history_rounded,
|
||||
color: Colors.grey[200],
|
||||
),
|
||||
icon: Icon(Icons.history_rounded, color: Colors.grey[200]),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -131,19 +113,13 @@ class TopControlAppBar extends HookConsumerWidget {
|
||||
icon: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Icon(
|
||||
Icons.mode_comment_outlined,
|
||||
color: Colors.grey[200],
|
||||
),
|
||||
Icon(Icons.mode_comment_outlined, color: Colors.grey[200]),
|
||||
if (comments != 0)
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 5),
|
||||
child: Text(
|
||||
comments.toString(),
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Colors.grey[200],
|
||||
),
|
||||
style: TextStyle(fontWeight: FontWeight.bold, color: Colors.grey[200]),
|
||||
),
|
||||
),
|
||||
],
|
||||
@@ -154,10 +130,7 @@ class TopControlAppBar extends HookConsumerWidget {
|
||||
Widget buildUploadButton() {
|
||||
return IconButton(
|
||||
onPressed: onUploadPressed,
|
||||
icon: Icon(
|
||||
Icons.backup_outlined,
|
||||
color: Colors.grey[200],
|
||||
),
|
||||
icon: Icon(Icons.backup_outlined, color: Colors.grey[200]),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -166,21 +139,14 @@ class TopControlAppBar extends HookConsumerWidget {
|
||||
onPressed: () {
|
||||
context.maybePop();
|
||||
},
|
||||
icon: Icon(
|
||||
Icons.arrow_back_ios_new_rounded,
|
||||
size: 20.0,
|
||||
color: Colors.grey[200],
|
||||
),
|
||||
icon: Icon(Icons.arrow_back_ios_new_rounded, size: 20.0, color: Colors.grey[200]),
|
||||
);
|
||||
}
|
||||
|
||||
Widget buildCastButton() {
|
||||
return IconButton(
|
||||
onPressed: () {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (context) => const CastDialog(),
|
||||
);
|
||||
showDialog(context: context, builder: (context) => const CastDialog());
|
||||
},
|
||||
icon: Icon(
|
||||
isCasting ? Icons.cast_connected_rounded : Icons.cast_rounded,
|
||||
|
||||
@@ -12,9 +12,6 @@ class VideoControls extends ConsumerWidget {
|
||||
final isPortrait = context.orientation == Orientation.portrait;
|
||||
return isPortrait
|
||||
? const VideoPosition()
|
||||
: const Padding(
|
||||
padding: EdgeInsets.symmetric(horizontal: 60.0),
|
||||
child: VideoPosition(),
|
||||
);
|
||||
: const Padding(padding: EdgeInsets.symmetric(horizontal: 60.0), child: VideoPosition());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,12 +17,8 @@ class VideoPosition extends HookConsumerWidget {
|
||||
final isCasting = ref.watch(castProvider).isCasting;
|
||||
|
||||
final (position, duration) = isCasting
|
||||
? ref.watch(
|
||||
castProvider.select((c) => (c.currentTime, c.duration)),
|
||||
)
|
||||
: ref.watch(
|
||||
videoPlaybackValueProvider.select((v) => (v.position, v.duration)),
|
||||
);
|
||||
? ref.watch(castProvider.select((c) => (c.currentTime, c.duration)))
|
||||
: ref.watch(videoPlaybackValueProvider.select((v) => (v.position, v.duration)));
|
||||
|
||||
final wasPlaying = useRef<bool>(true);
|
||||
return duration == Duration.zero
|
||||
@@ -34,20 +30,14 @@ class VideoPosition extends HookConsumerWidget {
|
||||
padding: const EdgeInsets.symmetric(horizontal: 12.0),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
FormattedDuration(position),
|
||||
FormattedDuration(duration),
|
||||
],
|
||||
children: [FormattedDuration(position), FormattedDuration(duration)],
|
||||
),
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Slider(
|
||||
value: min(
|
||||
position.inMicroseconds / duration.inMicroseconds * 100,
|
||||
100,
|
||||
),
|
||||
value: min(position.inMicroseconds / duration.inMicroseconds * 100, 100),
|
||||
min: 0,
|
||||
max: 100,
|
||||
thumbColor: Colors.white,
|
||||
@@ -98,10 +88,7 @@ class _VideoPositionPlaceholder extends StatelessWidget {
|
||||
padding: EdgeInsets.symmetric(horizontal: 12.0),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
FormattedDuration(Duration.zero),
|
||||
FormattedDuration(Duration.zero),
|
||||
],
|
||||
children: [FormattedDuration(Duration.zero), FormattedDuration(Duration.zero)],
|
||||
),
|
||||
),
|
||||
Row(
|
||||
|
||||
Reference in New Issue
Block a user