drag_like

Creator: coderz1093

Last updated:

0 purchases

drag_like Image
drag_like Images

Languages

Categories

Add to Cart

Description:

drag like

drag_like #

Flutter左滑右滑/喜欢、不喜欢的特效插件
支持划出事件回调,通知上层是左边划出还是右边划出
支持滑动进度回调
支持第二层widget缩放完成回调,缩放完成时刷新数据
支持手指抬起回调
支持手速检测,速度超过指定值后,卡片将会划出屏幕,已解决手速不准确问题(感谢@DoodleBears贡献代码)
null safety
支持控制控制左右划出
支持设置滑出动画执行时长
支持控制器左右划出时,自定义回调参数

安装 #
在工程 pubspec.yaml 中加入 dependencies
dependencies:
drag_like: ^last version
copied to clipboard
效果图 #

使用方法 #
DragLike(
dragController: _dragController,
duration: Duration(milliseconds: 520),
child: imagelist.length <=0 ? Text('加载中...') : ClipRRect(
borderRadius: BorderRadius.circular(10),
child: TestDrag(src:imagelist[0])
),
secondChild: imagelist.length <= 1 ? Container(): ClipRRect(
borderRadius: BorderRadius.circular(10),
child:TestDrag(src:imagelist[1])
),
allowDrag: true,
screenWidth: 375,
outValue: 0.6,
dragSpeedRatio: 80,
onChangeDragDistance: (distance){
/// {distance: 0.17511112467447917, distanceProgress: 0.2918518744574653}
print(distance.toString());
},
onOutComplete: (type){
/// left or right
print(type);
},
onScaleComplete: (){
imagelist.remove(imagelist[0]);
if(imagelist.length == 0) {
loaddata();
}
setState(() {});
},
onPointerUp: (){

},
onCancel: (){
print('取消了');
},
),
copied to clipboard
回调方法 #
onOutComplete #
onOutComplete: (type){
/// left or right
print(type);
},
copied to clipboard
onScaleComplete #
onScaleComplete: (){
imagelist.remove(imagelist[0]);
if(imagelist.length == 0) {
loaddata();
}
setState(() {});
},
copied to clipboard
onChangeDragDistance #

distance滑动距离,0-1,超过设置的值将会划出widget
distanceProgress,根据设置的划出边界值的百分比,0-1+,方便做一些特效,超过1即代表松手就会划出边界


onChangeDragDistance: (distance){
/// {distance: 0.17511112467447917, distanceProgress: 0.2918518744574653}
print(distance.toString());
},
copied to clipboard
onPointerUp #
onPointerUp: (){

},
copied to clipboard
onCancel #
onCancel: (){

},
copied to clipboard
控制器 #

_dragController.toLeft(completeTag: 'custom_left');

_dragController.toRight(completeTag: 'custom_right');

copied to clipboard
This project is a starting point for a Dart
package,
a library module containing code that can be shared easily across
multiple Flutter or Dart projects.
For help getting started with Flutter, view our
online documentation, which offers tutorials,
samples, guidance on mobile development, and a full API reference.

License

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.