Pagify<FullResponse, Model> class

FullResponse is the type of the API response. Model is the type of each data item in the list.

Inheritance

Constructors

Pagify.gridView({Key? key, required PagifyController<Model> controller, required Future<FullResponse> asyncCall(BuildContext context, int currentPage), required PagifyData<Model> mapper(FullResponse response), required PagifyErrorMapper errorMapper, required Widget itemBuilder(BuildContext context, List<Model> data, int index, Model element), ScrollPhysics? physics, void onScrollPositionChanged(ScrollPosition position, bool isMaxTop, bool isMaxBottom, bool isMiddle)?, EdgeInsetsGeometry padding = const EdgeInsets.all(0), double? cacheExtent, bool listenToNetworkConnectivityChanges = false, FutureOr<void> onConnectivityChanged(bool isConnected)?, FutureOr<void> onUpdateStatus(PagifyAsyncCallStatus status)?, bool isReverse = false, FutureOr<void> onLoading()?, FutureOr<void> onSuccess(BuildContext context, List<Model> data)?, FutureOr<void> onError(BuildContext context, int currentPage, PagifyException exception)?, bool ignoreErrorBuilderWhenErrorOccursAndListIsNotEmpty = false, bool showNoDataAlert = false, Widget? loadingBuilder, Widget errorBuilder(PagifyException e)?, Widget? emptyListView, double? mainAxisSpacing, double? crossAxisSpacing, double? childAspectRatio = 1, Axis? scrollDirection, int? crossAxisCount, String? noConnectionText, String? cacheKey, Map<String, dynamic> cacheToJson(Model item)?, Model cacheFromJson(Map<String, dynamic> json)?, void onSaveCache(String key, List<Map<String, dynamic>> items)?, List<Map<String, dynamic>>? onReadCache(String key)?})
Creates a paginated widget with a GridView layout.
Pagify.listView({Key? key, required PagifyController<Model> controller, required Future<FullResponse> asyncCall(BuildContext context, int currentPage), required PagifyData<Model> mapper(FullResponse response), required PagifyErrorMapper errorMapper, required Widget itemBuilder(BuildContext context, List<Model> data, int index, Model element), ScrollPhysics? physics, void onScrollPositionChanged(ScrollPosition position, bool isMaxTop, bool isMaxBottom, bool isMiddle)?, EdgeInsetsGeometry padding = const EdgeInsets.all(0), double? itemExtent, double? cacheExtent, bool listenToNetworkConnectivityChanges = false, FutureOr<void> onConnectivityChanged(bool isConnected)?, FutureOr<void> onUpdateStatus(PagifyAsyncCallStatus status)?, bool isReverse = false, FutureOr<void> onLoading()?, FutureOr<void> onSuccess(BuildContext context, List<Model> data)?, FutureOr<void> onError(BuildContext context, int currentPage, PagifyException exception)?, bool ignoreErrorBuilderWhenErrorOccursAndListIsNotEmpty = false, bool showNoDataAlert = false, Widget? loadingBuilder, Widget errorBuilder(PagifyException e)?, Widget? emptyListView, bool? shrinkWrap, Axis? scrollDirection, String? noConnectionText, String? cacheKey, Map<String, dynamic> cacheToJson(Model item)?, Model cacheFromJson(Map<String, dynamic> json)?, void onSaveCache(String key, List<Map<String, dynamic>> items)?, List<Map<String, dynamic>>? onReadCache(String key)?})
Creates a paginated widget with a ListView layout.
Pagify.pageView({Key? key, required PagifyController<Model> controller, required Future<FullResponse> asyncCall(BuildContext context, int currentPage), required PagifyData<Model> mapper(FullResponse response), required PagifyErrorMapper errorMapper, required Widget itemBuilder(BuildContext context, List<Model> data, int index, Model element), ScrollPhysics? physics, void onPageChanged(int)?, bool? allowImplicitScrolling, PageController? pageController, bool? pageSnapping, void onScrollPositionChanged(ScrollPosition position, bool isMaxTop, bool isMaxBottom, bool isMiddle)?, bool listenToNetworkConnectivityChanges = false, FutureOr<void> onConnectivityChanged(bool isConnected)?, FutureOr<void> onUpdateStatus(PagifyAsyncCallStatus status)?, bool isReverse = false, FutureOr<void> onLoading()?, FutureOr<void> onSuccess(BuildContext context, List<Model> data)?, FutureOr<void> onError(BuildContext context, int currentPage, PagifyException exception)?, bool ignoreErrorBuilderWhenErrorOccursAndListIsNotEmpty = false, bool showNoDataAlert = false, Widget? loadingBuilder, Widget errorBuilder(PagifyException e)?, Widget? emptyListView, Axis? scrollDirection, String? noConnectionText, String? cacheKey, Map<String, dynamic> cacheToJson(Model item)?, Model cacheFromJson(Map<String, dynamic> json)?, void onSaveCache(String key, List<Map<String, dynamic>> items)?, List<Map<String, dynamic>>? onReadCache(String key)?})
Creates a paginated widget with a PageView layout.

