SearchBar<T> class
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- SearchBar
Constructors
-
SearchBar({Key? key, required Future<
List< onSearch(String? text), required Widget onItemFound(T? item, int index), SearchBarController? searchBarController, int minimumChars = 3, Duration debounceDuration = const Duration(milliseconds: 500), Widget loader = const Center(child: CircularProgressIndicator()), Widget onError(Error error)?, Widget emptyWidget = const SizedBox.shrink(), Widget? header, Widget? placeHolder, Widget icon = const Icon(Icons.search), String hintText = "", TextStyle hintStyle = const TextStyle(color: Color.fromRGBO(142, 142, 147, 1)), Color iconActiveColor = Colors.black, TextStyle textStyle = const TextStyle(color: Colors.black), Widget cancellationWidget = const Text("Cancel"), VoidCallback? onCancelled, List<T> >T> suggestions = const [], Widget buildSuggestion(T? item, int index)?, SearchBarStyle searchBarStyle = const SearchBarStyle(), int crossAxisCount = 1, bool shrinkWrap = false, IndexedScaledTileBuilder? indexedScaledTileBuilder, Axis scrollDirection = Axis.vertical, double mainAxisSpacing = 0.0, double crossAxisSpacing = 0.0, EdgeInsetsGeometry listPadding = const EdgeInsets.all(0), EdgeInsetsGeometry searchBarPadding = const EdgeInsets.all(0), EdgeInsetsGeometry headerPadding = const EdgeInsets.all(0)})
Properties
- buildSuggestion → (Widget Function(T? item, int index)?)
-
Callback returning the widget corresponding to a Suggestion item
final
- cancellationWidget → Widget
-
Widget shown for cancellation
final
- crossAxisCount → int
-
Number of items displayed on cross axis
final
- crossAxisSpacing → double
-
Spacing between tiles on cross axis
final
- debounceDuration → Duration
-
Cooldown between each call to avoid too many
final
- emptyWidget → Widget
-
Widget to show when no item were found
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- header → Widget?
-
Widget placed between the search bar and the results
final
- headerPadding → EdgeInsetsGeometry
-
Set a padding on the header
final
- hintStyle → TextStyle
-
TextStyle of the hint text
final
- hintText → String
-
Hint text of the search bar
final
- icon → Widget
-
Widget showed on left of the search bar
final
- iconActiveColor → Color
-
Color of the icon when search bar is active
final
- indexedScaledTileBuilder → IndexedScaledTileBuilder?
-
Called to get the tile at the specified index for the
SliverGridStaggeredTileLayout
.final - key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- listPadding → EdgeInsetsGeometry
-
Set a padding on the list
final
- loader → Widget
-
Widget to show when loading
final
- mainAxisSpacing → double
-
Spacing between tiles on main axis
final
- minimumChars → int
-
Minimum number of chars required for a search
final
- onCancelled → VoidCallback?
-
Callback when cancel button is triggered
final
- onError → (Widget Function(Error error)?)
-
Callback returning the widget corresponding to an Error while searching
final
- onItemFound → Widget Function(T? item, int index)
-
Callback returning the widget corresponding to an item found
final
-
onSearch
→ Future<
List< Function(String? text)T> > -
Future returning searched items
final
- placeHolder → Widget?
-
Widget to show by default
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- scrollDirection → Axis
-
Set the scrollDirection
final
- searchBarController → SearchBarController?
-
Controller used to be able to sort, filter or replay the search
final
- searchBarPadding → EdgeInsetsGeometry
-
Set a padding on the search bar
final
- searchBarStyle → SearchBarStyle
-
Enable to edit the style of the search bar
final
- shrinkWrap → bool
-
Weather the list should take the minimum place or not
final
-
suggestions
→ List<
T> -
List of items showed by default
final
- textStyle → TextStyle
-
Text style of the text in the search bar
final
Methods
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → _SearchBarState -
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