NmSearchHero<T> class
A landing search: a title (e.g. an NmWordmark at display size) and caption, one elevated card with the field and the submit button inside, then the search kinds as chips with a caption ("detected automatically / detected as / you chose") and an optional advanced-search link. A chip overrides the detected kind; picking it again returns to detection. Added in 0.3.0.
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- NmSearchHero
Constructors
-
NmSearchHero({Key? key, required Widget title, required String caption, required String hint, required String actionLabel, required List<
(T, String)> kinds, required T? detect(String query), required void onSubmit(String query, T kind), required String captionAuto, required String captionDetected, required String captionChosen, String initialQuery = '', String keyOf(T kind)?, T? kindOverride, ValueChanged<T?> ? onKindOverride, String? advancedLabel, String? advancedHideLabel, bool advancedOpen = false, VoidCallback? onToggleAdvanced}) -
Creates an NmSearchHero.
const
Properties
- actionLabel → String
-
Text of the submit button.
final
- advancedHideLabel → String?
-
Text of the link while the advanced panel is open.
final
- advancedLabel → String?
-
Text of the advanced-search link.
final
- advancedOpen → bool
-
Whether the advanced panel is open.
final
- caption → String
-
Line under the title.
final
- captionAuto → String
-
Chip caption with an empty field.
final
- captionChosen → String
-
Chip caption when the user chose the kind.
final
- captionDetected → String
-
Chip caption when the kind was detected.
final
- detect → T? Function(String query)
-
The kind a query looks like; null when unknown.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- hint → String
-
Placeholder of the empty field.
final
- initialQuery → String
-
Query in the field; updates it when it changes.
final
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- keyOf → String Function(T kind)?
-
Key suffix of each chip (
kind-<keyOf(kind)>); defaults to'$kind'.final - kindOverride → T?
-
A kind chosen instead of the detected one; null follows detection.
final
-
kinds
→ List<
(T, String)> -
(kind, chip label) in order.
final
-
onKindOverride
→ ValueChanged<
T?> ? -
Called with the new override (null returns to detection).
final
- onSubmit → void Function(String query, T kind)
-
Called with the trimmed query and the effective kind.
final
- onToggleAdvanced → VoidCallback?
-
Shows the advanced-search link when set.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- title → Widget
-
Above the card (a display wordmark).
final
Methods
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → State< NmSearchHero< T> > -
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