- A+
所属分类:未分类
实现这三个方法 onHorizontalDragStart: _onHorizontalDragStart , onHorizontalDragUpdate: _onHorizontalDragUpdate, onHorizontalDragEnd: _onHorizontalDragEnd,
Offset _initialSwipeOffset; Offset _finalSwipeOffset; void _onHorizontalDragStart(DragStartDetails details) { _initialSwipeOffset = details.globalPosition; } void _onHorizontalDragUpdate(DragUpdateDetails details) { _finalSwipeOffset = details.globalPosition; } void _onHorizontalDragEnd(DragEndDetails details) { if (_initialSwipeOffset != null) { final offsetDifference = _initialSwipeOffset.dx - _finalSwipeOffset.dx; final direction = offsetDifference > 0 ? print('left') : print('right'); } }
- 安卓客户端下载
- 微信扫一扫
- 微信公众号
- 微信公众号扫一扫