MagicPaginatedListView<E> class

A lazily built list over a MagicPaginator, fetching the next page as the end of the current one comes into view.

The lazy part is the point. Rendering a long collection as a column of every row costs one build, one layout and one semantics node per row on the first frame, whether or not the reader ever scrolls that far; this builds the rows the viewport can show and asks for more only when the reader gets there.

It needs a bounded height

This is a ListView, so it expands to whatever height it is given and throws when it is given an unbounded one. Inside a page that already scrolls, give it a bound:

WDiv(
  className: 'h-[600px]',
  child: MagicPaginatedListView<CheckRow>(
    paginator: controller.checks,
    itemBuilder: (_, CheckRow row, _) => CheckHistoryRow(row: row),
  ),
)

Putting it in a page scroll view WITHOUT a bound, or with shrinkWrap: true to make that work, defeats it entirely: shrink-wrapping measures every row, so all of them get built and nothing is saved. A page that wants one continuous scroll needs a sliver-based scaffold instead.

Inheritance

Constructors

MagicPaginatedListView({Key? key, required MagicPaginator<E> paginator, required MagicPaginatedItemBuilder<E> itemBuilder, Widget? emptyState, Widget? loadingFooter, double loadMoreExtent = 400, EdgeInsetsGeometry? padding, IndexedWidgetBuilder? separatorBuilder})
Creates a lazy list over paginator.
const

Properties

emptyState Widget?
Rendered instead of the list once a first page has arrived empty.
final
hashCode int
The hash code for this object.
no setterinherited
itemBuilder MagicPaginatedItemBuilder<E>
Builds one row.
final
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
loadingFooter Widget?
Rendered below the last row while the next page is in flight.
final
loadMoreExtent double
How close to the end, in pixels, triggers the next page.
final
padding EdgeInsetsGeometry?
Padding around the list.
final
paginator MagicPaginator<E>
The collection to render, and the source of the next page.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
separatorBuilder IndexedWidgetBuilder?
Builds the divider between two rows, when the list wants one.
final

Methods

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