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

所属分类

源码仓库

使用此插件的项目

暂无相关数据。