progressBar method
ProgressBar
progressBar({
- required FlutterNativeGetxController controller,
- PlayerProgressColors? progressColors,
- required void onSeekListener(
- Duration duration
Implementation
ProgressBar progressBar(
{required FlutterNativeGetxController controller,
PlayerProgressColors? progressColors,
required void Function(Duration duration) onSeekListener}) {
PlayerProgressColors _progressColors;
if (progressColors != null) {
_progressColors = progressColors;
} else {
_progressColors = PlayerProgressColors();
}
Duration progress = controller.durationState?.progress ?? Duration.zero;
Duration buffered = controller.durationState?.buffered ?? Duration.zero;
Duration total = controller.durationState?.total ?? Duration.zero;
return ProgressBar(
progress: progress,
buffered: buffered,
total: total,
onSeek: (duration) {
progress = duration;
onSeekListener.call(duration);
controller.playerMethodManager
.getStreamControllerDurationState()
.sink
.add(DurationState(
progress: progress, buffered: buffered, total: total));
},
onDragStart: (_) {
controller.playerMethodManager.pauseListenerPosition();
},
onDragEnd: () {
controller.playerMethodManager.startListenerPosition();
},
baseBarColor: _progressColors.baseBarColor,
progressBarColor: _progressColors.playedColor,
bufferedBarColor: _progressColors.bufferedColor,
barHeight: 4,
thumbRadius: 6,
thumbGlowRadius: 12,
thumbGlowColor: _progressColors.thumbColor,
thumbColor: _progressColors.thumbColor,
timeLabelLocation: TimeLabelLocation.none,
);
}