Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
G
gz_video_player
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
蒋俊
gz_video_player
Commits
82eec7f9
提交
82eec7f9
authored
10月 20, 2023
作者:
jungleiOS
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
增加长按倍速提示
上级
41847cfd
隐藏空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
128 行增加
和
10 行删除
+128
-10
video.dart
lib/video.dart
+19
-2
video_speed.dart
lib/video_speed.dart
+25
-0
video_style.dart
lib/video_style.dart
+7
-0
video_estimated_time_bar.dart
lib/widget/video_estimated_time_bar.dart
+30
-8
video_speed_tip.dart
lib/widget/video_speed_tip.dart
+47
-0
没有找到文件。
lib/video.dart
浏览文件 @
82eec7f9
...
...
@@ -16,8 +16,9 @@ import 'package:gz_video_player/widget/video_bottom_bar.dart';
import
'package:gz_video_player/widget/video_definition_side_bar.dart'
;
import
'package:gz_video_player/widget/video_loading_view.dart'
;
import
'package:gz_video_player/widget/video_speed_bar.dart'
;
import
'package:gz_video_player/widget/video_speed_tip.dart'
;
import
'package:gz_video_player/widget/video_top_bar.dart'
;
import
'package:gz_video_player/widget/vid
oe
_estimated_time_bar.dart'
;
import
'package:gz_video_player/widget/vid
eo
_estimated_time_bar.dart'
;
import
'package:gz_video_player/widget/volume.dart'
;
import
'package:screen_brightness/screen_brightness.dart'
;
import
'package:video_player/video_player.dart'
;
...
...
@@ -161,6 +162,9 @@ class GZVideoPlayerState extends State<GZVideoPlayer>
/// 是否隐藏速度栏
bool
_hiddenSpeed
=
true
;
/// 是否隐藏速度tip
bool
_hiddenSpeedTip
=
true
;
/// 倍数按钮标题
String
_speedTitle
=
''
;
...
...
@@ -852,6 +856,13 @@ class GZVideoPlayerState extends State<GZVideoPlayer>
},
),
/// 倍速提示
VideoSpeedTip
(
hidden:
_hiddenSpeedTip
,
videoSpeedTipStyle:
widget
.
videoStyle
.
videoSpeedTipStyle
,
speed:
_speedTitle
,
),
/// 清晰度设置栏
VideoDefinitionSideBar
(
itemList:
widget
.
playOptions
.
definitionList
,
...
...
@@ -877,7 +888,11 @@ class GZVideoPlayerState extends State<GZVideoPlayer>
),
/// 预估时间栏
VideoEstimatedTimeBar
(
notifier:
_estimatedTimeNotifier
),
VideoEstimatedTimeBar
(
notifier:
_estimatedTimeNotifier
,
videoEstimatedTimeBarStyle:
widget
.
videoStyle
.
videoEstimatedTimeBarStyle
,
),
widget
.
brightnessWidget
??
BrightnessWidget
(
...
...
@@ -1032,6 +1047,7 @@ class GZVideoPlayerState extends State<GZVideoPlayer>
_controller
.
setPlaybackSpeed
(
item
.
speed
);
widget
.
onSpeedChange
?.
call
(
item
);
_speedTitle
=
item
.
title
;
_hiddenSpeedTip
=
false
;
setState
(()
{});
},
...
...
@@ -1041,6 +1057,7 @@ class GZVideoPlayerState extends State<GZVideoPlayer>
_controller
.
setPlaybackSpeed
(
_speedItem
.
speed
);
widget
.
onSpeedChange
?.
call
(
_speedItem
);
_speedTitle
=
_speedItem
.
title
;
_hiddenSpeedTip
=
true
;
setState
(()
{});
},
...
...
lib/video_speed.dart
浏览文件 @
82eec7f9
...
...
@@ -42,3 +42,28 @@ class VideoSpeedButtonStyle {
),
});
}
class
VideoSpeedTipStyle
{
final
AlignmentGeometry
alignment
;
final
Size
size
;
final
Widget
icon
;
final
Decoration
decoration
;
final
EdgeInsetsGeometry
middlePadding
;
final
TextStyle
speedTextStyle
;
final
TextStyle
describeTextStyle
;
final
String
describe
;
VideoSpeedTipStyle
({
this
.
alignment
=
const
FractionalOffset
(
0.5
,
0.2
),
this
.
size
=
const
Size
(
140.0
,
40.0
),
this
.
icon
=
const
Icon
(
Icons
.
speed
,
size:
20.0
,
color:
Colors
.
white
),
this
.
decoration
=
const
BoxDecoration
(
color:
Color
(
0x7F000000
),
borderRadius:
BorderRadius
.
all
(
Radius
.
circular
(
4.0
)),
),
this
.
middlePadding
=
const
EdgeInsets
.
symmetric
(
horizontal:
14.0
),
this
.
speedTextStyle
=
const
TextStyle
(
color:
Colors
.
blue
),
this
.
describeTextStyle
=
const
TextStyle
(
color:
Colors
.
white
),
this
.
describe
=
'快进中'
,
});
}
lib/video_style.dart
浏览文件 @
82eec7f9
...
...
@@ -7,6 +7,7 @@ import 'package:gz_video_player/video_speed.dart';
import
'package:gz_video_player/video_subtitles.dart'
;
import
'package:gz_video_player/video_top_bar_style.dart'
;
import
'package:gz_video_player/video_volume_style.dart'
;
import
'package:gz_video_player/widget/video_estimated_time_bar.dart'
;
/// 播放器样式
class
VideoStyle
{
...
...
@@ -17,6 +18,8 @@ class VideoStyle {
VideoLoadingStyle
?
videoLoadingStyle
,
VideoSpeedButtonStyle
?
videoSpeedButtonStyle
,
VideoSpeedItemStyle
?
videoSpeedItemStyle
,
VideoSpeedTipStyle
?
videoSpeedTipStyle
,
VideoEstimatedTimeBarStyle
?
videoEstimatedTimeBarStyle
,
VideoDefinitionItemStyle
?
videoDefinitionItemStyle
,
VideoDefinitionButtonStyle
?
videoDefinitionButtonStyle
,
VideoBrightnessStyle
?
videoBrightnessStyle
,
...
...
@@ -43,6 +46,8 @@ class VideoStyle {
videoSpeedButtonStyle
=
videoSpeedButtonStyle
??
VideoSpeedButtonStyle
(),
videoSpeedItemStyle
=
videoSpeedItemStyle
??
VideoSpeedItemStyle
(),
videoSpeedTipStyle
=
videoSpeedTipStyle
??
VideoSpeedTipStyle
(),
videoEstimatedTimeBarStyle
=
videoEstimatedTimeBarStyle
??
VideoEstimatedTimeBarStyle
(),
videoDefinitionItemStyle
=
videoDefinitionItemStyle
??
VideoDefinitionItemStyle
(),
videoDefinitionButtonStyle
=
videoDefinitionButtonStyle
??
VideoDefinitionButtonStyle
(),
videoBrightnessStyle
=
videoBrightnessStyle
??
VideoBrightnessStyle
(),
...
...
@@ -54,6 +59,8 @@ class VideoStyle {
final
VideoLoadingStyle
videoLoadingStyle
;
//loading样式
final
VideoSpeedButtonStyle
videoSpeedButtonStyle
;
// 倍速按钮样式
final
VideoSpeedItemStyle
videoSpeedItemStyle
;
// 倍速 item 样式
final
VideoSpeedTipStyle
videoSpeedTipStyle
;
// 长按倍速提示样式
final
VideoEstimatedTimeBarStyle
videoEstimatedTimeBarStyle
;
final
VideoDefinitionItemStyle
videoDefinitionItemStyle
;
// 清晰度 item 样式
final
VideoDefinitionButtonStyle
videoDefinitionButtonStyle
;
// 清晰度按钮样式
final
VideoBrightnessStyle
videoBrightnessStyle
;
// 屏幕亮度样式
...
...
lib/widget/vid
oe
_estimated_time_bar.dart
→
lib/widget/vid
eo
_estimated_time_bar.dart
浏览文件 @
82eec7f9
import
'package:flutter/material.dart'
;
class
VideoEstimatedTimeBarStyle
{
final
AlignmentGeometry
alignment
;
final
Decoration
decoration
;
final
EdgeInsetsGeometry
padding
;
final
TextStyle
textStyle
;
VideoEstimatedTimeBarStyle
({
this
.
alignment
=
Alignment
.
center
,
this
.
decoration
=
const
BoxDecoration
(
color:
Color
(
0x7F000000
),
borderRadius:
BorderRadius
.
all
(
Radius
.
circular
(
4.0
)),
),
this
.
padding
=
const
EdgeInsets
.
all
(
8.0
),
this
.
textStyle
=
const
TextStyle
(
color:
Colors
.
white
),
});
}
class
VideoEstimatedTimeBar
extends
StatefulWidget
{
const
VideoEstimatedTimeBar
({
super
.
key
,
required
this
.
notifier
});
VideoEstimatedTimeBar
({
super
.
key
,
required
this
.
notifier
,
VideoEstimatedTimeBarStyle
?
videoEstimatedTimeBarStyle
,
})
:
videoEstimatedTimeBarStyle
=
videoEstimatedTimeBarStyle
??
VideoEstimatedTimeBarStyle
();
final
EstimatedTimeNotifier
notifier
;
final
VideoEstimatedTimeBarStyle
videoEstimatedTimeBarStyle
;
@override
State
<
VideoEstimatedTimeBar
>
createState
()
=>
_VideoEstimatedTimeBarState
();
...
...
@@ -12,6 +35,9 @@ class VideoEstimatedTimeBar extends StatefulWidget {
class
_VideoEstimatedTimeBarState
extends
State
<
VideoEstimatedTimeBar
>
{
EstimatedTimeNotifier
get
notifier
=>
widget
.
notifier
;
VideoEstimatedTimeBarStyle
get
videoEstimatedTimeBarStyle
=>
widget
.
videoEstimatedTimeBarStyle
;
String
_position
=
'--:--'
;
String
_duration
=
'--:--'
;
bool
_hidden
=
true
;
...
...
@@ -27,13 +53,10 @@ class _VideoEstimatedTimeBarState extends State<VideoEstimatedTimeBar> {
return
Offstage
(
offstage:
_hidden
,
child:
Align
(
alignment:
Alignment
.
center
,
alignment:
videoEstimatedTimeBarStyle
.
alignment
,
child:
Container
(
decoration:
BoxDecoration
(
color:
Colors
.
black
.
withOpacity
(
0.5
),
borderRadius:
const
BorderRadius
.
all
(
Radius
.
circular
(
6.0
)),
),
padding:
const
EdgeInsets
.
all
(
8.0
),
decoration:
videoEstimatedTimeBarStyle
.
decoration
,
padding:
videoEstimatedTimeBarStyle
.
padding
,
child:
Text
(
'
$_position
/
$_duration
'
,
style:
const
TextStyle
(
...
...
@@ -77,7 +100,6 @@ class EstimatedTimeNotifier with ChangeNotifier {
bool
get
isEnd
=>
_isEnd
;
void
update
({
required
Duration
position
,
required
Duration
duration
})
{
_position
=
position
;
_duration
=
duration
;
...
...
lib/widget/video_speed_tip.dart
0 → 100644
浏览文件 @
82eec7f9
import
'package:flutter/material.dart'
;
import
'package:gz_video_player/video_speed.dart'
;
class
VideoSpeedTip
extends
StatelessWidget
{
VideoSpeedTip
({
super
.
key
,
VideoSpeedTipStyle
?
videoSpeedTipStyle
,
this
.
speed
=
'1.0X'
,
this
.
hidden
=
true
,
})
:
videoSpeedTipStyle
=
videoSpeedTipStyle
??
VideoSpeedTipStyle
();
final
VideoSpeedTipStyle
videoSpeedTipStyle
;
final
String
speed
;
final
bool
hidden
;
@override
Widget
build
(
BuildContext
context
)
{
return
Offstage
(
offstage:
hidden
,
child:
Align
(
alignment:
videoSpeedTipStyle
.
alignment
,
child:
Container
(
width:
videoSpeedTipStyle
.
size
.
width
,
height:
videoSpeedTipStyle
.
size
.
height
,
decoration:
videoSpeedTipStyle
.
decoration
,
child:
Row
(
mainAxisAlignment:
MainAxisAlignment
.
center
,
children:
[
videoSpeedTipStyle
.
icon
,
Padding
(
padding:
videoSpeedTipStyle
.
middlePadding
,
child:
Text
(
speed
,
style:
videoSpeedTipStyle
.
speedTextStyle
,
),
),
Text
(
videoSpeedTipStyle
.
describe
,
style:
videoSpeedTipStyle
.
describeTextStyle
,
),
],
),
),
),
);
}
}
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论