WePagination class

Page controls for a list, after el-pagination.

Pages are 1-based. Give total and pageSize; the widget derives the page count, collapses long runs with ellipses and optionally shows the total, a page-size picker and a "go to" jumper.

WePagination(
  total: 486,
  page: page,
  pageSize: size,
  onPageChanged: (p) => setState(() => page = p),
  pageSizes: const [10, 20, 50],
  onPageSizeChanged: (s) => setState(() { size = s; page = 1; }),
  showTotal: true,
  showJumper: true,
)

Platform: desktop and web (pointer + keyboard, wide screen). On phones prefer PaginationView.

Inheritance

Constructors

WePagination({Key? key, required int total, required int page, required int pageSize, required ValueChanged<int> onPageChanged, List<int>? pageSizes, ValueChanged<int>? onPageSizeChanged, bool showTotal = false, bool showJumper = false, int pagerCount = 7, bool small = false, bool background = true, String totalBuilder(int total)?, MainAxisAlignment alignment = MainAxisAlignment.end})
const

Properties

alignment → MainAxisAlignment
final
background → bool
Fill page buttons instead of drawing them as plain text.
final
hashCode → int
The hash code for this object.
no setterinherited
key → Key?
Controls how one widget replaces another widget in the tree.
finalinherited
onPageChanged → ValueChanged<int>
final
onPageSizeChanged → ValueChanged<int>?
final
page → int
final
pageCount → int
no setter
pagerCount → int
Maximum number of page buttons shown at once; odd, at least 5.
final
pageSize → int
final
pageSizes → List<int>?
Offer these sizes in a picker. Requires onPageSizeChanged.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
showJumper → bool
final
showTotal → bool
final
small → bool
final
total → int
final
totalBuilder → String Function(int total)?
Custom total text, e.g. (n) => '共 $n 条'.
final

Methods

build(BuildContext context) → Widget
Describes the part of the user interface represented by this widget.
override
createElement() → StatelessElement
Creates a StatelessElement to manage this widget's location in the tree.
inherited
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