ListUicController<T> class
A controller for ListUic widget.
It manages list component states and data.
'ListUic' controller is typically stored as a member variable in State object and is reused in each State.build.
You have to provide the onGetItems callback that is used to load list items by specified page.
Controller implements the following flow:
- If the initial data provided in items parameter, the list component will shows that data on its creation.
- When initial items are not provided or the empty list is provided, and initialLoading parameter is set to 'true' the controller will start loading list items.
- During initial data loading controller forces the list component to show empty progress view.
- If there are no data, an empty data view is shown.
- If initial data loading failed, an empty error view is shown.
- In normal state, when list items are loaded and shown, pull to refresh gesture is supported to reload the data. The progress indicator is shown during the data loading.
- If data loading failed, a snack bar with error message is shown
- When allowPagination parameter is set to 'true', the page by page (infinite scrolling) is enabled. When user scroll the list to the end, the controller start loading next page of items.
- During loading next page of data, controller forces the list component to show progress view at the end of the list.
- If next page data loading failed, a snack bar with error message is shown.
See also:
Constructors
Properties
- allowPagination ↔ bool
-
Whether pagination is allowed
getter/setter pair
- hashCode → int
-
The hash code for this object.
no setterinherited
- initialLoading ↔ bool
-
Whether to load data if there are no initial data provided
getter/setter pair
-
items
→ ValueNotifier<
List< T> > -
Items to show in the list
no setter
-
onGetItems
↔ Future<
List< Function(int)T> ?> -
Callback to load list items by the page
getter/setter pair
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- scrollController → ScrollController
-
no setter
-
state
→ ValueNotifier<
_ListUicState> -
no setter
Methods
-
nextPage(
) → Future< void> -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
refresh(
) → Future< void> -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited