26 lines
470 B
Dart
26 lines
470 B
Dart
enum LoadState { loading, success, failure }
|
|
|
|
enum Direction { up, down, left, right }
|
|
|
|
class VerticalDragInfo {
|
|
bool cancel = false;
|
|
|
|
Direction? direction;
|
|
|
|
void update(double primaryDelta) {
|
|
Direction tmpDirection;
|
|
|
|
if (primaryDelta > 0) {
|
|
tmpDirection = Direction.down;
|
|
} else {
|
|
tmpDirection = Direction.up;
|
|
}
|
|
|
|
if (direction != null && tmpDirection != direction) {
|
|
cancel = true;
|
|
}
|
|
|
|
direction = tmpDirection;
|
|
}
|
|
}
|