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

flutter_swipe_button 封面
套件詳情v2.1.3

flutter_swipe_button

使用 SwipeButton 避免意外點擊或對話框。

AndroidiOSWebmacOSWindowsLinux
近 30 天下載
6960
喜歡數
68
Pub 分數
140

安裝套件

flutter pub add flutter_swipe_button

套件介紹

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

flutter_swipe_button 套件提供了一個滑動確認介面,有助於在 Flutter 應用中防止意外動作。透過要求使用者滑動按鈕來完成動作,它增加了一層有意的互動,非常適合刪除資料或確認購買等關鍵操作。此元件可自訂,支援多個平台,並能順暢整合至現有的 UI 中。它透過減少無意的互動,同時維持現代且直覺的設計,提升使用者體驗。

適用情境

  • 防止意外刪除
  • 確認敏感操作
  • 減少表單中的誤報
  • 增強關鍵操作的安全性
  • 改進確認對話框的使用者體驗

主要特色

  • 滑動確認手勢
  • 可自訂外觀
  • 跨平台支援
  • 簡單整合
  • 可設定的動畫
  • 無障礙設計

適合對象

  • 具有高風險操作的應用
  • 需要確認步驟的使用者介面
  • 行動裝置優先的應用程式
  • 重視使用者體驗安全的開發者
  • 需要最少程式碼變更的專案

使用建議

  • 可能需要額外的可訪問性測試
  • 不適合快速連續的互動
  • 限制為單向滑動
  • 跨平台設計一致性
  • 新使用者可能需要一定的學習曲線
  • 依賴手勢辨識的準確性

原始 README

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

flutter_swipe_button

pub package License: MIT

Avoid accidental clicks or dialogs to prevent them using SwipeButton.

Screenshot

Example 1 Example 2 Example 3

Getting Started

Adding package
flutter_swipe_button: ^2.1.1+1
Importing package
import 'package:flutter_swipe_button/flutter_swipe_button.dart';

How to use

SwipeButton.expand(
  thumb: Icon(
    Icons.double_arrow_rounded,
    color: Colors.white,
  ),
  child: Text(
    "Swipe to ...",
    style: TextStyle(
      color: Colors.red,
    ),
  ),
  activeThumbColor: Colors.red,
  activeTrackColor: Colors.grey.shade300,
  onSwipe: () {
    ScaffoldMessenger.of(context).showSnackBar(
      SnackBar(
        content: Text("Swipped"),
        backgroundColor: Colors.green,
      ),
    );
  },
)

SwipeButton(
  trackPadding: EdgeInsets.all(6),
  elevationThumb: 2,
  child: Text(
    "Swipe to ...",
    style: TextStyle(
      color: Colors.white,
    ),
  ),
  onSwipe: () {
    ScaffoldMessenger.of(context).showSnackBar(
      SnackBar(
        content: Text("Swipped"),
        backgroundColor: Colors.green,
      ),
    );
  },
)

SwipeButton(
  thumbPadding: EdgeInsets.all(3),
  thumb: Icon(
    Icons.chevron_right,
    color: Colors.white,
  ),
  elevationThumb: 2,
  elevationTrack: 2,
  child: Text(
    "Swipe to ...".toUpperCase(),
    style: TextStyle(
      color: Colors.white,
      fontSize: 18,
      fontWeight: FontWeight.bold,
    ),
  ),
  onSwipe: () {
    ScaffoldMessenger.of(context).showSnackBar(
      SnackBar(
        content: Text("Swipped"),
        backgroundColor: Colors.green,
      ),
    );
  },
)

SwipeButton(
  borderRadius: BorderRadius.circular(8),
  activeTrackColor: Colors.amber,
  height: 60,
  child: Text(
    "Swipe to ...",
    style: TextStyle(
      color: Colors.red,
    ),
  ),
  onSwipe: () {
    ScaffoldMessenger.of(context).showSnackBar(
      SnackBar(
        content: Text("Swipped"),
        backgroundColor: Colors.green,
      ),
    );
  },
)

SwipeButton(
  activeTrackColor: Colors.blue,
  activeThumbColor: Colors.yellow,
  borderRadius: BorderRadius.zero,
  height: 30,
  child: Text(
    "Swipe to ...",
    style: TextStyle(
      color: Colors.white,
    ),
  ),
  onSwipe: () {
    ScaffoldMessenger.of(context).showSnackBar(
      SnackBar(
        content: Text("Swipped"),
        backgroundColor: Colors.green,
      ),
    );
  },
)

SwipeButton(
  width: 200,
  child: Text(
    "Swipe to ...",
    style: TextStyle(
      color: Colors.white,
    ),
  ),
  onSwipe: () {
    ScaffoldMessenger.of(context).showSnackBar(
      SnackBar(
        content: Text("Swipped"),
        backgroundColor: Colors.green,
      ),
    );
  },
)

License

MIT License

所屬分類

原始碼儲存庫

使用此套件的專案

暫無相關資料。