搜索插件、代码仓与 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

所属分类

源码仓库

使用此插件的项目

暂无相关数据。