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

slidable_button 封面
套件詳情v3.0.0+1

slidable_button

一個簡單可自訂的 Flutter 滑動按鈕小部件。

AndroidiOSWebmacOSWindowsLinux
近 30 天下載
46
喜歡數
65
Pub 分數
160

安裝套件

flutter pub add slidable_button

套件介紹

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

一個簡單且可自訂的滑動按鈕小部件,適用於 Flutter,允許使用者拖曳拇指在軌道上滑動以觸發動作。它支援自訂樣式、動畫以及滑塊移動或釋放時的回呼事件。非常適合用於切換、確認或跨多個平台應用中的互動式控制。此套件輕量且易於整合,設定最少。

適用情境

  • 表單確認滑塊
  • 切換開關
  • 互動式入門元素
  • 可自訂的操作觸發器
  • 用戶同意提示

主要特色

  • 完全可自定義的外觀
  • 拖曳手勢支援
  • 拖曳與釋放時的回呼
  • 流暢的動畫
  • 跨平台相容性
  • 簡單的 API 結合

適合對象

  • 尋求輕量級滑塊的開發者
  • 需要互動元件的UI設計師
  • 需要使用者確認動作的應用程式
  • 跨平台 Flutter 專案
  • 自定義表單元件

使用建議

  • 有限的內建主題
  • 無內建的可存取性功能
  • 需要手動處理邊緣情況
  • 不適合複雜的滑塊互動
  • 基本用法之外的最小文件

原始 README

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

slidable_button

Pub support

A simple flutter plugin for Slidable Button.

 

Note : This plugin is cloned and remade from swipe_button.

Getting Started

Add dependency
dependencies:
  slidable_button: ^3.0.0+1
Simple to use

Import this library on your code.

import 'package:slidable_button/slidable_button.dart';

Now you can make your slidable button vertically or horizontally by using one of them widget. For horizontal usage example :

    HorizontalSlidableButton(
      width: MediaQuery.of(context).size.width / 3,
      buttonWidth: 60.0,
      color: Theme.of(context).accentColor.withOpacity(0.5),
      buttonColor: Theme.of(context).primaryColor,
      dismissible: false,
      label: Center(child: Text('Slide Me')),
      child: Padding(
        padding: const EdgeInsets.all(8.0),
        child: Row(
          mainAxisAlignment: MainAxisAlignment.spaceBetween,
          children: [
            Text('Left'),
            Text('Right'),
          ],
        ),
      ),
      onChanged: (position) {
        setState(() {
          if (position == SlidableButtonPosition.end) {
            result = 'Button is on the right';
          } else {
            result = 'Button is on the left';
          }
        });
      },
    ),

Vertical usage example :

    VerticalSlidableButton(
      height: MediaQuery.of(context).size.height / 3,
      buttonHeight: 60.0,
      color: Theme.of(context).accentColor.withOpacity(0.5),
      buttonColor: Theme.of(context).primaryColor,
      dismissible: false,
      label: Center(child: Text('Slide Me')),
      child: Padding(
        padding: const EdgeInsets.all(8.0),
        child: Column(
          mainAxisAlignment: MainAxisAlignment.spaceBetween,
          children: [
            Text('Top'),
            Text('Bottom'),
          ],
        ),
      ),
      onChanged: (position) {
        setState(() {
          if (position == SlidableButtonPosition.end) {
            result = 'Button is on the bottom';
          } else {
            result = 'Button is on the top';
          }
        });
      },
    ),
Migration Guide

If you already use this package before v3.x.x you may need to migrate your code to HorizontalSlidableButton or VerticalSlidableButton for specific direction usage because SlidableButton class has been removed start from v3.0.0.

所屬分類

原始碼儲存庫

使用此套件的專案

暫無相關資料。