mirror of
https://github.com/immich-app/immich.git
synced 2025-07-09 03:04:16 -04:00
only show casting snackbar if we are casting
This commit is contained in:
parent
2b2d680c6a
commit
b828101bab
@ -64,6 +64,7 @@ class GalleryViewerPage extends HookConsumerWidget {
|
|||||||
final currentIndex = useValueNotifier(initialIndex);
|
final currentIndex = useValueNotifier(initialIndex);
|
||||||
final loadAsset = renderList.loadAsset;
|
final loadAsset = renderList.loadAsset;
|
||||||
final isPlayingMotionVideo = ref.watch(isPlayingMotionVideoProvider);
|
final isPlayingMotionVideo = ref.watch(isPlayingMotionVideoProvider);
|
||||||
|
final isCasting = ref.watch(castProvider.select((c) => c.isCasting));
|
||||||
|
|
||||||
final videoPlayerKeys = useRef<Map<int, GlobalKey>>({});
|
final videoPlayerKeys = useRef<Map<int, GlobalKey>>({});
|
||||||
|
|
||||||
@ -126,21 +127,23 @@ class GalleryViewerPage extends HookConsumerWidget {
|
|||||||
if (asset.isRemote) {
|
if (asset.isRemote) {
|
||||||
ref.read(castProvider.notifier).loadMedia(asset, false);
|
ref.read(castProvider.notifier).loadMedia(asset, false);
|
||||||
} else {
|
} else {
|
||||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
if (isCasting) {
|
||||||
if (context.mounted) {
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||||
context.scaffoldMessenger.showSnackBar(
|
if (context.mounted) {
|
||||||
SnackBar(
|
context.scaffoldMessenger.showSnackBar(
|
||||||
duration: const Duration(seconds: 1),
|
SnackBar(
|
||||||
content: Text(
|
duration: const Duration(seconds: 1),
|
||||||
"local_asset_cast_failed".tr(),
|
content: Text(
|
||||||
style: context.textTheme.bodyLarge?.copyWith(
|
"local_asset_cast_failed".tr(),
|
||||||
color: context.primaryColor,
|
style: context.textTheme.bodyLarge?.copyWith(
|
||||||
|
color: context.primaryColor,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
);
|
||||||
);
|
}
|
||||||
}
|
});
|
||||||
});
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}, [
|
}, [
|
||||||
@ -393,17 +396,20 @@ class GalleryViewerPage extends HookConsumerWidget {
|
|||||||
ref.read(castProvider.notifier).loadMedia(newAsset, false);
|
ref.read(castProvider.notifier).loadMedia(newAsset, false);
|
||||||
} else {
|
} else {
|
||||||
context.scaffoldMessenger.clearSnackBars();
|
context.scaffoldMessenger.clearSnackBars();
|
||||||
context.scaffoldMessenger.showSnackBar(
|
|
||||||
SnackBar(
|
if (isCasting) {
|
||||||
duration: const Duration(seconds: 2),
|
context.scaffoldMessenger.showSnackBar(
|
||||||
content: Text(
|
SnackBar(
|
||||||
"local_asset_cast_failed".tr(),
|
duration: const Duration(seconds: 2),
|
||||||
style: context.textTheme.bodyLarge?.copyWith(
|
content: Text(
|
||||||
color: context.primaryColor,
|
"local_asset_cast_failed".tr(),
|
||||||
|
style: context.textTheme.bodyLarge?.copyWith(
|
||||||
|
color: context.primaryColor,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
);
|
||||||
);
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
builder: buildAsset,
|
builder: buildAsset,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user