mirror of
https://gitlab.com/nkming2/nc-photos.git
synced 2025-03-22 15:09:22 +01:00
Don't loop video during slieshow
This commit is contained in:
parent
075f84decc
commit
1f3cbad7bc
2 changed files with 9 additions and 2 deletions
|
@ -226,6 +226,7 @@ class _SlideshowViewerState extends State<SlideshowViewer>
|
||||||
Future.delayed(const Duration(seconds: 2), _onSlideshowTick);
|
Future.delayed(const Duration(seconds: 2), _onSlideshowTick);
|
||||||
},
|
},
|
||||||
isControlVisible: false,
|
isControlVisible: false,
|
||||||
|
canLoop: false,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -34,6 +34,7 @@ class VideoViewer extends StatefulWidget {
|
||||||
this.onPause,
|
this.onPause,
|
||||||
this.isControlVisible = false,
|
this.isControlVisible = false,
|
||||||
this.canPlay = true,
|
this.canPlay = true,
|
||||||
|
this.canLoop = true,
|
||||||
}) : super(key: key);
|
}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
@ -48,6 +49,9 @@ class VideoViewer extends StatefulWidget {
|
||||||
final VoidCallback? onPause;
|
final VoidCallback? onPause;
|
||||||
final bool isControlVisible;
|
final bool isControlVisible;
|
||||||
final bool canPlay;
|
final bool canPlay;
|
||||||
|
|
||||||
|
/// If false, disable the loop control and always stop after playing once
|
||||||
|
final bool canLoop;
|
||||||
}
|
}
|
||||||
|
|
||||||
@npLog
|
@npLog
|
||||||
|
@ -112,7 +116,9 @@ class _VideoViewerState extends State<VideoViewer>
|
||||||
await _controller.initialize();
|
await _controller.initialize();
|
||||||
final c = KiwiContainer().resolve<DiContainer>();
|
final c = KiwiContainer().resolve<DiContainer>();
|
||||||
unawaited(_controller.setVolume(c.pref.isVideoPlayerMuteOr() ? 0 : 1));
|
unawaited(_controller.setVolume(c.pref.isVideoPlayerMuteOr() ? 0 : 1));
|
||||||
|
if (widget.canLoop) {
|
||||||
unawaited(_controller.setLooping(c.pref.isVideoPlayerLoopOr()));
|
unawaited(_controller.setLooping(c.pref.isVideoPlayerLoopOr()));
|
||||||
|
}
|
||||||
widget.onLoaded?.call();
|
widget.onLoaded?.call();
|
||||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||||
if (_key.currentContext != null) {
|
if (_key.currentContext != null) {
|
||||||
|
@ -220,7 +226,7 @@ class _VideoViewerState extends State<VideoViewer>
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(width: 4),
|
const SizedBox(width: 4),
|
||||||
_LoopToggle(controller: _controller),
|
if (widget.canLoop) _LoopToggle(controller: _controller),
|
||||||
_MuteToggle(controller: _controller),
|
_MuteToggle(controller: _controller),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|
Loading…
Reference in a new issue