PaginatedItemsBuilder<T> class

Handles rendering the items on the screen. Can have PaginationItemsStateHandler as parent if state is not handled externally.

Inheritance

Constructors

PaginatedItemsBuilder({Key? key, required Future<PaginatedItemsResponse<T>?> fetchPageData(bool reset), required PaginatedItemsResponse<T>? response, required Widget itemBuilder(BuildContext context, int index, T item), double? cacheExtent, ScrollCacheExtent? scrollCacheExtent, bool? logErrors, ScrollPhysics? customScrollPhysics, ScrollController? scrollController, SliverGridDelegate? gridDelegate, EdgeInsets? padding, NoItemsTextGetter? noItemsTextGetter, NoItemsWidgetBuilder? noItemsWidgetBuilder, ErrorTextGetter? errorTextGetter, ErrorWidgetBuilder? errorWidgetBuilder, ShowLoaderOnResetGetter? showLoaderOnResetGetter, int? maxLength, RefreshIconBuilder? refreshIconBuilder, Widget? listSeparatorWidget, double? listItemsGap, int? gridCrossAxisCount, double? gridMainAxisSpacing, double? gridCrossAxisSpacing, double? gridChildAspectRatio, bool? primary, String? mockItemKey, int? gridSemanticChildCount, String? restorationId, TextStyle? noItemsTextStyle, TextStyle? errorTextStyle, Widget? loader, Widget? bottomLoader, bool paginate = true, bool showRefreshIcon = true, bool neverScrollablePhysicsOnShrinkWrap = true, ItemsDisplayType itemsDisplayType = ItemsDisplayType.list, bool shrinkWrap = false, bool reverse = false, bool disableLoaderOnTaps = true, Clip clipBehaviour = Clip.hardEdge, bool disableRefreshIndicator = false, int loaderItemsCount = 10, Axis scrollDirection = Axis.vertical, bool ignoreMockItemGetter = false, bool addAutomaticKeepAlives = true, bool addRepaintBoundaries = true, bool addSemanticIndexes = true, DragStartBehavior dragStartBehavior = DragStartBehavior.start, ScrollViewKeyboardDismissBehavior keyboardDismissBehavior = ScrollViewKeyboardDismissBehavior.manual, HitTestBehavior hitTestBehavior = HitTestBehavior.opaque, ChildIndexGetter? findItemIndexCallback})
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
bottomLoader → Widget?
The bottom-loader to render if mockItem not found from PaginatedItemsBuilderConfig.mockItemGetter or PaginatedItemsBuilder.ignoreMockItemGetter is true.
final
cacheExtent → double?
The viewport has an area before and after the visible area to cache items that are about to become visible when the user scrolls.
final
clipBehaviour → Clip
The content will be clipped (or not) according to this option.
final
customScrollPhysics → ScrollPhysics?
How the scroll view should respond to user input.
final
disableLoaderOnTaps → bool
Whether to disable onTap gesture events on loaders, when shown...
final
disableRefreshIndicator → bool
True if you don't want the in-built refresh indicator for your items.
final
dragStartBehavior → DragStartBehavior
Determines the way that drag start behavior is handled.
final
errorTextGetter → ErrorTextGetter?
The text to show if an error occurs.
final
errorTextStyle → TextStyle?
Customize the style of the text that is rendered when an error occurs.
final
errorWidgetBuilder → ErrorWidgetBuilder?
The widget to display if an errors.
final
fetchPageData → Future<PaginatedItemsResponse<T>?> Function(bool reset)
This is the controller function that should handle fetching the list and updating in the state.
final
findItemIndexCallback → ChildIndexGetter?
Finds the index of an item by its key, so the list can keep the state of items that move rather than rebuilding them from scratch.
final
gridChildAspectRatio → double?
The grid child aspect ratio for the delegate SliverGridDelegateWithFixedCrossAxisCount. Has no effect if gridDelegate is not null.
final
gridCrossAxisCount → int?
The grid axis count for the delegate SliverGridDelegateWithFixedCrossAxisCount. Has no effect if gridDelegate is not null.
final
gridCrossAxisSpacing → double?
The grid cross axis spacing for the delegate SliverGridDelegateWithFixedCrossAxisCount. Has no effect if gridDelegate is not null.
final
gridDelegate → SliverGridDelegate?
The grid's delegate, controlling the layout of tiles in a grid. Used if itemsDisplayType is ItemsDisplayType.grid.
final
gridMainAxisSpacing → double?
The grid main axis spacing for the delegate SliverGridDelegateWithFixedCrossAxisCount. Has no effect if gridDelegate is not null.
final
gridSemanticChildCount → int?
The number of children that will contribute semantic information.
final
hashCode → int
The hash code for this object.
no setterinherited
hitTestBehavior → HitTestBehavior
How the gesture detector of the underlying scrollable should behave during hit testing.
final
ignoreMockItemGetter → bool
If true, then PaginatedItemsBuilderConfig.mockItemGetter will not be called whatsoever, and mock item remains null...
final
itemBuilder → Widget Function(BuildContext context, int index, T item)
Callback function which requires a widget that is rendered for each item. Provides context, index of the item in the list and the item itself.
final
itemsDisplayType → ItemsDisplayType
Whether to display items in a list view or grid view.
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
listItemsGap → double?
The gap between concurrent list items. Has no effect if listSeparatorWidget is not null.
final
listSeparatorWidget → Widget?
Separator for items in a list view.
final
loader → Widget?
The full-screen loader to render if mockItem not found from PaginatedItemsBuilderConfig.mockItemGetter or PaginatedItemsBuilder.ignoreMockItemGetter is true.
final
loaderItemsCount → int
The number of loader widgets to render before the data is fetched for the first time.
final
logErrors → bool?
Whether to log errors to the console or not.
final
maxLength → int?
Limits the item count no matter what the length of the content is in the PaginatedItemsResponse.items.
final
mockItemKey → String?
Can be used to override PaginatedItemsBuilderConfig.mockItemGetter property.
final
neverScrollablePhysicsOnShrinkWrap → bool
Useful when the PaginatedItemsBuilder is a child of another scrollable, then the physics should be NeverScrollableScrollPhysics as it conflicts. Hence, if true, it overrides the shrinkWrap property as shrinkWrap should be true if the PaginatedItemsBuilder is inside another scrollable widget.
final
noItemsTextGetter → NoItemsTextGetter?
The text to show if no items are present.
final
noItemsTextStyle → TextStyle?
Customize the style of the text that is rendered when there are no items to display.
final
noItemsWidgetBuilder → NoItemsWidgetBuilder?
The widget to display if no items are there to display.
final
padding → EdgeInsets?
The amount of space by which to inset the children.
final
paginate → bool
Whether to paginate a specific list of items or not. Defaults to true.
final
primary → bool?
Whether this is the primary scroll view associated with the parent PrimaryScrollController.
final
refreshIconBuilder → RefreshIconBuilder?
The refresh icon builder. PaginatedItemsBuilder.showRefreshIcon is ignored if refreshIconBuilder is not null;
final
response → PaginatedItemsResponse<T>?
The response object whose contents are displayed.
final
restorationId → String?
Restoration ID to save and restore the scroll offset of the scrollable.
final
reverse → bool
Whether the scroll view scrolls in the reading direction.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
scrollCacheExtent → ScrollCacheExtent?
The cache area of the viewport, expressed as a ScrollCacheExtent.
final
scrollController → ScrollController?
Pass in a custom scroll controller if needed.
final
scrollDirection → Axis
Scroll direction of the list/grid view
final
showLoaderOnResetGetter → ShowLoaderOnResetGetter?
Whether to switch all the cards to their respective loaders when reset is true, i.e. if the user pulls down to refresh, or no items were found...
final
showRefreshIcon → bool
If no items are there to display, shows a refresh icon to again call the API to update the results.
final
shrinkWrap → bool
Whether the extent of the scroll view in the scrollDirection should be determined by the contents being viewed.
final

Methods

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

Static Properties

config ↔ PaginatedItemsBuilderConfig?
The overall config, that can be used to set some variables across all instances of PaginatedItemsBuilder.
getter/setter pair