SuggestionsController<T> class
A controller of a SuggestionsField and its SuggestionsBox.
This allows access to the state of suggestions (items, loading, error), the state of the suggestions box (open, direction, focus) and the ability to open and close the suggestions box.
- Inheritance
-
- Object
- ChangeNotifier
- SuggestionsController
Constructors
- SuggestionsController()
- A controller of a SuggestionsBox. This is used to open, close, toggle and resize the suggestions box.
Properties
-
$refreshes
→ Stream<
void> -
A stream of events that occur when the suggestions list should be refreshed.
no setter
-
$resizes
→ Stream<
void> -
A stream of events that occur when the suggestions box should be resized.
no setter
- direction ↔ VerticalDirection
-
The desired direction of the suggestions box.
getter/setter pair
- effectiveDirection ↔ VerticalDirection
-
The effective direction of the suggestions box.
This may or may not be the same as direction.
getter/setter pair
- error ↔ Object?
-
The error encountered by the suggestions box while loading, if any.
getter/setter pair
- focusState → SuggestionsFocusState
-
The current state of focus of the suggestions box and field.
no setter
- gainFocus → bool
-
Whether the suggestions box should gain the focus when it is opened.
no setter
- hasError → bool
-
Whether the suggestions box has encountered an error while loading.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- hasListeners → bool
-
Whether any listeners are currently registered.
no setterinherited
- isLoading ↔ bool
-
Whether the suggestions box is loading.
getter/setter pair
- isOpen → bool
-
Whether the suggestions box is open.
no setter
- retainFocus → bool
-
Whether the suggestions field should retain the focus when its box is closed.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
selections
→ Stream<
T> -
A stream of selected suggestions.
no setter
-
suggestions
↔ List<
T> ? -
The current suggestions of the suggestions box.
getter/setter pair
Methods
-
addListener(
VoidCallback listener) → void -
Register a closure to be called when the object changes.
inherited
-
close(
{bool retainFocus = false}) → void - Closes the suggestions box.
-
dispose(
) → void -
Discards any resources used by the object. After this is called, the
object is not in a usable state and should be discarded (calls to
addListener will throw after the object is disposed).
override
-
focusBox(
) → void - Focuses the suggestions box.
-
focusField(
) → void - Focuses the suggestions field.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
notifyListeners(
) → void -
Call all the registered listeners.
inherited
-
open(
{bool gainFocus = true}) → void - Opens the suggestions box.
-
refresh(
) → void - Resets the suggestions so that they are requested again.
-
removeListener(
VoidCallback listener) → void -
Remove a previously registered closure from the list of closures that are
notified when the object changes.
inherited
-
resize(
) → void - Resizes the suggestions box.
-
select(
T suggestion) → void - Should be called when a suggestion is selected.
-
toggle(
) → void - Opens the suggestions box if closed and vice-versa.
-
toString(
) → String -
A string representation of this object.
inherited
-
unfocus(
) → void - Unfocuses the suggestions box and its field.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
maybeOf<
T> (BuildContext context) → SuggestionsController< T> ? - Returns the SuggestionsController of the closest ancestor SuggestionsBox or null if none exists.
-
of<
T> (BuildContext context) → SuggestionsController< T> - Returns the SuggestionsController of the closest ancestor SuggestionsBox.