AudioWaveform class

A widget that displays an audio waveform visualization.

This widget renders WaveformData as a series of vertical bars representing audio amplitude over time. It supports both mono and stereo audio, with stereo displaying left channel above and right channel below the center line.

Example usage:

AudioWaveform(
  waveform: waveformData,
  style: WaveformStyle(
    waveColor: Colors.blue,
    backgroundColor: Colors.black,
  ),
)

For interactive waveforms with selection, use AudioWaveform.interactive:

AudioWaveform.interactive(
  waveform: waveformData,
  currentPosition: currentPositionMs,
  onSeek: (positionMs) => player.seek(positionMs),
)

For streaming waveforms that update progressively, use AudioWaveform.streaming:

AudioWaveform.streaming(
  config: WaveformConfigs(path: audioPath),
  style: WaveformStyle(waveColor: Colors.green),
)
Inheritance

Constructors

AudioWaveform({Key? key, required WaveformData? waveform, WaveformStyle style = const WaveformStyle()})
Creates an AudioWaveform widget.
const
AudioWaveform.interactive({Key? key, required WaveformData? waveform, required Duration? currentPosition, required ValueChanged<Duration>? onSeek, WaveformStyle style = const WaveformStyle()})
Creates an interactive AudioWaveform with position indicator and seek support.
const
AudioWaveform.streaming({Key? key, required WaveformConfigs config, WaveformStyle style = const WaveformStyle(), ValueChanged<Duration>? onSeek, bool showPositionIndicator = false, Duration? currentPosition, VoidCallback? onComplete})
Creates a streaming AudioWaveform that displays chunks progressively.
const

Properties

config WaveformConfigs?
The waveform configuration for streaming mode.
final
currentPosition Duration?
Current playback position (for interactive mode).
final
hashCode int
The hash code for this object.
no setterinherited
isStreaming bool
Whether this widget is in streaming mode.
no setter
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
onComplete VoidCallback?
Called when streaming waveform generation is complete.
final
onSeek ValueChanged<Duration>?
Callback when user seeks to a position. Receives position in milliseconds.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
showPositionIndicator bool
Whether to show the position indicator line.
final
style WaveformStyle
Visual styling options for the waveform.
final
waveform WaveformData?
The waveform data to render (for non-streaming mode).
final

Methods

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