搜尋套件、儲存庫與 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 元件的專案
  • 包含大型資料集或內容輪播的應用程式
  • 專注於可重複使用元件的前端開發人員

使用建議

  • 需要與現有列表或滾動視圖整合
  • 僅限視覺分頁;不處理資料擷取
  • 可能需要額外的邏輯來處理動態內容加載
  • 未針對極高頁數進行優化

原始 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

所屬分類

原始碼儲存庫

使用此套件的專案

暫無相關資料。