ProgressBar class

用于显示或设置正在播放的音频或视频内容位置的增强版进度条组件。

相比原版 ProgressBar,增强支持:

所有新增参数均有默认值,仅使用原版参数时行为与之一致。

Inheritance

Constructors

ProgressBar({Key? key, required Duration progress, required Duration total, Duration? buffered, ValueChanged<Duration>? onSeek, ThumbDragStartCallback? onDragStart, ThumbDragUpdateCallback? onDragUpdate, VoidCallback? onDragEnd, double barHeight = 5.0, Color? baseBarColor, Color? progressBarColor, Color? bufferedBarColor, BarCapShape barCapShape = BarCapShape.round, double? barBorderRadius, double thumbRadius = 10.0, Color? thumbColor, Color? thumbGlowColor, double thumbGlowRadius = 30.0, bool thumbCanPaintOutsideBar = true, ThumbShape thumbShape = ThumbShape.circle, double lineThumbWidth = 4.0, double lineThumbHeight = 14.0, double lineThumbBorderRadius = 2.0, double thumbBarGap = 0.0, double thumbGap = 0.0, TimeLabelLocation? timeLabelLocation, TimeLabelType? timeLabelType, TextStyle? timeLabelTextStyle, double timeLabelPadding = 0.0, SineWaveConfig? sineWaveConfig})
const

Properties

barBorderRadius double?
进度条的圆角半径。非 null 时覆盖 barCapShape 行为, 每段两端均应用圆角。
final
barCapShape BarCapShape
进度条左端和右端的形状。默认 BarCapShape.round
final
barHeight double
进度条的垂直粗细。默认 5.0。
final
baseBarColor Color?
播放开始前进度条的颜色。
final
buffered Duration?
媒体的当前缓冲内容。
final
bufferedBarColor Color?
progressbuffered 之间进度条的颜色。
final
hashCode int
The hash code for this object.
no setterinherited
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
lineThumbBorderRadius double
line 形状滑块的圆角半径。默认 2.0。
final
lineThumbHeight double
line 形状滑块的高度。默认 14.0。
final
lineThumbWidth double
line 形状滑块的宽度。默认 4.0。
final
onDragEnd VoidCallback?
用户完成滑块移动后的回调。
final
onDragStart ThumbDragStartCallback?
用户开始移动滑块时的回调。
final
onDragUpdate ThumbDragStartCallback?
用户正在移动滑块时的回调。
final
onSeek ValueChanged<Duration>?
用户移动滑块后的回调。
final
progress Duration
媒体的已播放时间。
final
progressBarColor Color?
当前播放位置左侧进度条的颜色。
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
sineWaveConfig SineWaveConfig?
正弦波浪线动画配置。null 时渲染平直进度条。
final
thumbBarGap double
进度条端点与滑块之间的视觉间隙。默认 0.0。
final
thumbCanPaintOutsideBar bool
滑块是否可绘制在进度条边界之外。默认 true
final
thumbColor Color?
滑块颜色。
final
thumbGap double
滑块周围的间隙,使进度条在滑块处断开为左右两段。默认 0.0。
final
thumbGlowColor Color?
滑块拖拽光晕颜色。
final
thumbGlowRadius double
滑块拖拽光晕半径。默认 30.0。
final
thumbRadius double
可移动滑块的半径。默认 10.0。
final
thumbShape ThumbShape
滑块的视觉形状。默认 ThumbShape.circle
final
timeLabelLocation TimeLabelLocation?
时间标签相对于进度条的位置。
final
timeLabelPadding double
时间标签与进度条之间的额外间距。默认 0.0。
final
timeLabelTextStyle TextStyle?
时间标签的 TextStyle
final
timeLabelType TimeLabelType?
右侧时间标签的显示内容。
final
total Duration
媒体的总时长。
final

Methods

createElement() StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() State<ProgressBar>
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