Fixes hide on pause
This commit is contained in:
@@ -22,7 +22,11 @@ class CustomVideoPlayerControls extends HookConsumerWidget {
|
|||||||
final hideTimer = useTimer(
|
final hideTimer = useTimer(
|
||||||
hideTimerDuration,
|
hideTimerDuration,
|
||||||
() {
|
() {
|
||||||
|
final state = ref.read(videoPlaybackValueProvider).state;
|
||||||
|
// Do not hide on paused
|
||||||
|
if (state != VideoPlaybackState.paused) {
|
||||||
ref.read(showControlsProvider.notifier).show = false;
|
ref.read(showControlsProvider.notifier).show = false;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -68,7 +72,7 @@ class CustomVideoPlayerControls extends HookConsumerWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return GestureDetector(
|
return GestureDetector(
|
||||||
onTap: () => showControlsAndStartHideTimer(),
|
onTap: showControlsAndStartHideTimer,
|
||||||
child: AbsorbPointer(
|
child: AbsorbPointer(
|
||||||
absorbing: !ref.watch(showControlsProvider),
|
absorbing: !ref.watch(showControlsProvider),
|
||||||
child: Stack(
|
child: Stack(
|
||||||
|
|||||||
@@ -135,7 +135,13 @@ class VideoViewerPage extends HookConsumerWidget {
|
|||||||
);
|
);
|
||||||
|
|
||||||
final size = MediaQuery.of(context).size;
|
final size = MediaQuery.of(context).size;
|
||||||
return PopScope(
|
return GestureDetector(
|
||||||
|
onTap: () {
|
||||||
|
if (ref.read(showControlsProvider)) {
|
||||||
|
ref.read(showControlsProvider.notifier).show = false;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
child: PopScope(
|
||||||
onPopInvoked: (pop) {
|
onPopInvoked: (pop) {
|
||||||
ref.read(videoPlaybackValueProvider.notifier).value =
|
ref.read(videoPlaybackValueProvider.notifier).value =
|
||||||
VideoPlaybackValue.uninitialized();
|
VideoPlaybackValue.uninitialized();
|
||||||
@@ -170,6 +176,7 @@ class VideoViewerPage extends HookConsumerWidget {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user