StandardSearchBar class

Inheritance

Constructors

StandardSearchBar({Key? key, double? width, double height = 50, double borderRadius = 25, Color backgroundColor = Colors.white, String hintText = 'Search', TextStyle hintStyle = const TextStyle(color: Colors.grey), IconData startIcon = Icons.search, Color startIconColor = Colors.grey, IconData endIcon = Icons.mic, Color endIconColor = Colors.grey, bool showStartIcon = true, bool showEndIcon = false, Color cursorColor = Colors.grey, Color? startIconSplashColor, dynamic startIconOnTap()?, dynamic endIconOnTap()?, Color? endIconSplashColor, double startIconSize = 20, double endIconSize = 20, double horizontalPadding = 10, double startIconPaddingRight = 8, double endIconPaddingLeft = 8, dynamic onSubmitted(String)?, dynamic onChanged(String)?, List<BoxShadow> shadow = const [BoxShadow(color: Colors.black12, spreadRadius: 0, blurRadius: 5, offset: Offset(0, 3))], TextStyle textStyle = const TextStyle(color: Colors.black), List<String>? suggestions, double? suggestionsBoxHeight = 175, EdgeInsetsGeometry? suggestionsBoxPadding = const EdgeInsets.symmetric(horizontal: 16, vertical: 16), TextStyle? suggestionTextStyle = const TextStyle(fontSize: 16), int? maxSuggestions = 10, Color? suggestionHoverColor, Color? suggestionHighlightColor, Decoration? suggestionDecoration})
const

Properties

backgroundColor Color
The background color of the search bar. By default is white.
final
borderRadius double
The border radius of the search bar. By default is 25 (rounded), but it can be any value.
final
cursorColor Color
The color of the cursor. By default is grey.
final
endIcon IconData
The end icon of the SearchBar. By default is Icons.mic.
final
endIconColor Color
The color of the end icon. By default is grey.
final
endIconOnTap → dynamic Function()?
The function callback of the endIcon. If it is not null, the end icon will be clickable and the splash color will be shown. By default is null.
final
endIconPaddingLeft double
The left padding of the end icon. By default is 8.
final
endIconSize double
The size of the end icon. By default is 20.
final
endIconSplashColor Color?
The splash color of the end icon. The splash color is the color that appears when the icon is tapped. By default is null, because it is calculated automatically by the Material widget.
final
hashCode int
The hash code for this object.
no setterinherited
height double
The height of the search bar. By default is 50.
final
hintStyle TextStyle
The hint text style of the SearchBar. By default is grey.
final
hintText String
The hint text of the SearchBar. By default is 'Search'.
final
horizontalPadding double
The horizontal padding of the search bar. By default is 10.
final
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
maxSuggestions int?
The max number of suggestions to show. If null, all the suggestions will be shown. By default is 10.
final
onChanged → dynamic Function(String)?
The function callback of the TextField onChanged. By default is null. This function is executed every time the text changes. So it can be execute a search every time the user types a letter or it can be used to update the search suggestions.
final
onSubmitted → dynamic Function(String)?
The function callback of the TextField onSubmitted. By default is null. This function can be used to search the text with the given value. This function is called when the user presses the enter key.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
shadow List<BoxShadow>
The shadow of the search bar. By default is a little black shadow. It can be any value. A list of BoxShadow.
final
showEndIcon bool
Whether to show the end icon or not. By default is false. If true, the end icon will be shown and the icon padding will be removed.
final
showStartIcon bool
Whether to show the start icon or not. By default is true. If false, the start icon will not be shown and the icon padding will be removed.
final
startIcon IconData
The start icon of the SearchBar. By default is Icons.search.
final
startIconColor Color
The color of the start icon. By default is grey.
final
startIconOnTap → dynamic Function()?
The function callback of the startIcon. If it is not null, the end icon will be clickable and the splash color will be shown. By default is null.
final
startIconPaddingRight double
The right padding of the start icon. By default is 8.
final
startIconSize double
The size of the start icon. By default is 20.
final
startIconSplashColor Color?
The splash color of the start icon. The splash color is the color that appears when the icon is tapped. By default is null, because it is calculated automatically by the Material widget.
final
suggestionDecoration Decoration?
The decoration of the suggestions. By default is null.
final
suggestionHighlightColor Color?
The color of the suggestions when highlighted. By default is opaque black.
final
suggestionHoverColor Color?
The color of the suggestions when hovered. By default is transparent.
final
suggestions List<String>?
The suggestions of the search bar. By default is null. It can be any value. A list of String.
final
suggestionsBoxHeight double?
The height of the suggestions box. By default is 175.
final
suggestionsBoxPadding EdgeInsetsGeometry?
The padding of the suggestions box. By default is symetric horizontal 16 and vertical 12.
final
suggestionTextStyle TextStyle?
The text style of the suggestions. By default the text color is fontsize is 16.
final
textStyle TextStyle
The text style of the TextField. By default the text color is black.
final
width double?
The width of the search bar. By default is the width of the parent (expanded).
final

Methods

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