搜尋套件、儲存庫與 APP 分類

pull_to_reveal 封面
套件詳情v0.0.2

pull_to_reveal

一個簡單的 Flutter 小部件,包裝了一個 `ListView`,並根據使用者的滾動行為選擇性地渲染一個隱藏的頂部元素。

近 30 天下載
107
喜歡數
29
Pub 分數
40

安裝套件

flutter pub add pull_to_reveal

套件介紹

根據套件公開資料產生的選型評估,僅供參考。

一個 Flutter 小部件,透過在使用者向下捲動時顯示隱藏的頂端元素,再於向上捲動時隱藏該元素,從而增強 ListView 的功能。它為展示補充內容(如篩選器或動作)提供流暢且互動性強的體驗,而不會讓主列表顯得雜亂。該行為由捲動方向與敏感度觸發,非常適合動態 UI。它輕量級且容易整合到現有的基於列表的介面中。

適用情境

  • 互動式標題揭示
  • 篩選或操作欄顯示
  • 動態UI圖層
  • 滾動驅動的內容切換
  • 增強的列表導航
  • 自訂下拉刷新替代方案

主要特色

  • 滾動觸發的可見性
  • 平滑的動畫過渡
  • 最小設定
  • 支援任何 widget 作為覆蓋層
  • 與標準 ListView 兼容
  • 可適應不同的捲動敏感度

適合對象

  • 尋求細微使用者介面互動的開發者
  • 需要額外控制項的密集列表應用
  • 想要基於手勢的內容揭示的設計人員
  • 需要輕量級滾動邏輯的項目
  • 尋找增強使用者體驗的Flutter ListViews使用者

使用建議

  • 限制為垂直滾動
  • 可能與其他滾動監聽器衝突
  • 需要仔細調整揭示閾值
  • 不適合用於水平清單
  • 最佳搭配簡單的覆蓋內容使用
  • 性能取決於疊加層的複雜性

原始 README

以下為關聯原始碼儲存庫的 README 原文快照,最新內容請造訪原始碼儲存庫。

pull_to_reveal

A simple Flutter widget that wraps a ListView and selectively renders a hidden top element based on user scroll behavior.

Getting Started

To use the PullToRevealListView widget in your Flutter project, you need only wrap it in a LayoutBuilder and then a Stack. These are excellent for adding a little life to a Scaffold background, or for programming a Pong client.

import 'package:pull_to_reveal/pull_to_reveal.dart';
import 'package:flutter/material.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(widget.title),
      ),
      body: Center(
        child: PullToRevealTopItemList(
          itemCount: _counter,
          itemBuilder: (BuildContext context, int index) {
            return ListItemElement(index: index);
          },
          revealableHeight: 50,
          revealableBuilder: (BuildContext context, RevealableToggler opener, RevealableToggler closer, BoxConstraints constraints) {
            return Row(
              children: <Widget>[
                SizedBox(width: 10),
                Flexible(
                  child: TextFormField(
                    controller: searchController,
                    decoration: InputDecoration(
                      hintText: 'Search',
                      suffixIcon: Icon(Icons.search),
                    ),
                  ),
                ),
                IconButton(
                  icon: Icon(Icons.cancel),
                  onPressed: () {
                    // Handles closing the `Revealable`
                    closer();
                    // Removes any filtering effects
                    searchController.text = '';
                    setState(() {
                      _filter = null;
                    });
                  },
                )
              ],
            );
          },
        ),
      ),
    );
  }
}
Example

所屬分類

原始碼儲存庫

使用此套件的專案

暫無相關資料。