PagerItemTypes enum
author:郑再红 email:1096877329@qq.com date: 2024/1/23 time: 16:57 describe: 分页组件 - 支持主题配置的企业级分页器 Enterprise-level pagination component with theme support
功能特性 / Features
- 🎨 主题系统 - 内置多种预设主题,支持自定义 / Theme system with presets
- 📄 页码显示 - 智能省略号,可配置显示范围 / Smart ellipsis, configurable range
- 🔢 输入跳转 - 支持输入框快速跳转页码 / Input box for quick page jump
- 🎯 完全自定义 - 支持自定义样式和行为 / Fully customizable style and behavior
- 📱 响应式设计 - 适配不同屏幕尺寸 / Responsive design
基础示例 / Basic Example
// 使用默认主题
Pager(
totalCount: 1000,
pageEach: 20,
currentPage: 1,
pageChange: (totalPages, currentPage) {
print('当前页: $currentPage');
},
)
// 使用预设主题
Pager(
totalCount: 500,
pageEach: 10,
currentPage: 1,
theme: PagerTheme.blueTheme,
pageChange: (totalPages, currentPage) {
print('页码: $currentPage');
},
)
// 自定义主题
Pager(
totalCount: 200,
pageEach: 15,
currentPage: 1,
theme: PagerTheme.defaultTheme.copyWith(
pageIndicatorActiveColor: Colors.purple,
checkedPageColor: Colors.white,
checkedPageBoxDecoration: BoxDecoration(
color: Colors.purple,
borderRadius: BorderRadius.circular(8),
),
),
pageChange: (totalPages, currentPage) {
// 处理页码变化
},
)
// 暗色主题
Pager(
totalCount: 300,
pageEach: 20,
currentPage: 1,
theme: PagerTheme.darkTheme,
pageChange: (totalPages, currentPage) {
print('页码: $currentPage');
},
)
eg:
注意事项 / Notes
- 使用 theme 参数可以快速应用预设主题 / Use theme for quick preset styles
- 单独设置的样式参数会覆盖主题中的值 / Individual params override theme
- 内置主题: defaultTheme, blueTheme, greenTheme, darkTheme / Built-in themes
- 可以使用 copyWith 方法自定义主题 / Use copyWith to customize theme
- totalCount 为总数据量,pageEach 为每页数量 / totalCount is total, pageEach is per page
- currentPage 从 1 开始计数 / currentPage starts from 1
- pageChange 回调返回的 currentPage 也是从 1 开始 / Callback returns 1-based index
Values
- prev → const PagerItemTypes
- next → const PagerItemTypes
- ellipsis → const PagerItemTypes
- number → const PagerItemTypes
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- index → int
-
A numeric identifier for the enumerated value.
no setterinherited
- name → String
-
Available on Enum, provided by the EnumName extension
The name of the enum value.no setter - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Constants
-
values
→ const List<
PagerItemTypes> - A constant List of the values in this enum, in order of their declaration.