void _onVerticalDragUpdate()

in lib/ui/aliplayer_play_control_widget.dart [284:321]


  void _onVerticalDragUpdate(DragUpdateDetails details) {
    if (_startPosition == null || _isLeftSide == null) return;

    // 判断是左侧还是右侧
    final Size containerSize = _getParentContainerSize(context);

    // 计算垂直移动的距离,并取反以调整方向
    double deltaY = -(details.globalPosition.dy - _startPosition!.dy);

    // 如果滑动距离未达到灵敏度阈值,则不触发回调
    if (deltaY.abs() < _dragSensitivityThreshold) return;

    // 将 deltaY 转换为相对于容器高度的百分比(范围:-1 到 1)
    double deltaPercent = deltaY / containerSize.height;
    double roundedDeltaPercent = double.parse(deltaPercent.toStringAsFixed(2));

    // 如果百分比变化未达到灵敏度阈值,则不触发回调
    if (_isLeftSide!) {
      // 左侧垂直拖动
      if (_lastLeftVerticalValue == null ||
          (roundedDeltaPercent - _lastLeftVerticalValue!).abs() >=
              _percentChangeThreshold) {
        widget.onLeftVerticalDragUpdate?.call(roundedDeltaPercent);
        _lastLeftVerticalValue = roundedDeltaPercent;
      }
    } else {
      // 右侧垂直拖动
      if (_lastRightVerticalValue == null ||
          (roundedDeltaPercent - _lastRightVerticalValue!).abs() >=
              _percentChangeThreshold) {
        widget.onRightVerticalDragUpdate?.call(roundedDeltaPercent);
        _lastRightVerticalValue = roundedDeltaPercent;
      }
    }

    // 更新起点
    _startPosition = details.globalPosition;
  }