updatePosition method

void updatePosition(
  1. dynamic details
)

Implementation

void updatePosition(details) {
  if (stop) return;
  if (details is DragEndDetails) {
    if (widget.onUpdate != null) {
      stop = widget.onUpdate!(getPosition(), true) ?? false;
    }
    if (!stop) {
      setState(() {
        _duration = 600;
        _position = 0;
      });
    }
  } else if (details is DragUpdateDetails) {
    setState(() {
      _duration = 0;
      _position = details.localPosition.dx - (widget.height / 2);
    });
    if (widget.onUpdate != null) {
      stop = widget.onUpdate?.call(getPosition(), false);
    }
  } else {
    if (widget.onUpdate != null) {
      stop = widget.onUpdate?.call(getPosition(), false);
    }
  }
}