UIPaging class

A class that handles pagination logic and generates view parameters for rendering. The UIPaging class is used to manage pagination, including calculating the current page, the range of pages to display, and handling query parameters. It extends FinchView to integrate with the application's view rendering system.

Inheritance

Constructors

UIPaging({required String widget, Map<String, Object?> params = const {}, required int page, required int total, int pageSize = 20, String prefix = 'page', Map<String, String> otherQuery = const <String, String>{}, int widthSide = 2, bool useRequsetQueries = false, String orderBy = '', bool orderReverse = false})
Creates a new UIPaging instance. The constructor requires a widget identifier, and the page and total number of items. Optional parameters include:
UIPaging.fromRequest({required int total, String prefix = 'page', String widget = 'dashboard/theme/ui/paging', Map<String, String> otherQuery = const {}, int pageSize = 5, String orderByDef = '', bool orderReverseDef = false, int pageDef = 1})
A factory constructor to create UIPaging from a request. This factory method extracts relevant pagination information from the request and provides default values for optional parameters:
factory

Properties

hashCode int
The hash code for this object.
no setterinherited
offset int
no setter
orderBy String
The column or field used for ordering the items.
getter/setter pair
orderReverse bool
Whether the ordering should be in reverse (descending).
getter/setter pair
otherQuery Map<String, String>
Additional query parameters to include in the pagination URLs.
getter/setter pair
page int
The current page number.
getter/setter pair
pageSize int
The number of items per page. Defaults to 20.
getter/setter pair
params Map<String, Object?>
A map containing parameters that can be passed to the view for rendering.
getter/setter pairinherited
prefix String
The query parameter used to identify the page number in URLs. Defaults to 'page'.
getter/setter pair
rq Request
Gets the current WebRequest from the request context
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
start int
Calculates the starting index for the current page based on page and pageSize. The start index is adjusted if the page exceeds the total number of items.
no setter
total int
The total number of items.
getter/setter pair
useRequsetQueries bool
Whether to use query parameters from the request object.
getter/setter pair
widget String
The path to the widget or view template.
getter/setter pairinherited
widthSide int
The number of pages displayed on either side of the current page.
getter/setter pair

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
render({bool toData = false}) Future<Object>
Renders the view. The toData parameter determines whether to render as raw data or as a fully rendered view using the specified widget template. If toData is true, the method returns the data processed by renderData. Otherwise, it returns the rendered view content. If the widget path is empty, an error message is returned.
inherited
renderData() Future<Map<String, Object?>>
Generates and returns a map of data for rendering the pagination UI. The method calculates the page range to display, handles edge cases where the page number is out of bounds, and includes additional query parameters. The returned map includes:
override
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited