RectangleWaveform class

RectangleWaveform paints a waveform where each sample is represented as rectangle block. It's inspired by the @soundcloud audio track on web.

{@tool snippet} Example :

RectangleWaveform(
  maxDuration: maxDuration,
  elapsedDuration: elapsedDuration,
  samples: samples,
  height: 300,
  width: MediaQuery.of(context).size.width,
)

{@end-tool}

Inheritance

Constructors

RectangleWaveform({Key? key, required List<double> samples, required double height, required double width, Duration? maxDuration, Duration? elapsedDuration, Color activeColor = Colors.red, Color inactiveColor = Colors.blue, Gradient? activeGradient, Gradient? inactiveGradient, double borderWidth = 1.0, Color activeBorderColor = Colors.white, Color inactiveBorderColor = Colors.white, bool showActiveWaveform = true, bool absolute = false, bool invert = false, bool isRoundedRectangle = false, bool isCentered = false})

Properties

absolute bool
Makes the waveform absolute. Draws the waveform along the positive y-axis. Samples are processed such that we end up with positive sample values.
finalinherited
activeBorderColor Color
The color of the active waveform border.
final
activeColor Color
The color of the active waveform.
final
activeGradient Gradient?
The gradient of the active waveform.
final
borderWidth double
The width of the border of the waveform.
final
elapsedDuration Duration?
Elapsed duration of the audio.
finalinherited
hashCode int
The hash code for this object.
no setterinherited
height double
Height of the canvas on which the waveform will be drawn.
finalinherited
inactiveBorderColor Color
The color of the inactive waveform border.
final
inactiveColor Color
The color of the inactive waveform.
final
inactiveGradient Gradient?
The gradient of the inactive waveform.
final
invert bool
Inverts/Flips the waveform along x-axis. Samples are processed such that we end up with samples having opposite sign.
finalinherited
isCentered bool
If true then rectangles are centered along the Y-axis with respect to their center along their height.
final
isRoundedRectangle bool
If true then rounded rectangles are drawn instead of regular rectangles.
final
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
maxDuration Duration?
Maximum duration of the audio.
finalinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
samples List<double>
Audio samples raw input. This raw samples are processed before being used to paint the waveform.
finalinherited
showActiveWaveform bool
Whether to show the active waveform or not.
finalinherited
waveformAlignment WaveformAlignment
Alignment of the waveform in the canvas.
finalinherited
width double
Width of the canvas on which the waveform will be drawn.
finalinherited

Methods

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