TListView<T, K> class

A versatile list/grid view with robust features.

TListView serves as the core rendering engine for TList and supports:

  • List and Grid layouts (including Masonry and Aligned)
  • Sliver-based scrolling
  • Sticky headers and footers
  • Infinite scroll support
  • Pull-to-refresh integration
  • Empty, Error, and Loading states
  • Reordering (Drag and Drop)

This widget is typically used internally by TList, but can be used directly for advanced custom layouts.

Inheritance

Constructors

TListView({Key? key, required List<TListItem<T, K>> items, TListError? error, bool headerSticky = false, TListHeaderBuilder? headerBuilder, bool footerSticky = false, TListFooterBuilder? footerBuilder, bool loading = false, TListLoadingBuilder? loadingBuilder, bool infiniteScroll = false, TListFooterBuilder? infiniteScrollFooterBuilder, TListErrorBuilder? errorStateBuilder, TListEmptyBuilder? emptyStateBuilder, required ListItemBuilder<T, K> itemBuilder, TListSeparatorBuilder? listSeparatorBuilder, EdgeInsets? padding, bool reorderable = false, TListDragProxyDecorator? dragProxyDecorator, TListReorderCallback? onReorder, TGridMode? grid, TGridDelegateBuilder? gridDelegate, double? height, bool shrinkWrap = false, ScrollController? scrollController})
Creates a list view.
const

Properties

dragProxyDecorator TListDragProxyDecorator?
Decorator for item while dragging.
final
emptyStateBuilder TListEmptyBuilder?
Builder for empty state.
final
error TListError?
Error object if in error state.
final
errorStateBuilder TListErrorBuilder?
Builder for error state.
final
footerBuilder TListFooterBuilder?
Builder for the list footer.
final
footerSticky bool
Whether the footer is sticky.
final
grid TGridMode?
Grid mode (masonry, aligned, or null for list).
final
gridDelegate TGridDelegateBuilder?
Delegate for grid layout configuration.
final
hashCode int
The hash code for this object.
no setterinherited
headerBuilder TListHeaderBuilder?
Builder for the list header.
final
headerSticky bool
Whether the header is sticky.
final
height double?
Fixed height for the list (optional).
final
infiniteScroll bool
Whether infinite scroll is enabled.
final
infiniteScrollFooterBuilder TListFooterBuilder?
Builder for infinite scroll footer.
final
itemBuilder ListItemBuilder<T, K>
Builder for individual list items.
final
items List<TListItem<T, K>>
The list of items to display.
final
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
listSeparatorBuilder TListSeparatorBuilder?
Builder for list separators.
final
loading bool
Whether the list is loading.
final
loadingBuilder TListLoadingBuilder?
Builder for loading state.
final
onReorder TListReorderCallback?
Callback when reorder completes.
final
padding EdgeInsets?
Padding around the list content.
final
reorderable bool
Whether items can be reordered.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
scrollController ScrollController?
Custom scroll controller.
final
shrinkWrap bool
Whether to shrink wrap the scroll view.
final

Methods

build(BuildContext context) Widget
Describes the part of the user interface represented by this widget.
override
buildContentSliver(BuildContext context) Widget
Builds the main content sliver.
buildItem(BuildContext context, int index) Widget
Builds a single list item helper.
buildSlivers(BuildContext context) List<Widget>
Builds the slivers for the scroll view.
createElement() StatelessElement
Creates a StatelessElement to manage this widget's location in the tree.
inherited
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