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

套件詳情v2.1.1

scrolls_to_top

一個用於處理 iOS 滾動到頂部功能的 Dart 套件。容易使用

AndroidiOSWebmacOSWindowsLinux
近 30 天下載
3.6萬
喜歡數
59
Pub 分數
160

安裝套件

flutter pub add scrolls_to_top

套件介紹

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

scrolls_to_top 套件簡化了在跨平台 Flutter 應用中實現 iOS 滾動到頂部手勢。它讓開發者能夠輕鬆新增和管理類似下拉刷新的行為,也就是從可滾動組件的頂部向上滾動時觸發滾動到頂部動作。此套件以簡單為設計宗旨,能無縫整合至現有的可滾動組件中,無需複雜設定。非常適合希望在 Android 及其他平台複製原生 iOS 滾動行為的應用。

適用情境

  • 實現 iOS 風格的滾動到頂部手勢
  • 增強可滾動列表中的使用者體驗
  • 在跨平台應用中添加平台特定行為
  • 改進長內容螢幕中的導航
  • 支援在 iOS 與非 iOS 平台之間維持一致的使用者體驗

主要特色

  • 與 Scrollable 小部件的簡單整合
  • 跨平台相容性
  • 最少的樣板程式碼
  • 自動處理滾動至頂部邏輯
  • 可設定的觸發閾值

適合對象

  • 針對 iOS 類似互動的開發者
  • 跨平台應用開發者
  • 以使用者體驗為導向的 Flutter 專案
  • 包含長滾動內容的應用
  • 重視在多個平台實現原生體驗的團隊

使用建議

  • 可能需要額外的樣式以提供視覺反饋
  • 行為在非iOS平台可能會有略微差異
  • 對於沒有滾動到頂部期望的應用程式,不需要此功能
  • 基本觸發設定以外的自訂功能有限
  • 最佳搭配 RefreshIndicator 使用以獲得完整功能

原始 README

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

Scrolls to top

pub package

A dart package for working with scrolls-to-top iOS feature

Why is this needed? This is necessary for those cases when you have several nested Scaffolds or you need to distinguish the tap event in the status bar from other scroll events

Usage

Just wrap any widget with ScrollsToTop and provide onScrollsToTop argument

  @override
  Widget build(BuildContext context) {
    return ScrollsToTop(
      onScrollsToTop: _onScrollsToTop,
      scaffold: Scaffold(
        appBar: AppBar(title: const Text('Scroll to top')),
        body: Container(),
      ),
    );
  }

  Future<void> _onScrollsToTop(ScrollsToTopEvent event) async {
    //TODO: Your code
  }

Warning

  • You need to have at least one Scaffold in your application
  • If you use several Navigators, the tap events will come only to the widgets inside the main Navigator

所屬分類

原始碼儲存庫

使用此套件的專案