AnimatedSearch class
A widget that displays an animated search box that expands when clicked.
The AnimatedSearch
widget can be used to implement a search feature in your app.
It displays a search box that can be expanded by clicking on the search icon.
When expanded, it displays a TextField
that can be used to enter search queries.
Example usage:
AnimatedSearch(
width: 0.7,
textEditingController: _textEditingController,
startIcon: Icons.search,
closeIcon: Icons.close,
iconColor: Colors.white,
cursorColor: Colors.white,
decoration: InputDecoration(
hintText: 'Search',
hintStyle: TextStyle(color: Colors.grey[300]),
border: InputBorder.none,
),
onChanged: (String value) {
// handle search query
},
)
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- AnimatedSearch
Constructors
- AnimatedSearch({Key? key, double width = 0.7, TextEditingController? textEditingController, IconData? startIcon = Icons.search, IconData? closeIcon = Icons.close, Color? iconColor = Colors.white, Color? cursorColor = Colors.white, dynamic onChanged(String)?, InputDecoration? decoration})
-
Creates an
AnimatedSearch
widget.const
Properties
- closeIcon → IconData?
-
The icon displayed when the search box is expanded.
final
- cursorColor → Color?
-
The color of the cursor in the
TextField
.final - decoration → InputDecoration?
-
The decoration for the
TextField
.final - hashCode → int
-
The hash code for this object.
no setterinherited
- iconColor → Color?
-
The color of the search icons.
final
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- onChanged → (dynamic Function(String)?)
-
A callback that is called when the text in the
TextField
changes.final - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- startIcon → IconData?
-
The icon displayed when the search box is folded.
final
- textEditingController → TextEditingController?
-
The controller for the
TextField
.final - width → double
-
The width of the search box when expanded.
0.0 - 1.0
final
Methods
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → State< AnimatedSearch> -
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