VoGroupedView<T, G> class
Scrollable list or grid of items split into groups by groupBy.
Groups keep the order their first item appears in items unless groupComparator is set; items keep their order within a group unless itemComparator is set. The index passed to itemBuilder is the item's index within its group.
Items are built lazily, only as they come near the viewport, so large lists of images are only loaded as they are scrolled to. Set animation to slide items in as they appear.
For pagination, set hasMore and onLoadMore, then pass the grown items list when a page arrives. New items join their existing group.
With stickyHeaders, each group header stays pinned while its group is in view. Give the header an opaque background so items don't show through.
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- VoGroupedView
Constructors
-
VoGroupedView({Key? key, required List<
T> items, required G groupBy(T item), required VoGroupItemBuilder<T> itemBuilder, VoGroupBuilder<T, G> ? groupHeaderBuilder, IndexedWidgetBuilder? separatorBuilder, Comparator<G> ? groupComparator, Comparator<T> ? itemComparator, bool stickyHeaders = false, VoItemAnimation? animation, Object? itemKey(T item)?, Future<void> onLoadMore()?, bool hasMore = false, double loadMoreThreshold = 200, Widget? loadingMore, Future<void> onRefresh()?, Widget? header, Widget? empty, EdgeInsetsGeometry groupPadding = EdgeInsets.zero, EdgeInsetsGeometry padding = EdgeInsets.zero, ScrollController? controller, bool? primary, ScrollPhysics physics = const AlwaysScrollableScrollPhysics(parent: BouncingScrollPhysics()), bool shrinkWrap = false, ScrollCacheExtent? scrollCacheExtent}) -
const
-
VoGroupedView.grid({Key? key, required List<
T> items, required G groupBy(T item), required VoGroupItemBuilder<T> itemBuilder, required SliverGridDelegate gridDelegate, VoGroupBuilder<T, G> ? groupHeaderBuilder, Comparator<G> ? groupComparator, Comparator<T> ? itemComparator, bool stickyHeaders = false, VoItemAnimation? animation, Object? itemKey(T item)?, Future<void> onLoadMore()?, bool hasMore = false, double loadMoreThreshold = 200, Widget? loadingMore, Future<void> onRefresh()?, Widget? header, Widget? empty, EdgeInsetsGeometry groupPadding = EdgeInsets.zero, EdgeInsetsGeometry padding = EdgeInsets.zero, ScrollController? controller, bool? primary, ScrollPhysics physics = const AlwaysScrollableScrollPhysics(parent: BouncingScrollPhysics()), bool shrinkWrap = false, ScrollCacheExtent? scrollCacheExtent}) -
const
Properties
- animation → VoItemAnimation?
-
Slides items in the first time they are built. Null disables it.
final
- controller → ScrollController?
-
final
- empty → Widget?
-
Shown in place of the groups when items is empty.
final
-
Scrolls with the content, below the last group.
final
- gridDelegate → SliverGridDelegate?
-
Grid layout for each group's items. Null in list mode.
final
- groupBy → G Function(T item)
-
final
-
groupComparator
→ Comparator<
G> ? -
final
-
final
-
groupHeaderBuilder
→ VoGroupBuilder<
T, G> ? -
final
- groupPadding → EdgeInsetsGeometry
-
Padding around each group's items, between its header and footer.
final
-
groups
→ List<
VoGroup< T, G> > -
items grouped and sorted as they will be displayed.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- hasMore → bool
-
final
- header → Widget?
-
Scrolls with the content, above the first group.
final
- isGridView → bool
-
no setter
-
itemBuilder
→ VoGroupItemBuilder<
T> -
final
-
itemComparator
→ Comparator<
T> ? -
final
- itemKey → Object? Function(T item)?
-
Identifies an item so it animates in only once. Defaults to the item.
final
-
items
→ List<
T> -
final
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- loadingMore → Widget?
-
Shown below the last group while onLoadMore runs. Defaults to a
centered CircularProgressIndicator.
final
- loadMoreThreshold → double
-
final
-
onLoadMore
→ Future<
void> Function()? -
Called when the user scrolls within loadMoreThreshold of the end
while hasMore is true. Not called again until the future completes.
final
-
onRefresh
→ Future<
void> Function()? -
Enables pull to refresh.
final
- padding → EdgeInsetsGeometry
-
final
- physics → ScrollPhysics
-
final
- primary → bool?
-
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- scrollCacheExtent → ScrollCacheExtent?
-
How far past the viewport items are built ahead of time.
final
- separatorBuilder → IndexedWidgetBuilder?
-
Built between items of the same group. List mode only.
final
- shrinkWrap → bool
-
final
- stickyHeaders → bool
-
final
Methods
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → State< VoGroupedView< T, G> > -
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, int wrapWidth = 65}) → 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