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

slide_action 封面
套件詳情v0.0.2

slide_action

一個高度可自訂的滑動執行動作組件。此套件提供了一個易於使用的組件,支援多個平台。

AndroidiOSWebmacOSWindowsLinux
近 30 天下載
3610
喜歡數
93
Pub 分數
160

安裝套件

flutter pub add slide_action

套件介紹

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

SlideAction 是一個可自定義的滑動組件,允許使用者透過滑動來觸發動作。專為跨平台使用設計,支援 Android、iOS、Web、macOS、Windows 與 Linux。此組件提供流暢的動畫與直覺的互動體驗,非常適合用於確認刪除項目或核准請求等動作。具有高度可配置性,支援顏色、形狀、標籤與手勢敏感度等多種選項。基於 Flutter 建構,可無縫整合至現有應用程式中,無需額外相依性。

適用情境

  • 確認刪除
  • 批准動作
  • 使用者引導流程
  • 表單提交
  • 互動式教學
  • 基於切換的介面

主要特色

  • 跨平台相容性
  • 可自訂外觀
  • 流暢的滑動動畫
  • 可設定的操作觸發器
  • 支援多個平台
  • 與 Flutter 的輕鬆整合

適合對象

  • 開發互動式 UI 的開發者
  • 需要基於手勢確認的應用程式
  • 尋求可重複使用組件的設計師
  • 針對多個平台的專案
  • 快速原型使用者互動

使用建議

  • 可能需要調整以適應觸控敏感度
  • 僅限滑動觸控互動
  • 不適合複雜的手勢
  • 效能取決於動畫的複雜度
  • 需要仔細設計以確保可存取性

原始 README

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

pub.dev likes popularity pub points pub.dev

➡️ Slide Action

Slide action is a simple to use widget where the user has to slide to perform an action.


Example Preview 📱

Slide action preview


Features

  • Highly customizable.
  • Smooth thumb movement.
  • RTL support.
  • Async operations support.
  • Multi-platform support.
  • Multiple examples (included in example project)

Installing

Add this line to your pubspec.yaml under the dependencies:

dependencies:
  slide_action: ^0.0.1+3

alternatively, you can use this command:

flutter pub add slide_action

Usage

Simple Example

SlideAction(
    trackBuilder: (context, state) {
        return Container(
            decoration: BoxDecoration(
                borderRadius: BorderRadius.circular(16),
                color: Colors.white,
                boxShadow: const [
                    BoxShadow(
                        color: Colors.black26,
                        blurRadius: 8,
                    ),
                ],
            ),
            child: Center(
                child: Text(
                    "Thumb fraction: ${state.thumbFractionalPosition.toStringAsPrecision(2)}",
                ),
            ),
        );
    },
    thumbBuilder: (context, state) {
        return Container(
            margin: const EdgeInsets.all(4),
            decoration: BoxDecoration(
                color: Colors.orange,
                borderRadius: BorderRadius.circular(16),
            ),
            child: const Center(
                child: Icon(
                    Icons.chevron_right,
                    color: Colors.white,
                ),
            ),
        );
    },
    action: () {
        debugPrint("Hello World");
    },
);

SlideAction Simple Example 1


Async Example
SlideAction(
    trackBuilder: (context, state) {
        return Container(
            decoration: BoxDecoration(
                borderRadius: BorderRadius.circular(16),
                color: Colors.white,
                boxShadow: const [
                    BoxShadow(
                        color: Colors.black26,
                        blurRadius: 8,
                    ),
                ],
            ),
            child: Center(
                child: Text(
                    // Show loading if async operation is being performed
                    state.isPerformingAction
                        ? "Loading..."
                        : "Thumb fraction: ${state.thumbFractionalPosition.toStringAsPrecision(2)}",
                ),
            ),
        );
    },
    thumbBuilder: (context, state) {
        return Container(
            margin: const EdgeInsets.all(4),
            decoration: BoxDecoration(
                color: Colors.orange,
                borderRadius: BorderRadius.circular(16),
            ),
            child: Center(
                // Show loading indicator if async operation is being performed
                child: state.isPerformingAction
                    ? const CupertinoActivityIndicator(
                        color: Colors.white,
                    )
                    : const Icon(
                        Icons.chevron_right,
                        color: Colors.white,
                    ),
            ),
        );
    },
    action: () async {
        // Async operation
        await Future.delayed(
            const Duration(seconds: 2),
            () => debugPrint("Hello World"),
        );
    },
);

SlideAction Simple Example 2


Notes

  • As of version 0.0.2, disabledColorTint property does not work on web as the color blend modes support is currently buggy for web. The opacity of the widget is reduced instead in case of web when disabled.

Additional information

Check the documentation or example project on github for advanced usage.

Facing issues? Feel free to report an issue on the Github Page

所屬分類

原始碼儲存庫

使用此套件的專案

暫無相關資料。