DashboardItemController<T extends DashboardItem> class

A controller for dashboard items.

Every Dashboard needs a DashboardItemController. The controller determines which items will be displayed on the screen. Item addition, removal, etc. operations are done through the controller.

The controller is also used to enable/disable editing with isEditing. Use as setter to specify edit mode.

itemStorageDelegate is used to handle changes and save the layout. You can save layout information on remote server or disk.

New items can be added with add or plural addAll.

Items can be deleted with delete or plural deleteAll. For deleting all items can be used clear.

Mixed in types

Constructors

DashboardItemController({required List<T> items})
You can define items with constructor. But the layout information is only for the session. Changes cannot be handled.
DashboardItemController.withDelegate({Duration? timeout, required DashboardItemStorageDelegate<T>? itemStorageDelegate})
You can create DashboardItemController with an itemStorageDelegate. In init state, item information is brought with the delegate. The necessary functions of the delegate are triggered on all changes.

Properties

hashCode int
The hash code for this object.
no setterinherited
hasListeners bool
Whether any listeners are currently registered.
no setterinherited
isEditing bool
Users can only edit the layout when isEditing is true. The isEditing does not have to be true to add or delete items.
getter/setter pair
items List<String>
Get all items.
no setter
itemStorageDelegate DashboardItemStorageDelegate<T>?
To define itemStorageDelegate use DashboardItemController.withDelegate
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

add(T item, {bool mountToTop = true, Duration duration = const Duration(milliseconds: 200), Curve curve = Curves.easeInOut}) → void
Add new item to Dashboard.
addAll(List<T> items, {bool mountToTop = true}) → void
Add new multiple items to Dashboard.
addListener(VoidCallback listener) → void
Register a closure to be called when the object changes.
inherited
clear() → void
Clear all items from Dashboard.
delete(String id) → void
Delete an item from Dashboard.
deleteAll(List<String> ids) → void
Delete multiple items from Dashboard.
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).
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
notifyListeners() → void
Call all the registered listeners.
inherited
removeListener(VoidCallback listener) → void
Remove a previously registered closure from the list of closures that are notified when the object changes.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited