video: restored overlay hiding on manual play
This commit is contained in:
parent
ee59b6ae73
commit
cb8f90a5d6
5 changed files with 25 additions and 3 deletions
|
@ -60,6 +60,7 @@ class Durations {
|
|||
static const collectionScrollMonitoringTimerDelay = Duration(milliseconds: 100);
|
||||
static const highlightJumpDelay = Duration(milliseconds: 400);
|
||||
static const highlightScrollInitDelay = Duration(milliseconds: 800);
|
||||
static const videoOverlayHideDelay = Duration(milliseconds: 500);
|
||||
static const videoProgressTimerInterval = Duration(milliseconds: 300);
|
||||
static Duration staggeredAnimationDelay = Durations.staggeredAnimation ~/ 6 * timeDilation;
|
||||
static const doubleBackTimerDelay = Duration(milliseconds: 1000);
|
||||
|
|
|
@ -129,6 +129,7 @@ class _EntryViewerStackState extends State<EntryViewerStack> with FeedbackMixin,
|
|||
|
||||
@override
|
||||
void dispose() {
|
||||
_videoActionDelegate.dispose();
|
||||
_overlayAnimationController.dispose();
|
||||
_overlayVisible.removeListener(_onOverlayVisibleChange);
|
||||
_verticalPager.removeListener(_onVerticalPageControllerChange);
|
||||
|
@ -187,7 +188,7 @@ class _EntryViewerStackState extends State<EntryViewerStack> with FeedbackMixin,
|
|||
},
|
||||
child: NotificationListener<ToggleOverlayNotification>(
|
||||
onNotification: (notification) {
|
||||
_overlayVisible.value = !_overlayVisible.value;
|
||||
_overlayVisible.value = notification.visible ?? !_overlayVisible.value;
|
||||
return true;
|
||||
},
|
||||
child: Stack(
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
import 'package:flutter/material.dart';
|
||||
|
||||
class ToggleOverlayNotification extends Notification {}
|
||||
class ToggleOverlayNotification extends Notification {
|
||||
final bool? visible;
|
||||
|
||||
const ToggleOverlayNotification({this.visible});
|
||||
}
|
||||
|
|
|
@ -16,19 +16,29 @@ import 'package:aves/widgets/common/extensions/build_context.dart';
|
|||
import 'package:aves/widgets/dialogs/video_speed_dialog.dart';
|
||||
import 'package:aves/widgets/dialogs/video_stream_selection_dialog.dart';
|
||||
import 'package:aves/widgets/settings/video/video.dart';
|
||||
import 'package:aves/widgets/viewer/overlay/notifications.dart';
|
||||
import 'package:aves/widgets/viewer/video/controller.dart';
|
||||
import 'package:collection/collection.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
class VideoActionDelegate with FeedbackMixin, PermissionAwareMixin, SizeAwareMixin {
|
||||
Timer? _overlayHidingTimer;
|
||||
final CollectionLens? collection;
|
||||
|
||||
VideoActionDelegate({
|
||||
required this.collection,
|
||||
});
|
||||
|
||||
void dispose() {
|
||||
_stopOverlayHidingTimer();
|
||||
}
|
||||
|
||||
void onActionSelected(BuildContext context, AvesVideoController controller, VideoAction action) {
|
||||
// make sure overlay is not disappearing when selecting an action
|
||||
_stopOverlayHidingTimer();
|
||||
const ToggleOverlayNotification(visible: true).dispatch(context);
|
||||
|
||||
switch (action) {
|
||||
case VideoAction.captureFrame:
|
||||
_captureFrame(context, controller);
|
||||
|
@ -170,6 +180,12 @@ class VideoActionDelegate with FeedbackMixin, PermissionAwareMixin, SizeAwareMix
|
|||
await controller.pause();
|
||||
} else {
|
||||
await controller.play();
|
||||
// hide overlay
|
||||
_overlayHidingTimer = Timer(Durations.iconAnimation + Durations.videoOverlayHideDelay, () {
|
||||
const ToggleOverlayNotification(visible: false).dispatch(context);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
void _stopOverlayHidingTimer() => _overlayHidingTimer?.cancel();
|
||||
}
|
||||
|
|
|
@ -256,7 +256,7 @@ class _EntryPageViewState extends State<EntryPageView> {
|
|||
);
|
||||
}
|
||||
|
||||
void _onTap() => ToggleOverlayNotification().dispatch(context);
|
||||
void _onTap() => const ToggleOverlayNotification().dispatch(context);
|
||||
|
||||
void _onViewStateChanged(MagnifierState v) {
|
||||
final current = _viewStateNotifier.value;
|
||||
|
|
Loading…
Reference in a new issue