AudioPlayerWidget class
The main widget for the audio player. It accepts various parameters to configure the player's appearance and behavior.
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- AudioPlayerWidget
Constructors
-
AudioPlayerWidget({Key? key, VoiceNotePlayerController? controller, bool autoLoad = true, bool autoPlay = false, TextDirection textDirection = TextDirection.ltr, required String? audioPath, AudioType audioType = AudioType.directFile, List<
double> ? audioSpeeds, double size = 56, double width = 400, Color backgroundColor = Colors.blueAccent, Color iconColor = Colors.white, TextStyle? timerTextStyle, PlayIconShapeType shapeType = PlayIconShapeType.circular, PlayerStyle playerStyle = PlayerStyle.style1, double progressBarHeight = 3.0, Color progressBarColor = Colors.blueAccent, Color progressBarBackgroundColor = Colors.grey, bool showProgressBar = true, bool showTimer = true, bool showSpeedControl = true, dynamic onError(String message)?, dynamic onPause()?, dynamic onPlay(bool isPlaying)?, dynamic onSeek(double value)?, dynamic onSpeedChange(double speed)?}) -
Creates a new instance of the AudioPlayerWidget widget.
const
Properties
- audioPath → String?
-
The path to the audio file (can be a URL, local path, or asset).
final
-
audioSpeeds
→ List<
double> ? -
A list of selectable playback speeds (e.g.,
0.5, 1.0, 1.5, 2.0).final - audioType → AudioType
-
The source type of the audio (URL, asset, or file).
final
- autoLoad → bool
-
Whether to automatically load the audio when the widget is initialized.
final
- autoPlay → bool
-
Whether to automatically start playing the audio when loaded.
final
- backgroundColor → Color
-
The background color of the play/pause button.
final
- controller → VoiceNotePlayerController?
-
The controller for the audio player.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- iconColor → Color
-
The color of the play/pause icon.
final
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- onError → dynamic Function(String message)?
-
Callback function triggered when an error occurs.
final
- onPause → dynamic Function()?
-
Callback function triggered when the audio is paused.
final
- onPlay → dynamic Function(bool isPlaying)?
-
Callback function triggered when playback starts or stops.
final
- onSeek → dynamic Function(double value)?
-
Callback function triggered when the user seeks through the audio.
final
- onSpeedChange → dynamic Function(double speed)?
-
Callback function triggered when the playback speed changes.
final
- playerStyle → PlayerStyle
-
The visual style to use for the player (determines layout and controls).
final
- progressBarBackgroundColor → Color
-
The background color of the progress bar.
final
- progressBarColor → Color
-
The color of the active progress bar.
final
- progressBarHeight → double
-
The height of the progress bar (if shown).
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- shapeType → PlayIconShapeType
-
The shape of the play/pause button (e.g., circular or square).
final
- showProgressBar → bool
-
Whether to show the progress bar.
final
- showSpeedControl → bool
-
Whether to show the playback speed control.
final
- showTimer → bool
-
Whether to show the current time/duration timer.
final
- size → double
-
The size of the play/pause icon button.
final
- textDirection → TextDirection
-
The text direction for layout (e.g., left-to-right or right-to-left).
final
- timerTextStyle → TextStyle?
-
The text style for the timer display (if shown).
final
- width → double
-
The overall width of the player widget.
final
Methods
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → State< AudioPlayerWidget> -
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