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

slide_to_confirm 封面
套件詳情v1.1.0

slide_to_confirm

一個滑塊,當使用者將其滑動至 100% 時會觸發回呼函數。

AndroidiOSWebmacOSWindowsLinux
近 30 天下載
4600
喜歡數
150
Pub 分數
140

安裝套件

flutter pub add slide_to_confirm

套件介紹

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

一個 Flutter 套件,提供一個可自訂的滑桿元件,當使用者將滑桿完全滑動至 100% 時觸發回呼。它透過要求明確的手勢操作來增強使用者互動體驗,常見於確認刪除項目或提交表單等動作。此滑桿支援平滑動畫,並可使用自訂顏色、尺寸與標籤進行樣式設定。它可在所有主要平台(包含 Android、iOS、Web、macOS、Windows 與 Linux)上運作。

適用情境

  • 確認破壞性操作
  • 提交前的用戶驗證
  • 增強表單互動
  • 防止誤觸
  • 新增互動式回饋
  • 自定確認手勢

主要特色

  • 完整 100% 滑動啟用
  • 可設定的顏色和大小
  • 完成時的回調
  • 平滑動畫
  • 跨平台支援
  • 可自定義的標籤文字

適合對象

  • 表單確認
  • 刪除操作提示
  • 互動式 UI 元素
  • 使用者參與功能
  • 無障礙增強控制項
  • 簡單而有效的手勢輸入

使用建議

  • 需要使用者注意以完成
  • 可能需要進行無障礙調整
  • 僅限單向滑動
  • 不適合快速輸入
  • 視覺反饋應明確
  • 複雜佈局上的效能影響

原始 README

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

slide_to_confirm

A customizable slider that will activate a callback when the user slides it to 100%.

Installation

In the dependencies: section of your pubspec.yaml, add the following line:

slide_to_confirm: <latest_version>

Usage

import 'package:slide_to_confirm/slide_to_confirm.dart';

class MyWidget extends StatelessWidget {

    void confirmed(){
        print('Slider confirmed!');
    }

    Widget build(BuildContext context) {
        return ConfirmationSlider(
            onConfirmation: () => confirmed(),
        );
    }
}

Properties

  • height double: Height of the slider. Defaults to 70.
  • width double: Width of the slider. Defaults to 300.
  • backgroundColor Color: The color of the background of the slider. Defaults to Colors.white.
  • backgroundColorEnd Color: The color of the background of the slider when it has been slide to the end. By giving a value here, the background color will gradually change from backgroundColor to backgroundColorEnd when the user slides. Is not used by default.
  • foregroundColor Color: The color of the moving element of the slider. Defaults to Colors.blueAccent.
  • iconColor Color: The color of the icon on the moving element if icon is IconData. Defaults to Colors.white.
  • sliderButtonContent Widget or : The icon widget used on the moving element of the slider. Defaults to Icon(Icons.chevron_right).
  • shadow BoxShadow: The shadow below the slider. Defaults to BoxShadow(color: Colors.black38, offset: Offset(0, 2),blurRadius: 2,spreadRadius: 0,).
  • text String: The text showed below the foreground. Used to specify the functionality to the user. Defaults to "Slide to confirm".
  • textStyle TextStyle: The style of the text. Defaults to TextStyle(color: Colors.black26, fontWeight: FontWeight.bold,).
  • onConfirmation VoidCallback: The callback when slider is completed. This is the only required field.
  • onTapDown VoidCallback: The callback when slider is pressed.
  • onTapUp VoidCallback: The callback when slider is release.
  • foregroundShape BorderRadius: The shape of the foreground (the moving element of the slider). Defaults to a circular border radius.
  • backgroundShape BorderRadius: The shape of the background of the slider. Defaults to a circular border radius.
  • stickToEnd bool: Bool that indicates if stick or not the cursor at end of slide

Example

View the Flutter app in the example directory to see a working example of how to use and implement the slider.

Screenshots

Slider Gif

Slider Gif

Slider Gif

Slider Gif

Slider Gif

所屬分類

原始碼儲存庫

使用此套件的專案

暫無相關資料。