PreloadVideo<T extends VideoVo, M extends VideoModel<T> > class
封装一个支持预加载、业务控制的播放器 1):预加载 2):播放时避免屏幕熄灭 3):横竖屏切换 4):自定义样式 5):业务化
参数说明: 参数 model 是初始视频列表的基础业务类,开发者需要创建一个类去继承
参数 initPlayIndex 是用于初始播放的下标,即从 第 X 个视频播起
参数 buildPan 是构建视频以外的布局,如:评论、点赞等等
参数 getPlayUrlService 是用于获取播放地址的业务。 当播放列表中的某一个item没有播放地址,此参数必传,用于获取播放地址的逻辑。 无论item有没有播放地址,若传了该参数,则优先使用该参数去获取播放地址。
参数 loadingBuild 是构建获取视频列表过程中的构建布局
参数 errorBuild 是构建获取视频列表过程中失败的构建布局
参数 noDataBuild 是构建获取视频列表后没有数据的构建布局
参数 noMoreBuild 是构建获取视频列表没有更多数据时的构建布局
参数 scrollSpeed 更改pageView的滚动速度,取值0~1,越大则越快,默认0.4。注意:只在首次起作用, 修改值后无法实时生效,销毁页面再重新进入即可。
参数 needVipBuild 加载某个视频,提示需要vip才能播放的布局
参数 needPurchaseBuild 加载某个视频,提示需要购买才能播放的布局
参数 needAdvBuild 加载某个视频,提示需要看广告才能播放的布局
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- PreloadVideo
Constructors
-
PreloadVideo({Key? key, required M model, int initPlayIndex = 0, ItemPanBuilder? buildPan, Future<
ServicePlayStateVo> getPlayUrlService(T item)?, Widget? loadingBuild, Widget? errorBuild, Widget? noDataBuild, Widget? noMoreBuild, double scrollSpeed = 0.4, Widget? needAdvBuild, Widget? needPurchaseBuild, Widget? needVipBuild, Widget? gettingPlayUrlBuild, Widget? getErrorPlayUrlBuild}) -
const
Properties
- buildPan → ItemPanBuilder?
-
以下参数将赋值给列表中的item管理
final
- errorBuild → Widget?
-
final
- getErrorPlayUrlBuild → Widget?
-
final
-
getPlayUrlService
→ Future<
ServicePlayStateVo> Function(T item)? -
final
- gettingPlayUrlBuild → Widget?
-
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- initPlayIndex → int
-
final
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- loadingBuild → Widget?
-
final
- model → M
-
final
- needAdvBuild → Widget?
-
final
- needPurchaseBuild → Widget?
-
final
- needVipBuild → Widget?
-
final
- noDataBuild → Widget?
-
final
- noMoreBuild → Widget?
-
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- scrollSpeed → double
-
滚动控制相关
final
Methods
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → State< PreloadVideo< VideoVo, VideoModel< >VideoVo> > -
Creates the mutable state for this widget at a given location in the tree.
override
-
debugDescribeChildren(
) → List< DiagnosticsNode> -
Returns a list of DiagnosticsNode objects describing this node's
children.
inherited
-
debugFillProperties(
DiagnosticPropertiesBuilder properties) → void -
Add additional properties associated with the node.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toDiagnosticsNode(
{String? name, DiagnosticsTreeStyle? style}) → DiagnosticsNode -
Returns a debug representation of the object that is used by debugging
tools and by DiagnosticsNode.toStringDeep.
inherited
-
toString(
{DiagnosticLevel minLevel = DiagnosticLevel.info}) → String -
A string representation of this object.
inherited
-
toStringDeep(
{String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug, int wrapWidth = 65}) → String -
Returns a string representation of this node and its descendants.
inherited
-
toStringShallow(
{String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) → String -
Returns a one-line detailed description of the object.
inherited
-
toStringShort(
) → String -
A short, textual description of this widget.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited