GroupedListView<T, E> class

A groupable list of widgets similar to ListView, execpt that the items can be sectioned into groups.

See ListView.builder

Inheritance

Constructors

GroupedListView({Key? key, required List<T> elements, required E groupBy(T element), int groupComparator(E value1, E value2)?, Widget groupSeparatorBuilder(E value)?, Widget groupHeaderBuilder(T element)?, Widget itemBuilder(BuildContext context, int element)?, Widget indexedItemBuilder(BuildContext context, T element, int index)?, int itemComparator(T element1, T element2)?, GroupedListOrder order = GroupedListOrder.asc, bool sort = true, bool useStickyGroupSeparators = false, Widget separator = const SizedBox.shrink(), bool floatingHeader = false, Color stickyHeaderBackgroundColor = const Color(0xffF7F7F7), Axis scrollDirection = Axis.vertical, ScrollController? controller, bool? primary, ScrollPhysics? physics, bool shrinkWrap = false, EdgeInsetsGeometry? padding, bool reverse = false, bool addAutomaticKeepAlives = true, bool addRepaintBoundaries = true, bool addSemanticIndexes = true, double? cacheExtent, Clip clipBehavior = Clip.hardEdge, ScrollViewKeyboardDismissBehavior keyboardDismissBehavior = ScrollViewKeyboardDismissBehavior.manual, DragStartBehavior dragStartBehavior = DragStartBehavior.start, String? restorationId, int? semanticChildCount, double? itemExtent, RefreshCallback? onRefresh})
Creates a GroupedListView
const

Properties

addAutomaticKeepAlives bool
Whether to wrap each child in an AutomaticKeepAlive.
final
addRepaintBoundaries bool
Whether to wrap each child in a RepaintBoundary.
final
addSemanticIndexes bool
Whether to wrap each child in an IndexedSemantics.
final
cacheExtent double?
Creates a scrollable, linear array of widgets that are created on demand.
final
clipBehavior Clip
Defaults to Clip.hardEdge.
final
controller ScrollController?
An object that can be used to control the position to which this scroll view is scrolled.
final
dragStartBehavior DragStartBehavior
Determines the way that drag start behavior is handled.
final
elements List<T>
Items of which itemBuilder or indexedItemBuilder produce the list.
final
floatingHeader bool
Whether the group headers float over the list or occupy their own space.
final
groupBy → E Function(T element)
Defines which elements are grouped together.
final
groupComparator → (int Function(E value1, E value2)?)
Can be used to define a custom sorting for the groups.
final
groupHeaderBuilder → (Widget Function(T element)?)
Same as groupSeparatorBuilder, will be called to build group separators for each group. The passed element is always the first element of the group.
final
groupSeparatorBuilder → (Widget Function(E value)?)
Called to build group separators for each group. Value is always the groupBy result from the first element of the group.
final
hashCode int
The hash code for this object.
no setterinherited
indexedItemBuilder → (Widget Function(BuildContext context, T element, int index)?)
Called to build children for the list with 0 <= element, index < elements.length
final
itemBuilder → (Widget Function(BuildContext context, int element)?)
Called to build children for the list with 0 <= element < elements.length.
final
itemComparator → (int Function(T element1, T element2)?)
Can be used to define a custom sorting for the elements inside each group.
final
itemExtent double?
If non-null, forces the children to have the given extent in the scroll direction.
final
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
keyboardDismissBehavior ScrollViewKeyboardDismissBehavior
ScrollViewKeyboardDismissBehavior the defines how this ScrollView will dismiss the keyboard automatically.
final
onRefresh RefreshCallback?
final
order GroupedListOrder
Whether the order of the list is ascending or descending.
final
padding EdgeInsetsGeometry?
The amount of space by which to inset the children.
final
physics ScrollPhysics?
How the scroll view should respond to user input.
final
primary bool?
Whether this is the primary scroll view associated with the parent PrimaryScrollController.
final
restorationId String?
Restoration ID to save and restore the scroll offset of the scrollable.
final
reverse bool
Whether the view scrolls in the reading direction.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
scrollDirection Axis
The axis along which the scroll view scrolls.
final
semanticChildCount int?
The number of children that will contribute semantic information.
final
separator Widget
Called to build separators for between each item in the list.
final
shrinkWrap bool
Whether the extent of the scroll view in the scrollDirection should be determined by the contents being viewed.
final
sort bool
Whether the elements will be sorted or not. If not it must be done manually.
final
stickyHeaderBackgroundColor Color
Background color of the sticky header. Only used if floatingHeader is false.
final
useStickyGroupSeparators bool
When set to true the group header of the current visible group will stick on top.
final

Methods

createElement() StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() State<StatefulWidget>
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