handleDragEnd method

dynamic handleDragEnd(
  1. DragEndDetails event
)

Implementation

handleDragEnd(DragEndDetails event) {
  isDrag = false;
  _flingController = AnimationController.unbounded(vsync: this)
    ..addListener(() {
      if (_flingController == null) return;
      var flingOffset = _flingController!.value;
      lyricPaint.lyricOffset = flingOffset.clamp(lyricPaint.maxOffset, 0);
      if (!lyricPaint.checkOffset(flingOffset)) {
        disposeFiling();
        resumeSelectLineOffset();
        return;
      }
    })
    ..addStatusListener((status) {
      if (status == AnimationStatus.completed ||
          status == AnimationStatus.dismissed) {
        disposeFiling();
        resumeSelectLineOffset();
      }
    })
    ..animateWith(ClampingScrollSimulation(
      position: lyricPaint.lyricOffset,
      velocity: event.primaryVelocity ?? 0,
    ));
}