提交 993eb30c authored 作者: jungleiOS's avatar jungleiOS

dispose 时销毁动画控制器 重置按钮不根据结束回调是否实现而显示

上级 6abf309a
......@@ -213,6 +213,7 @@ class GZVideoPlayerState extends State<GZVideoPlayer>
]);
// 常亮
Wakelock.toggle(enable: true);
/// 倍数按钮标题
_speedTitle = widget.videoStyle.videoSpeedButtonStyle.title;
_initPlayer();
......@@ -230,6 +231,7 @@ class GZVideoPlayerState extends State<GZVideoPlayer>
void dispose() {
_clearHideControlBarTimer();
_controller.dispose();
_controlBarAnimationController.dispose();
///竖屏
SystemChrome.setPreferredOrientations([
......@@ -308,8 +310,8 @@ class GZVideoPlayerState extends State<GZVideoPlayer>
});
} else {
if (oPosition >= oDuration) {
if (widget.onEnded != null) {
resetVideoPlayer();
if (widget.onEnded != null) {
widget.onEnded!(_controller.value);
}
}
......@@ -638,7 +640,8 @@ class GZVideoPlayerState extends State<GZVideoPlayer>
: const Text(""),
/// 主字幕
widget.videoStyle.videoSubtitlesStyle.mainTitle ?? Align(
widget.videoStyle.videoSubtitlesStyle.mainTitle ??
Align(
alignment: Alignment.bottomCenter,
child: Container(
padding: const EdgeInsets.fromLTRB(10, 0, 10, 30),
......@@ -646,15 +649,16 @@ class GZVideoPlayerState extends State<GZVideoPlayer>
maxLines: 2,
textAlign: TextAlign.center,
style: TextStyle(
color: widget
.videoStyle.videoSubtitlesStyle.mainTitleColor,
color:
widget.videoStyle.videoSubtitlesStyle.mainTitleColor,
fontSize: widget
.videoStyle.videoSubtitlesStyle.mainTitleFontSize)),
),
),
/// 辅字幕
widget.videoStyle.videoSubtitlesStyle.subTitle ?? Align(
widget.videoStyle.videoSubtitlesStyle.subTitle ??
Align(
alignment: Alignment.bottomCenter,
child: Container(
padding: const EdgeInsets.all(10),
......@@ -690,12 +694,14 @@ class GZVideoPlayerState extends State<GZVideoPlayer>
},
),
widget.brightnessWidget ?? BrightnessWidget(
widget.brightnessWidget ??
BrightnessWidget(
brightness: _brightness,
videoBrightnessStyle: widget.videoStyle.videoBrightnessStyle,
),
widget.volumeWidget ?? VolumeWidget(
widget.volumeWidget ??
VolumeWidget(
volume: _volume,
videoVolumeStyle: widget.videoStyle.videoVolumeStyle,
),
......@@ -760,8 +766,8 @@ class GZVideoPlayerState extends State<GZVideoPlayer>
if (!_controller.value.isInitialized) return;
},
onVerticalDragUpdate: (DragUpdateDetails details) async {
if (!_controller.value.isInitialized ||
details.primaryDelta == null) return;
if (!_controller.value.isInitialized || details.primaryDelta == null)
return;
// 右侧垂直滑动 - 音量调节
if (details.globalPosition.dx >= (screenSize.width / 2)) {
_volume.value = _controller.value.volume;
......@@ -825,8 +831,11 @@ class GZVideoPlayerState extends State<GZVideoPlayer>
child: AspectRatio(
aspectRatio: _controller.value.aspectRatio,
child: VideoPlayer(_controller),
)),
))),
),
),
),
),
),
///控制拦以及(可拓展)元素
];
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论