KFDrawerController class
Controls the visible page and programmatic state of a KFDrawer.
The page and items setters notify the attached drawer automatically. Mutating the returned items list in place requires refreshItems, though addItem, removeItem, and clearItems are preferred.
- Inheritance
-
- Object
- ChangeNotifier
- KFDrawerController
Constructors
-
KFDrawerController({List<
KFDrawerItem> items = const <KFDrawerItem>[], required Widget initialPage, bool maintainPageHistory = false}) - Creates a controller with the first page displayed by the drawer.
Properties
- canGoBack → bool
-
Whether goBack can restore a previously displayed page.
no setter
- close ↔ Function?
-
Callback installed by the attached drawer to close it.
getter/setter pair
- hashCode → int
-
The hash code for this object.
no setterinherited
- hasListeners → bool
-
Whether any listeners are currently registered.
no setterinherited
-
items
↔ List<
KFDrawerItem> -
The menu items displayed by the attached drawer.
getter/setter pair
- maintainPageHistory → bool
-
Whether assigning page records the previous page for goBack.
final
- open ↔ Function?
-
Callback installed by the attached drawer to open it.
getter/setter pair
- page ↔ Widget?
-
The page displayed as drawer content.
getter/setter pair
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- toggle ↔ Function?
-
Callback installed by the attached drawer to toggle it.
getter/setter pair
Methods
-
addItem(
KFDrawerItem item) → void -
Adds
itemand refreshes the attached drawer. -
addListener(
VoidCallback listener) → void -
Register a closure to be called when the object changes.
inherited
-
clearHistory(
) → void - Clears all pages recorded for goBack.
-
clearItems(
) → void - Removes all menu items and refreshes the attached drawer.
-
dispose(
) → void -
Discards any resources used by the object.
override
-
goBack(
) → bool - Restores the previous page when page history is enabled.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
notifyListeners(
) → void -
Call all the registered listeners.
inherited
-
refreshItems(
) → void - Notifies the drawer after items was mutated directly.
-
removeItem(
KFDrawerItem item) → bool -
Removes
itemand refreshes the attached drawer. -
removeListener(
VoidCallback listener) → void -
Remove a previously registered closure from the list of closures that are
notified when the object changes.
inherited
-
replacePage(
Widget? value) → void -
Displays
valuewithout adding the current page to history. -
selectItem(
String alias) → bool -
Selects the first item whose alias equals
alias. -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited