搜索插件、代码仓与 APP 分类

pagination_flutter 封面
插件详情v0.0.8

pagination_flutter

一个模块化的分页组件,适用于 Flutter。带有页面指示器和页面导航按钮的分页组件 - 兼容所有设备和平台。

AndroidiOSWebmacOSWindowsLinux
近 30 天下载
923
喜欢数
35
Pub 分数
145

安装插件

flutter pub add pagination_flutter

插件介绍

基于插件公开信息、社区数据与项目使用情况整理的选型参考。

一个用于 Flutter 的模块化分页组件,提供可自定义的页面指示器和导航按钮。专为在 Android、iOS、Web、macOS、Windows 和 Linux 等所有平台上无缝运行而设计。该包提供简洁且响应式的界面,用于浏览分页内容,非常适合列表、轮播图或任何数据密集型 UI。支持手动和自动分页,具有平滑过渡效果和无障碍功能。

适合场景

  • 显示分页列表
  • 创建图像滑块
  • 构建数据密集型仪表板
  • 实现无限滚动界面
  • 增强移动和网页应用导航

主要特点

  • 跨平台兼容性
  • 可自定义的页面指示器
  • 内置导航按钮
  • 响应式设计
  • 无障碍支持
  • 模块化架构

适合对象

  • 开发多平台应用的开发者
  • 需要一致分页用户体验的团队
  • 需要可访问性 UI 组件的项目
  • 包含大型数据集或内容轮播的应用程序
  • 专注于可重用组件的前端开发人员

使用建议

  • 需要与现有列表或滚动视图集成
  • 仅限视觉分页;不处理数据获取
  • 可能需要额外的逻辑来处理动态内容加载
  • 未针对极高页数进行优化

原始 README

以下为关联源码仓库的 README 原文快照,最新内容请访问源码仓库。

pagination_flutter

Getting started

Installation
dependencies:
  pagination_flutter: ^0.0.8
import 'package:pagination_flutter/pagination_flutter.dart';

Preview

Usage

class _MyHomePageState extends State<MyHomePage> {
  int selectedPage = 1;

  setSelectedPage(int index) {
    setState(() {
      selectedPage = index;
    });
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text("Flutter Pagination"),
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: [
            Pagination(
              numOfPages: 10,
              selectedPage: selectedPage,
              pagesVisible: 3,
              onPageChanged: (page) {
                setState(() {
                  selectedPage = page;
                });
              },
              nextIcon: const Icon(
                Icons.arrow_forward_ios,
                color: Colors.blue,
                size: 14,
              ),
              previousIcon: const Icon(
                Icons.arrow_back_ios,
                color: Colors.blue,
                size: 14,
              ),
              activeTextStyle: const TextStyle(
                color: Colors.white,
                fontSize: 14,
                fontWeight: FontWeight.w700,
              ),
              activeBtnStyle: ButtonStyle(
                backgroundColor: MaterialStateProperty.all(Colors.blue),
                shape: MaterialStateProperty.all(
                  RoundedRectangleBorder(
                    borderRadius: BorderRadius.circular(38),
                  ),
                ),
              ),
              inactiveBtnStyle: ButtonStyle(
                shape: MaterialStateProperty.all(RoundedRectangleBorder(
                  borderRadius: BorderRadius.circular(38),
                )),
              ),
              inactiveTextStyle: const TextStyle(
                fontSize: 14,
                fontWeight: FontWeight.w700,
              ),
            ),
          ],
        ),
      ),
    );
  }
}

Additional information

Properties
Name Type Default Description
numOfPages int 0 Number of pages to be displayed
selectedPage int 0 The currently selected page
pagesVisible int 0 Number of pages to be visible
onPageChanged Function null Function to be called when a page is selected
nextIcon Widget null Widget to be displayed as the next icon
previousIcon Widget null Widget to be displayed as the previous icon
activeTextStyle TextStyle null TextStyle for the active page
activeBtnStyle ButtonStyle null ButtonStyle for the active page
inactiveBtnStyle ButtonStyle null ButtonStyle for the inactive pages
inactiveTextStyle TextStyle null TextStyle for the inactive pages
spacing double 0 Spacing between the pages

License

MIT

Author

Varun V

Issues

If you find any issues, please report them here

所属分类

源码仓库

使用此插件的项目

暂无相关数据。