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

插件详情v0.0.1

swipe

在 Flutter 中检测向上、向下、向左和向右滑动手势的简单方法。

AndroidiOSWebmacOSWindowsLinux
近 30 天下载
1960
喜欢数
46
Pub 分数
140

安装插件

flutter pub add swipe

插件介绍

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

swipe 包为 Flutter 应用程序提供了一种简单直观的方式来检测方向性滑动手势——上、下、左、右。它抽象了手势识别的复杂性,使开发者能够以最少的代码轻松地为小部件添加滑动交互。非常适合创建交互式 UI,例如滑块、导航面板或游戏控制,支持包括 Android、iOS、Web、macOS、Windows 和 Linux 在内的多个平台。该包轻量且可无缝集成到现有的 Flutter 项目中。

适合场景

  • 实现滑动导航界面
  • 创建基于手势的游戏控制
  • 构建交互式滑块或幻灯片
  • 通过滑动手势添加快速操作
  • 设计响应式触摸布局

主要特点

  • 用于检测滑动手势方向的简单 API
  • 支持所有主要平台
  • 最小化样板代码
  • 内置手势识别
  • 与现有控件的轻松集成

适合对象

  • 开发触控密集型应用的开发者
  • 寻求手势交互的UI设计师
  • 跨平台移动和Web应用
  • 需要直观滑动导航的项目

使用建议

  • 可能需要调整以适应敏感的手势检测
  • 不适用于复杂的多点触控手势
  • 仅限基本滑动方向
  • 对高频手势处理的性能影响
  • 依赖于 Flutter 手势系统的稳定性

原始 README

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

Swipe

The easy way to detect swipe up, down, left and right in Flutter.

Getting Started

Add dependency to your flutter project:

$ flutter pub add swipe

or

dependencies:
  swipe: ^0.0.1

or

dependencies:
  swipe:
    git: 
      url: git://github.com/salkuadrat/swipe.git

Then run flutter pub get.

Usage

Here is a simple way of using Swipe.

Swipe(
  child: ..., // your child widget
  onSwipeUp: () {
    // do something when swiping up
  },
  onSwipeDown: () {
    // do something when swiping down
  },
  onSwipeLeft: () {
    // do something when swiping left
  },
  onSwipeRight: () {
    // do something when swiping right
  },
)

Customization

Swipe widget comes with additional parameters to customize your swiping experience.

Swipe(
  child: ...,
  onSwipeUp: ...,
  onSwipeDown: ...,
  onSwipeLeft: ...,
  onSwipeRight: ...,
  verticalMaxWidthThreshold: 50,
  verticalMinDisplacement: 100,
  verticalMinVelocity: 300,
  horizontalMaxHeightThreshold: 50,
  horizontalMinDisplacement: 100,
  horizontalMinVelocity: 300,
)

Example

You can try a working example here.

所属分类

源码仓库

使用此插件的项目