搜索插件、代码仓与 APP 分类

slide_action 封面
插件详情v0.0.2

slide_action

一个高度可定制的滑动执行操作控件。该包提供了一个易于使用的控件,支持多个平台。

AndroidiOSWebmacOSWindowsLinux
近 30 天下载
3610
喜欢数
93
Pub 分数
160

安装插件

flutter pub add slide_action

插件介绍

基于插件公开信息、社区数据与项目使用情况整理的选型参考。

SlideAction 是一个可自定义的滑动控件,允许用户通过滑动来触发操作。专为跨平台使用而设计,支持 Android、iOS、Web、macOS、Windows 和 Linux。该控件提供流畅的动画和直观的交互体验,非常适合用于确认删除项目或批准请求等操作。它高度可配置,支持颜色、形状、标签和手势灵敏度等多种选项。基于 Flutter 构建,可无缝集成到现有应用中,无需额外依赖。

适合场景

  • 确认删除
  • 批准操作
  • 用户引导流程
  • 表单提交
  • 交互式教程
  • 基于切换的界面

主要特点

  • 跨平台兼容性
  • 可自定义外观
  • 流畅的滑动动画
  • 可配置的操作触发器
  • 支持多个平台
  • 与 Flutter 的轻松集成

适合对象

  • 开发交互式 UI 的开发者
  • 需要基于手势确认的应用程序
  • 寻求可重用组件的设计师
  • 面向多个平台的项目
  • 快速原型用户交互

使用建议

  • 可能需要调整以适应触摸灵敏度
  • 仅限滑动手势交互
  • 不适合复杂的手势
  • 性能取决于动画的复杂程度
  • 需要仔细设计以确保可访问性

原始 README

以下为关联源码仓库的 README 原文快照,最新内容请访问源码仓库。

pub.dev likes popularity pub points pub.dev

➡️ Slide Action

Slide action is a simple to use widget where the user has to slide to perform an action.


Example Preview 📱

Slide action preview


Features

  • Highly customizable.
  • Smooth thumb movement.
  • RTL support.
  • Async operations support.
  • Multi-platform support.
  • Multiple examples (included in example project)

Installing

Add this line to your pubspec.yaml under the dependencies:

dependencies:
  slide_action: ^0.0.1+3

alternatively, you can use this command:

flutter pub add slide_action

Usage

Simple Example

SlideAction(
    trackBuilder: (context, state) {
        return Container(
            decoration: BoxDecoration(
                borderRadius: BorderRadius.circular(16),
                color: Colors.white,
                boxShadow: const [
                    BoxShadow(
                        color: Colors.black26,
                        blurRadius: 8,
                    ),
                ],
            ),
            child: Center(
                child: Text(
                    "Thumb fraction: ${state.thumbFractionalPosition.toStringAsPrecision(2)}",
                ),
            ),
        );
    },
    thumbBuilder: (context, state) {
        return Container(
            margin: const EdgeInsets.all(4),
            decoration: BoxDecoration(
                color: Colors.orange,
                borderRadius: BorderRadius.circular(16),
            ),
            child: const Center(
                child: Icon(
                    Icons.chevron_right,
                    color: Colors.white,
                ),
            ),
        );
    },
    action: () {
        debugPrint("Hello World");
    },
);

SlideAction Simple Example 1


Async Example
SlideAction(
    trackBuilder: (context, state) {
        return Container(
            decoration: BoxDecoration(
                borderRadius: BorderRadius.circular(16),
                color: Colors.white,
                boxShadow: const [
                    BoxShadow(
                        color: Colors.black26,
                        blurRadius: 8,
                    ),
                ],
            ),
            child: Center(
                child: Text(
                    // Show loading if async operation is being performed
                    state.isPerformingAction
                        ? "Loading..."
                        : "Thumb fraction: ${state.thumbFractionalPosition.toStringAsPrecision(2)}",
                ),
            ),
        );
    },
    thumbBuilder: (context, state) {
        return Container(
            margin: const EdgeInsets.all(4),
            decoration: BoxDecoration(
                color: Colors.orange,
                borderRadius: BorderRadius.circular(16),
            ),
            child: Center(
                // Show loading indicator if async operation is being performed
                child: state.isPerformingAction
                    ? const CupertinoActivityIndicator(
                        color: Colors.white,
                    )
                    : const Icon(
                        Icons.chevron_right,
                        color: Colors.white,
                    ),
            ),
        );
    },
    action: () async {
        // Async operation
        await Future.delayed(
            const Duration(seconds: 2),
            () => debugPrint("Hello World"),
        );
    },
);

SlideAction Simple Example 2


Notes

  • As of version 0.0.2, disabledColorTint property does not work on web as the color blend modes support is currently buggy for web. The opacity of the widget is reduced instead in case of web when disabled.

Additional information

Check the documentation or example project on github for advanced usage.

Facing issues? Feel free to report an issue on the Github Page

所属分类

源码仓库

使用此插件的项目

暂无相关数据。