UIPaging.fromRequest constructor
UIPaging.fromRequest(})
A factory constructor to create UIPaging from a request object rq
.
This factory method extracts relevant pagination information from the request and provides default values for optional parameters:
total
: The total number of items.profix
: The page query parameter name (default is 'page').widget
: The widget identifier (default is 'dashboard/theme/ui/paging').otherQuery
: Additional query parameters.pageSize
: The number of items per page (default is 5).orderByDef
: The default field for ordering.orderReverseDef
: The default ordering direction.pageDef
: The default page number (default is 1).
Implementation
factory UIPaging.fromRequest(
WebRequest rq, {
required int total,
String profix = 'page',
String widget = 'dashboard/theme/ui/paging',
Map<String, String> otherQuery = const {},
int pageSize = 5,
String orderByDef = '',
bool orderReverseDef = false,
int pageDef = 1,
}) {
var page = rq.get<int>(profix, def: pageDef);
var pageSizeFix = rq.get<int>('pageSize', def: pageSize);
var orderBy = rq.get<String>('orderBy', def: orderByDef);
var orderReverse = rq.get<bool>('orderReverse', def: orderReverseDef);
return UIPaging(
rq: rq,
widget: widget,
page: page,
total: total,
pageSize: pageSizeFix,
orderBy: orderBy,
orderReverse: orderReverse,
profix: profix,
otherQuery: otherQuery,
);
}