video_player 按键监听

This commit is contained in:
shikong 2023-11-25 18:04:28 +08:00
parent a88c9d6298
commit 1d621444fb

View File

@ -114,11 +114,18 @@ class _CustomVideoPlayerState extends State<CustomVideoPlayer> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
toolbarHeight: 35,
),
// appBar: AppBar(
// toolbarHeight: 35,
// ),
body: player == null
? Center(
? PopScope(
onPopInvoked: (val) {
if (!val) {
return;
}
_controller!.pause();
},
child: Center(
child: _controller!.value.isInitialized
? AspectRatio(
aspectRatio: _controller!.value.aspectRatio,
@ -130,6 +137,7 @@ class _CustomVideoPlayerState extends State<CustomVideoPlayer> {
),
)
: Container(),
),
)
: Container(
alignment: Alignment.center,
@ -152,11 +160,9 @@ class _CustomVideoPlayerState extends State<CustomVideoPlayer> {
}
this.player?.exitFullScreen();
},
child: Stack(
children: [
child: Stack(children: [
defaultFijkPanelBuilder(
player, data, context, viewSize, texturePos),
]),
));
},