AudioVisualizerPainter class

Paints a LayerAudioVisualizer in a box, the shapes the export draws.

Use it to preview a visualizer layer in an editor: give it the levels at the moment the preview shows, from LayerAudioVisualizer.levelsAt, and size the CustomPaint like the layer's box. Every shape is measured in that box, so the preview matches the export at any size.

CustomPaint(
  size: layerSize,
  painter: AudioVisualizerPainter.at(visualizer, position),
);
Inheritance

Constructors

AudioVisualizerPainter({required AudioVisualizerStyle style, required Color color, required List<double> levels, double? barFill, Listenable? repaint})
Creates a painter that draws levels, one per band from 0 to 1, in style.
AudioVisualizerPainter.at(LayerAudioVisualizer visualizer, Duration time, {Listenable? repaint})
Creates a painter that draws visualizer as it is at time on the rendered video.
factory

Properties

barFill → double?
How much of its share a bar fills; see LayerAudioVisualizer.barFill.
final
color → Color
The color every shape is filled with.
final
hashCode → int
The hash code for this object.
no setterinherited
levels → List<double>
The level of every band, from 0 to 1.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
semanticsBuilder → SemanticsBuilderCallback?
Returns a function that builds semantic information for the picture drawn by this painter.
no setterinherited
style → AudioVisualizerStyle
How the levels are drawn.
final

Methods

addListener(VoidCallback listener) → void
Register a closure to be notified when it is time to repaint.
inherited
hitTest(Offset position) → bool?
Called whenever a hit test is being performed on an object that is using this custom paint delegate.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
paint(Canvas canvas, Size size) → void
Called whenever the object needs to paint. The given Canvas has its coordinate space configured such that the origin is at the top left of the box. The area of the box is the size of the size argument.
override
removeListener(VoidCallback listener) → void
Remove a previously registered closure from the list of closures that the object notifies when it is time to repaint.
inherited
shouldRebuildSemantics(covariant CustomPainter oldDelegate) → bool
Called whenever a new instance of the custom painter delegate class is provided to the RenderCustomPaint object, or any time that a new CustomPaint object is created with a new instance of the custom painter delegate class (which amounts to the same thing, because the latter is implemented in terms of the former).
inherited
shouldRepaint(covariant AudioVisualizerPainter oldDelegate) → bool
Called whenever a new instance of the custom painter delegate class is provided to the RenderCustomPaint object, or any time that a new CustomPaint object is created with a new instance of the custom painter delegate class (which amounts to the same thing, because the latter is implemented in terms of the former).
override
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited