diff --git a/lib/screens/channel/video/video.dart b/lib/screens/channel/video/video.dart index 801e9f6c..9f32090d 100644 --- a/lib/screens/channel/video/video.dart +++ b/lib/screens/channel/video/video.dart @@ -6,11 +6,13 @@ import 'package:webview_flutter/webview_flutter.dart'; class Video extends StatelessWidget { final String userLogin; + final FocusNode textFieldFocus; final VideoStore videoStore; const Video({ Key? key, required this.userLogin, + required this.textFieldFocus, required this.videoStore, }) : super(key: key); @@ -18,7 +20,8 @@ class Video extends StatelessWidget { Widget build(BuildContext context) { return Observer( builder: (context) => GestureDetector( - onLongPress: videoStore.settingsStore.toggleableOverlay ? () => videoStore.settingsStore.showOverlay = !videoStore.settingsStore.showOverlay : null, + onLongPress: + videoStore.settingsStore.toggleableOverlay ? () => videoStore.settingsStore.showOverlay = !videoStore.settingsStore.showOverlay : null, child: AspectRatio( aspectRatio: 16 / 9, child: Observer( @@ -55,32 +58,34 @@ class Video extends StatelessWidget { ), }, ), - Observer( - builder: (context) { - if (videoStore.paused) { - return VideoOverlay(videoStore: videoStore); + GestureDetector( + onTap: () { + if (textFieldFocus.hasFocus) { + textFieldFocus.unfocus(); + } else { + videoStore.handleVideoTap(); } - return GestureDetector( - onTap: videoStore.handleVideoTap, - child: SizedBox.expand( - child: Observer( - builder: (context) { - return AnimatedOpacity( - opacity: videoStore.overlayVisible ? 1.0 : 0.0, - duration: const Duration(milliseconds: 200), - child: ColoredBox( - color: const Color.fromRGBO(0, 0, 0, 0.5), - child: IgnorePointer( - ignoring: !videoStore.overlayVisible, - child: VideoOverlay(videoStore: videoStore), - ), - ), - ); - }, - ), - ), - ); }, + child: Observer( + builder: (_) { + if (videoStore.paused) return VideoOverlay(videoStore: videoStore); + return SizedBox.expand( + child: Observer( + builder: (_) => AnimatedOpacity( + opacity: videoStore.overlayVisible ? 1.0 : 0.0, + duration: const Duration(milliseconds: 200), + child: ColoredBox( + color: const Color.fromRGBO(0, 0, 0, 0.5), + child: IgnorePointer( + ignoring: !videoStore.overlayVisible, + child: VideoOverlay(videoStore: videoStore), + ), + ), + ), + ), + ); + }, + ), ) ], ); diff --git a/lib/screens/channel/video_chat.dart b/lib/screens/channel/video_chat.dart index b5a5ec15..f2ee64b1 100644 --- a/lib/screens/channel/video_chat.dart +++ b/lib/screens/channel/video_chat.dart @@ -28,6 +28,7 @@ class _VideoChatState extends State { final video = Video( key: GlobalKey(), userLogin: chatStore.channelName, + textFieldFocus: chatStore.textFieldFocusNode, videoStore: VideoStore( twitchApi: context.read(), userLogin: chatStore.channelName,