Open matthew-carroll opened 4 years ago
I have a related issue which I think probably has the same underlying problem. I'm unable to change the mouse cursor when wrapping a VideoPlayer in an InkWell and setting the mouseCursor property.
/cc @yjbanov , looks like platform gesture issue.
video_player: ^0.10.12
Hi @matthew-carroll, Thanks for filing the issue, I verified this issue on the latest stable and the master channel and I could see the cursor changing to clickable cursor when hovered on the button with video in background, But when the button loses the hover the handcursor doesn't change back to normal. So it looks like this isn't fixed yet. The behaviour is similar on both safari and chrome browsers.
Stacking a zero-opacity container over the VideoPlayer resolves it. Add this child: Container(color: Colors.black.withOpacity(0.0))
in your Stack list right after the child that includes VideoPlayer. With this invisible widget on top, the VideoPlayer can no longer prevent the intended behavior of mouse cursor in response to hovering over say a Button or a MouseRegion.
Stack(
children: [
_videoController.value.isInitialized
? SizedBox.expand(
child: FittedBox(
fit: BoxFit.cover,
child: SizedBox(
width: _videoController.value.size.width,
height: _videoController.value.size.height,
child: VideoPlayer(_videoController),
),
),
)
: const SizedBox(),
Container(color: Colors.black.withOpacity(0.0)),
Center(
child: RaisedButton(
child: Text('Click Me!'),
onPressed: () {
print('Pressed');
},
),
),
],
),
I am able to reproduce this issue using the latest version of the video_player
package and on the latest stable
and master
channels.
Code Sample
I have a
Stack
with aVideoPlayer
sitting behind various other UI elements. It appears that theVideoPlayer
prevents the expected hand cursor for any button shown on top of theVideoPlayer
. It also prevents direct usage of aMouseRegion
, too. If I comment out theVideoPlayer
, the buttons correctly show the hand cursor.I assume this is the result of automatic decisions about what kind of web elements to use for this subtree?
Here is a simplified version of my widget tree for reproduction. I don't think my use of
SizedBox
andFittedBox
are relevant, but I included them just in case.Flutter 1.21.0-1.0.pre • channel master • https://github.com/flutter/flutter.git Framework • revision 6eaaf1650e (2 weeks ago) • 2020-07-09 18:04:37 -0700 Engine • revision 9b3e3410f0 Tools • Dart 2.9.0 (build 2.9.0-20.0.dev 06cb010247)