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

套件詳情v1.0.5

scrollable

一組功能強大的可捲動組件,包含觸覺反饋、鍵盤隱藏等更多功能。

AndroidiOSWebmacOSWindowsLinux
近 30 天下載
1220
喜歡數
24
Pub 分數
160

安裝套件

flutter pub add scrollable

套件介紹

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

scrollable 包透過一組可自訂的滾動元件,增強了 Flutter 的滾動功能。它內建觸覺反饋、自動鍵盤關閉,以及跨平台改善的滾動行為。專為尋求精細滾動互動的開發者設計,支援所有主要平台,包括 Android、iOS、Web、macOS、Windows 和 Linux。此套件擴展了 Flutter 核心 ScrollView 元件,加入額外功能,在不犧牲效能或彈性的情況下提升使用者體驗。

適用情境

  • 增強表單中的滾動互動
  • 建立具有觸覺反饋的響應式清單
  • 構建可滾動的介面以關閉鍵盤
  • 改進可存取性滾動內容
  • 在多個平台上實現平滑捲動

主要特色

  • 滾動時的觸覺反饋
  • 自動鍵盤收起
  • 跨平台滾動行為
  • 可自定的滾動物理效果
  • 內建滾動指示器
  • 可擴展的組件架構

適合對象

  • 開發互動式可捲動 UI 的開發者
  • 需要觸覺反饋的應用程式
  • 表單密集型應用
  • 跨平台 Flutter 項目
  • 以可存取性為重點的設計

使用建議

  • 需要了解 Flutter 的滾動系統
  • 可能會稍微增加封裝大小
  • 除了基本用法外,文件內容有限
  • 不適用於簡單的清單顯示
  • 最佳搭配自訂滾動控制器使用

原始 README

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

🔥 A powerful set of scrollable widgets: haptics, keyboard dismissing, and more 🔥

  • Submit an issue here.
  • Create a pull request here.
  • Contact me via email [here](mailto:me@matthewtrent.me).

3 Widgets in this package 📚

💥 ScrollHaptics
  • Applies haptic feedback when its child is scrolled (during scroll & reaching edge of scroll view).
💥 KeyboardDismiss
  • Dismisses the soft-keyboard when its child is scrolled, tapped, or swiped.
💥 ScrollableView
  • The above 2 widgets combined into 1 widget for ease-of-use.

Example Gif 📸

It's hard to display haptics in a gif, but they're there.

Installing 🧑‍🏫

  • Install the package from the pub.
    • flutter pub add scrollable
  • Import the package.
    • import 'package:scrollable/exports.dart';

Quick Start 💨

Simply wrap whatever you want inside the ScrollHaptics, KeyboardDismiss, or ScrollableView widgets, then edit whatever of their properties you want!

Short Examples of the 3 Widgets 📜

For a full example with context, view the examples tab. It shows just the ScrollableView, but it's the same layout for all 3 widgets.

Scroll Haptics

ScrollHaptics

ScrollHaptics(
        // <Assorted Properties Here>
        child: SingleChildScrollView(
          child: Column(
            children: [
              Container(height: 100, width: 100, color: Colors.redAccent),
              Container(height: 100, width: 100, color: Colors.blue),
              Container(height: 100, width: 100, color: Colors.purple),
            ],
          ),
        ),
      );
Keyboard Dismiss

KeyboardDismiss

KeyboardDismiss(
          // <Assorted Properties Here>
        child: SingleChildScrollView(
          child: Column(
            children: [
              Container(height: 100, width: 100, color: Colors.redAccent),
              Container(height: 100, width: 100, color: Colors.blue),
              Container(height: 100, width: 100, color: Colors.purple),
            ],
          ),
        ),
      );
Scrollable View

ScrollableView

ScrollableView(
          // <Assorted Properties Here>
        controller: ScrollController(),
        child: SingleChildScrollView(
          child: Column(
            children: [
              Container(height: 100, width: 100, color: Colors.redAccent),
              Container(height: 100, width: 100, color: Colors.blue),
              Container(height: 100, width: 100, color: Colors.purple),
            ],
          ),
        ),
      );

Properties of the 3 Widgets 📜

Scroll Haptics

ScrollHaptics

Highly reccomended to use ClampingScrollPhysics for the physics of whatever scrollable you're wrapping, as it works best with haptics.

  • child (required): This widget's child.
  • bubbleUpScrollNotifications: Whether the widget should bubble up scroll notifications, or block them.
  • heavyHapticsAtEdgeEnabled: When a scroll reaches the edge, if there should be a haptic effect emitted.
  • hapticEffectAtEdge: Which kind of haptic effect should be emitted when the scroll edge is reached?
  • hapticEffectDuringScroll: Which kind of haptic effect should be emitted during the scroll.
  • distancebetweenHapticEffectsDuringScroll: The distance, in pixels, that should be scrolled before emitting a new haptic scroll effect.
Keyboard Dismiss

KeyboardDismiss

  • child (required): This widget's child.
  • bubbleUpScrollNotifications: Whether the widget should bubble up scroll notifications, or block them.
  • closeKeyboardOnTap: If the keyboard should also be closed just on the widget being tapped.
  • closeKeyboardOnVerticalSwipe: If the keyboard should be closed when a vertical swipe occurs.
  • onKeyboardDismissed: Callback triggered when a dismiss occurs.
Scrollable View

ScrollableView

  • child (required): This widget's child.
  • controller (required): A ScrollController to manage the scrolling of the widget.
  • bubbleUpScrollNotifications: Whether the widget should bubble up scroll notifications, or block them.
  • closeKeyboardOnScroll: Whether the keyboard should be automatically closed on the widget being scrolled.
  • closeKeyboardOnTap: If the keyboard should also be closed just on the widget being tapped.
  • physics: Physics of the scroll view. Highly reccomended to use ClampingScrollPhysics as it works best with haptics.
  • scrollDirection: Direction of the scroll.
  • inlineBottomOrRightPadding: Inline padding of the scroll view. This is a clean substitute to having to add SizedBox widgets inside your scroll view. For the bottom (if vertical) or right (if horizontal) of the scroll view.
  • inlineTopOrLeftPadding: Inline padding of the scroll view. This is a clean substitute to having to add SizedBox widgets inside your scroll view. For the top (if vertical) or left (if horizontal) of the scroll view.
  • padding: Outer padding of the widget.
  • hapticsEnabled: If haptics should be enabled.
  • distancebetweenHapticEffectsDuringScroll: The distance, in pixels, that should be scrolled before emitting a new haptic scroll effect.
  • heavyHapticsAtEdgeEnabled: If the haptics when the edge of the scroll is reached should be enabled or not.
  • hapticEffectAtEdge: Which kind of haptic effect should be emitted when the scroll edge is reached?
  • hapticEffectDuringScroll: Which kind of haptic effect should be emitted during the scroll.
  • primary: Whether this is the primary scroll view associated with the parent PrimaryScrollController.
  • dragStartBehavior: Determines the way that drag start behavior is handled.
  • restorationId: Restoration ID to save and restore the scroll offset of the scrollable.
  • reverse: Whether the scroll view scrolls in the reading direction.
  • closeKeyboardOnVerticalSwipe: If the keyboard should be closed when a vertical swipe occurs.

Additional Info 📣

analytics

所屬分類

原始碼儲存庫

使用此套件的專案

暫無相關資料。