VoiceSearchWidget class

A customizable voice search widget that enables speech recognition.

This widget allows users to start and stop voice search by tapping on it. It provides animation effects, customizable colors, icons, and optional event callbacks for when listening starts or stops.

Inheritance

Constructors

VoiceSearchWidget({Key? key, String localeCode = 'en_US', Color activeWidgetColor = Colors.amberAccent, Color inactiveWidgetColor = Colors.lightBlue, IconData activeIcon = Icons.mic_off, IconData inactiveIcon = Icons.mic, double? elevation, Color? borderColor, double maxRadius = 30, double minRadius = 25, Duration animationDuration = const Duration(milliseconds: 300), Curve animationCurve = Curves.easeInOut, required VoiceSearchResultCallback? onResult, VoidCallback? onListeningStarted, VoidCallback? onListeningStopped})
Creates a VoiceSearchWidget with the specified properties.
const

Properties

activeIcon IconData
Icon displayed when the widget is active (listening).
final
activeWidgetColor Color
Background color when the widget is active (listening).
final
animationCurve Curve
The curve for animation transitions.
final
animationDuration Duration
Duration of the animation transition.
final
borderColor Color?
Border color of the widget (optional).
final
elevation double?
Elevation of the widget (shadow effect).
final
hashCode int
The hash code for this object.
no setterinherited
inactiveIcon IconData
Icon displayed when the widget is inactive (not listening).
final
inactiveWidgetColor Color
Background color when the widget is inactive (not listening).
final
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
localeCode String
The locale code for speech recognition (e.g., 'en_US' for English US).
final
maxRadius double
Maximum radius of the animated widget.
final
minRadius double
Minimum radius of the animated widget.
final
onListeningStarted VoidCallback?
Callback function triggered when voice listening starts.
final
onListeningStopped VoidCallback?
Callback function triggered when voice listening stops.
final
onResult VoiceSearchResultCallback?
Callback function triggered when a voice search result is available.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

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