InfiniteGroupedList<ItemType, GroupBy, GroupTitle> class
A list of items that are grouped and infinite.
This list fetches data in chunks, creating an "infinite scroll" experience for the user. Additionally, the items are grouped based on a grouping criterion provided by the developer.
ItemType
is the type of item in the list. For instance, if your list displays
Users, ItemType would be User.
GroupBy
is the type of value used to group the items. This could be any type
as long as it can be derived from ItemType. For instance, if you are grouping
Users by their city, GroupBy would be String.
GroupTitle
is the type of the group title. This is derived from GroupBy values.
For example, you could have GroupBy be DateTime (representing user birthdays) and
have GroupTitle be String, if you want to display the birthdays as string titles.
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- InfiniteGroupedList
Constructors
-
InfiniteGroupedList({required Widget itemBuilder(ItemType item), required GroupBy groupBy(ItemType item), required Widget groupTitleBuilder(GroupTitle title, GroupBy groupBy, bool isPinned, double scrollPercentage), required GroupTitle groupCreator(GroupBy), bool? showGroups, required Future<
List< onLoadMore(PaginationInfo paginationInfo), dynamic sortGroupBy(ItemType)?, Widget seperatorBuilder(ItemType)?, bool isPaged = true, InfiniteGroupedListController<ItemType> >ItemType, GroupBy, GroupTitle> ? controller, dynamic onRefresh()?, Widget? noItemsFoundWidget, Widget initialItemsErrorWidget(dynamic error)?, Widget loadMoreItemsErrorWidget(dynamic error)?, SortOrder groupSortOrder = SortOrder.descending, bool stickyGroups = true, Widget loadingWidget = const Center(child: CircularProgressIndicator()), Color? refreshIndicatorColor, Color? refreshIndicatorBackgroundColor, ScrollPhysics? physics, bool? showRefreshIndicator, Key? key, VoidCallback? onNoMoreItemsFound}) -
factory
-
InfiniteGroupedList.gridView({required Widget itemBuilder(ItemType item), required GroupBy groupBy(ItemType item), required Widget groupTitleBuilder(GroupTitle title, GroupBy groupBy, bool isPinned, double scrollPercentage), required Future<
List< onLoadMore(PaginationInfo paginationInfo), required GroupTitle groupCreator(GroupBy), dynamic sortGroupBy(ItemType)?, SliverGridDelegate? gridDelegate, Widget seperatorBuilder(ItemType)?, bool isPaged = true, InfiniteGroupedListController<ItemType> >ItemType, GroupBy, GroupTitle> ? controller, dynamic onRefresh()?, Widget? noItemsFoundWidget, Widget initialItemsErrorWidget(dynamic error)?, Widget loadMoreItemsErrorWidget(dynamic error)?, SortOrder groupSortOrder = SortOrder.descending, bool stickyGroups = true, Widget loadingWidget = const Center(child: CircularProgressIndicator()), Color? refreshIndicatorColor, Color? refreshIndicatorBackgroundColor, ScrollPhysics? physics, bool? showRefreshIndicator, VoidCallback? onNoMoreItemsFound, Key? key, bool? showGroups}) -
factory
Properties
-
controller
→ InfiniteGroupedListController<
ItemType, GroupBy, GroupTitle> -
The controller of the list.
final
- gridDelegate → SliverGridDelegate?
-
final
- groupBy → GroupBy Function(ItemType item)
-
Return the field of the item that you want to group by.
final
- groupCreator → GroupTitle Function(GroupBy groupBy)
-
Using the groupBy value, you can define how the group title should be created.
final
- groupSortOrder → SortOrder
-
The sort order of the items inside the groups.
final
- groupTitleBuilder → Widget Function(GroupTitle title, GroupBy groupBy, bool isPinned, double scrollPercentage)
-
The group title builder is used to build the title of the group.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- initialItemsErrorWidget → (Widget Function(dynamic error)?)
-
The widget to show when the first load call fails
final
- isPaged → bool
-
Whether the onLoadMore uses paging. If it does not, this should be set as
false
final - itemBuilder → Widget Function(ItemType item)
-
The item builder is used to build the item.
final
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- listStyle → ListStyle
-
final
- loadingWidget → Widget
-
The widget to show when the list is loading.
final
- loadMoreItemsErrorWidget → (Widget Function(dynamic error)?)
-
The widget to show when the load call fails.
final
- noItemsFoundWidget → Widget?
-
The widget to show when the list is empty.
final
-
onLoadMore
→ Future<
List< Function(PaginationInfo paginationInfo)ItemType> > -
The function to call when the list needs to load more items.
final
- onNoMoreItemsFound → VoidCallback?
-
Optionally if you want to do something when there are no more items to load.
final
- onRefresh → VoidCallback?
-
Optionally if you want to do something when the user pulls to refresh.
final
- physics → ScrollPhysics
-
The scroll physics of the list.
final
- refreshIndicatorBackgroundColor → Color?
-
The background color of the refresh indicator
final
- refreshIndicatorColor → Color?
-
The color of the refresh indicator
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- seperatorBuilder → (Widget Function(ItemType item)?)
-
The seperator builder is used to build the seperator between items.
final
- showGroups → bool
-
final
- showRefreshIndicator → bool
-
Whether to show the refresh indicator when the user pulls to refresh. Defaults to true.
final
- sortGroupBy → (void Function(ItemType sortGroupBy)?)
-
You can define the field of which the items inside the groups should be sorted by.
final
- stickyGroups → bool
-
Whether the grpup should stick to the top of the screen when scrolling up.
final
Methods
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → _InfiniteGroupState< ItemType, GroupBy, GroupTitle> -
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}) → 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