Skip to content

Commit

Permalink
feat: Dismiss late video when pressing on the "LATE" label
Browse files Browse the repository at this point in the history
  • Loading branch information
bdlukaa committed Feb 6, 2024
1 parent 8bdee7a commit 07d30a2
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions lib/widgets/device_grid/video_status_label.dart
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import 'package:bluecherry_client/utils/extensions.dart';
import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'package:intl/intl.dart';
import 'package:provider/provider.dart';
import 'package:unity_video_player/unity_video_player.dart';

class VideoStatusLabel extends StatefulWidget {
Expand Down Expand Up @@ -148,6 +149,7 @@ class _VideoStatusLabelState extends State<VideoStatusLabel> {
Widget build(BuildContext context) {
final loc = AppLocalizations.of(context);
final theme = Theme.of(context);
final settings = context.watch<SettingsProvider>();

final text = switch (status) {
_VideoLabel.live => loc.live,
Expand Down Expand Up @@ -175,11 +177,18 @@ class _VideoStatusLabelState extends State<VideoStatusLabel> {
});
}

final isLateDismissal = status == _VideoLabel.late &&
settings.lateVideoBehavior == LateVideoBehavior.manual;

return MouseRegion(
onEnter: _openWithTap ? null : (_) => showOverlay(),
onExit: _openWithTap ? null : (_) => dismissOverlay(),
onEnter: _openWithTap || isLateDismissal ? null : (_) => showOverlay(),
onExit: _openWithTap || isLateDismissal ? null : (_) => dismissOverlay(),
child: GestureDetector(
onTap: () {
if (isLateDismissal) {
widget.video.player.dismissLateVideo();
return;
}
if (_openWithTap) {
dismissOverlay();
_openWithTap = false;
Expand Down

0 comments on commit 07d30a2

Please sign in to comment.