Properties

allowImplicitScrolling bool?
Implicit Scrolling bool
final
asyncCall Future<FullResponse> Function(BuildContext context, int currentPage)
The asynchronous API call to fetch paginated data.
final
cacheExtent double?
cacheExtent property in list and grid view
final
cacheFromJson → Model Function(Map<String, dynamic> json)?
Converts a cached JSON map back to a Model item.
final
cacheKey String?
Optional cache key for offline support. Must be provided together with cacheToJson, cacheFromJson, onSaveCache, and onReadCache.
final
cacheToJson Map<String, dynamic> Function(Model item)?
Converts a Model item to a JSON map for caching.
final
childAspectRatio double?
Aspect ratio for each child in GridView.
final
controller PagifyController<Model>
Controller for interacting with the pagination state.
final
crossAxisCount int?
Number of columns in GridView.
final
crossAxisSpacing double?
Spacing between columns in GridView.
final
emptyListView Widget?
Custom widget to display when the data list is empty.
final
errorBuilder Widget Function(PagifyException e)?
Custom widget to display when an error occurs.
final
errorMapper PagifyErrorMapper
Maps network and HTTP errors to messages.
final
hashCode int
The hash code for this object.
no setterinherited
ignoreErrorBuilderWhenErrorOccursAndListIsNotEmpty bool
choose if need to ignore ErrorBuilder and keep the list visible when error occurs and list is not empty
final
isReverse bool
Whether the list should be displayed in reverse order.
final
itemBuilder Widget Function(BuildContext context, List<Model> data, int index, Model element)
Builds each list/grid item widget.
final
itemExtent double?
itemExtent property in list and grid view
final
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
listenToNetworkConnectivityChanges bool
listen to network connectivity changes
final
loadingBuilder Widget?
Custom loading widget to display while fetching data.
final
mainAxisSpacing double?
Spacing between rows in GridView.
final
mapper PagifyData<Model> Function(FullResponse response)
Maps the API FullResponse to a PagifyData object containing items and pagination info.
final
noConnectionText String?
Text to display when there is no internet connection.
final
onConnectivityChanged FutureOr<void> Function(bool isConnected)?
make action when connectivity changed
final
onError FutureOr<void> Function(BuildContext context, int currentPage, PagifyException exception)?
Callback fired when an error occurs while fetching data.
final
onLoading FutureOr<void> Function()?
Callback fired before an async call starts loading.
final
onPageChanged → void Function(int)?
on page changed Function
final
onReadCache List<Map<String, dynamic>>? Function(String key)?
Called to restore items from cache when a request fails. Return null or an empty list if no cache exists.
final
onSaveCache → void Function(String key, List<Map<String, dynamic>> items)?
Called to persist the fetched items list when a request succeeds.
final
onScrollPositionChanged → void Function(ScrollPosition position, bool isMaxTop, bool isMaxBottom, bool isMiddle)?
Callback to handle scroll position changes.
final
onSuccess FutureOr<void> Function(BuildContext context, List<Model> data)?
Callback fired when data is successfully fetched.
final
onUpdateStatus FutureOr<void> Function(PagifyAsyncCallStatus status)?
Called whenever the async call status changes.
final
padding EdgeInsetsGeometry
custom Scroll controller ScrollController padding property in list and grid view
final
pageController PageController?
page view controller PageController
final
pageSnapping bool?
page snapping bool
final
physics ScrollPhysics?
scroll physics ScrollPhysics
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
scrollDirection Axis?
Scroll direction for the list/grid.
final
showNoDataAlert bool
Whether to show a "No Data" alert when no data is available.
final
shrinkWrap bool?
Whether the list/grid should shrink-wrap its contents.
final

Methods

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