Add dismiss keyboard when tapping player
Thanks to /u/Icoryx for reporting!
This commit is contained in:
parent
90d1c7e384
commit
9faa4bbecc
2 changed files with 31 additions and 25 deletions
|
|
@ -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),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
)
|
||||
],
|
||||
);
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ class _VideoChatState extends State<VideoChat> {
|
|||
final video = Video(
|
||||
key: GlobalKey(),
|
||||
userLogin: chatStore.channelName,
|
||||
textFieldFocus: chatStore.textFieldFocusNode,
|
||||
videoStore: VideoStore(
|
||||
twitchApi: context.read<TwitchApi>(),
|
||||
userLogin: chatStore.channelName,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue