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,6 +127,7 @@ 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 {
|
||||||
|
if (isCasting) {
|
||||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||||
if (context.mounted) {
|
if (context.mounted) {
|
||||||
context.scaffoldMessenger.showSnackBar(
|
context.scaffoldMessenger.showSnackBar(
|
||||||
@ -142,6 +144,7 @@ class GalleryViewerPage extends HookConsumerWidget {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return null;
|
return null;
|
||||||
}, [
|
}, [
|
||||||
ref.watch(castProvider).isCasting,
|
ref.watch(castProvider).isCasting,
|
||||||
@ -393,6 +396,8 @@ 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();
|
||||||
|
|
||||||
|
if (isCasting) {
|
||||||
context.scaffoldMessenger.showSnackBar(
|
context.scaffoldMessenger.showSnackBar(
|
||||||
SnackBar(
|
SnackBar(
|
||||||
duration: const Duration(seconds: 2),
|
duration: const Duration(seconds: 2),
|
||||||
@ -405,6 +410,7 @@ class GalleryViewerPage extends HookConsumerWidget {
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
builder: buildAsset,
|
builder: buildAsset,
|
||||||
),
|
),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user