PaginatedGridView<T, S extends PaginatedState<T>> class

A reusable paginated grid widget that can be used with any data type

Inheritance

Constructors

PaginatedGridView({Key? key, required ProviderListenable<S> provider, required Widget itemBuilder(BuildContext context, T item, int index), required Future<void> onLoad(), required Future<void> onLoadMore(String nextPageToken), required Future<void> onRefresh(), required SliverGridDelegate gridDelegate, Widget? loadingWidget, Widget errorWidget(String error, VoidCallback retry)?, Widget? emptyWidget, double scrollThreshold = 0.8, EdgeInsetsGeometry padding = const EdgeInsets.all(12), List<Widget> topWidgets = const [], List<Widget> bottomWidgets = const [], Widget? loadingMoreWidget, bool showLoadingMoreIndicator = true, ScrollController? scrollController, ScrollPhysics? physics, bool reverse = false, bool shrinkWrap = false, Key? refreshIndicatorKey, double crossAxisSpacing = 0.0, double mainAxisSpacing = 0.0})
const
PaginatedGridView.count({Key? key, required ProviderListenable<S> provider, required Widget itemBuilder(BuildContext context, T item, int index), required Future<void> onLoad(), required Future<void> onLoadMore(String nextPageToken), required Future<void> onRefresh(), required int crossAxisCount, double mainAxisSpacing = 0.0, double crossAxisSpacing = 0.0, double childAspectRatio = 1.0, double? mainAxisExtent, Widget? loadingWidget, Widget errorWidget(String error, VoidCallback retry)?, Widget? emptyWidget, double scrollThreshold = 0.8, EdgeInsetsGeometry padding = const EdgeInsets.all(12), List<Widget> topWidgets = const [], List<Widget> bottomWidgets = const [], Widget? loadingMoreWidget, bool showLoadingMoreIndicator = true, ScrollController? scrollController, ScrollPhysics? physics, bool reverse = false, bool shrinkWrap = false, Key? refreshIndicatorKey})
Creates a paginated grid view with a fixed cross axis count
factory
PaginatedGridView.extent({Key? key, required ProviderListenable<S> provider, required Widget itemBuilder(BuildContext context, T item, int index), required Future<void> onLoad(), required Future<void> onLoadMore(String nextPageToken), required Future<void> onRefresh(), required double maxCrossAxisExtent, double mainAxisSpacing = 0.0, double crossAxisSpacing = 0.0, double childAspectRatio = 1.0, double? mainAxisExtent, Widget? loadingWidget, Widget errorWidget(String error, VoidCallback retry)?, Widget? emptyWidget, double scrollThreshold = 0.8, EdgeInsetsGeometry padding = const EdgeInsets.all(12), List<Widget> topWidgets = const [], List<Widget> bottomWidgets = const [], Widget? loadingMoreWidget, bool showLoadingMoreIndicator = true, ScrollController? scrollController, ScrollPhysics? physics, bool reverse = false, bool shrinkWrap = false, Key? refreshIndicatorKey})
Creates a paginated grid view with a maximum cross axis extent
factory

Properties

bottomWidgets List<Widget>
Additional widgets to place at the bottom of the grid
final
crossAxisSpacing double
Cross axis spacing for grid items
final
emptyWidget Widget?
Widget to show when the list is empty
final
errorWidget Widget Function(String error, VoidCallback retry)?
Widget to show when there's an error
final
gridDelegate SliverGridDelegate
Grid delegate for the grid view
final
hashCode int
The hash code for this object.
no setterinherited
itemBuilder Widget Function(BuildContext context, T item, int index)
Function to build each item in the grid
final
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
loadingMoreWidget Widget?
Widget to show when loading more
final
loadingWidget Widget?
Loading widget to show when initially loading
final
mainAxisSpacing double
Main axis spacing for grid items
final
onLoad Future<void> Function()
Function to load initial data
final
onLoadMore Future<void> Function(String nextPageToken)
Function to load more data with the next page token
final
onRefresh Future<void> Function()
Function to refresh the list
final
padding EdgeInsetsGeometry
Padding for the grid
final
physics ScrollPhysics?
Physics for the grid
final
provider → ProviderListenable<S>
The provider that contains the paginated state
final
refreshIndicatorKey Key?
Key for the refresh indicator
final
reverse bool
Whether to reverse the grid
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
scrollController ScrollController?
Scroll controller for the grid
final
scrollThreshold double
Threshold percentage to trigger loading more (0.0 - 1.0)
final
showLoadingMoreIndicator bool
Whether to show the loading more indicator
final
shrinkWrap bool
Whether to shrink wrap the grid
final
topWidgets List<Widget>
Additional widgets to place at the top of the grid
final

Methods

createElement() → ConsumerStatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() → ConsumerState<PaginatedGridView<T, S>>
Creates the mutable state for this widget at a given location in the tree.
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