VoiceCompactStyle class
A compact voice recording widget that shows a record/stop button, animated waveform, timer, and optional cancel hints.
This widget is highly customizable and is intended to be used in voice recording features.
Example usage:
VoiceCompactStyle(
isRecording: true,
showCancelHint: true,
showSwipeLeftToCancel: true,
dragToLeftText: 'Swipe left to cancel',
dragToLeftTextStyle: TextStyle(color: Colors.red),
showTimerText: true,
isCancelled: false,
cancelDoneText: 'Cancelled',
timerTextStyle: TextStyle(color: Colors.white),
seconds: 30,
cancelHintColor: Colors.red,
timerFontSize: 14,
iconSize: 50,
backgroundColorSecond: Colors.grey,
backgroundColorFirst: Colors.red,
stopRecordingWidget: Icon(Icons.stop),
startRecordingWidget: Icon(Icons.mic),
iconColor: Colors.white,
containerColor: Colors.black12,
borderColor: Colors.grey,
borderRadius: 12,
idleWavesColor: Colors.grey,
recordingWavesColor: Colors.red,
speed: Duration(milliseconds: 200),
)
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatelessWidget
- VoiceCompactStyle
Constructors
- VoiceCompactStyle.new({Key? key, required bool isRecording, required bool showCancelHint, required bool showSwipeLeftToCancel, required String dragToLeftText, required TextStyle? dragToLeftTextStyle, required bool showTimerText, required bool isCancelled, required String cancelDoneText, required TextStyle? timerTextStyle, required int seconds, required Color cancelHintColor, required double timerFontSize, required double iconSize, required Color backgroundColorSecond, required Color backgroundColorFirst, required Widget? stopRecordingWidget, required Widget? startRecordingWidget, required Color iconColor, required Color? containerColor, required Color? borderColor, required double? borderRadius, required Color? idleWavesColor, required Color? recordingWavesColor, required Duration? speed})
-
Creates a VoiceCompactStyle widget.
const
Properties
- backgroundColorFirst → Color
-
Background color when recording.
final
- backgroundColorSecond → Color
-
Background color when not recording.
final
- borderColor → Color?
-
Border color of the container.
final
- borderRadius → double?
-
Radius of the container's border.
final
- cancelDoneText → String
-
Text to show if recording was cancelled.
final
- cancelHintColor → Color
-
Color used for the cancel hint and timer.
final
- containerColor → Color?
-
Background color of the container.
final
- dragToLeftText → String
-
Text to show for the swipe left to cancel hint.
final
- dragToLeftTextStyle → TextStyle?
-
Custom style for dragToLeftText.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- iconColor → Color
-
Icon color for the mic/stop icon.
final
- iconSize → double
-
Size of the recording icon button.
final
- idleWavesColor → Color?
-
Color of the waveform bars when idle.
final
- isCancelled → bool
-
Indicates if the recording was cancelled.
final
- isRecording → bool
-
Whether recording is in progress.
final
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- recordingWavesColor → Color?
-
Color of the waveform bars when recording.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- seconds → int
-
The number of seconds recorded.
final
- showCancelHint → bool
-
Whether to show the cancel hint below the UI.
final
- showSwipeLeftToCancel → bool
-
Whether to show the "swipe left to cancel" instruction.
final
- showTimerText → bool
-
Whether to show the recording timer.
final
- speed → Duration?
-
Speed of waveform animation.
final
- startRecordingWidget → Widget?
-
Custom widget to show when not recording (e.g., a mic icon).
final
- stopRecordingWidget → Widget?
-
Custom widget to show when recording (e.g., a stop button).
final
- timerFontSize → double
-
Font size for the timer.
final
- timerTextStyle → TextStyle?
-
Custom text style for the timer.
final
Methods
-
build(
BuildContext context) → Widget -
Describes the part of the user interface represented by this widget.
override
-
createElement(
) → StatelessElement -
Creates a StatelessElement to manage this widget's location in the tree.
inherited
-
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