v0.0.1
swipe
在 Flutter 中檢測向上、向下、向左和向右滑動手勢的簡單方法。
46喜歡 812近 30 天下載140Pub 分數
AndroidiOSWebmacOSWindowsLinux
在 Flutter 中檢測向上、向下、向左和向右滑動手勢的簡單方法。
{"sdk":"flutter"}{"sdk":"flutter"}以下為英文專案原文快照,最新內容請造訪 GitHub。
The easy way to detect swipe up, down, left and right in Flutter.
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.
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
},
)
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,
)
You can try a working example here.