updatePosition method

dynamic updatePosition({
  1. FloatingSlideType? slideType,
  2. double? top,
  3. double? left,
  4. double? right,
  5. double? bottom,
  6. Point<double>? point,
})

更新悬浮窗位置 slideType,悬浮窗坐标的起始点位置,可参考FloatingSlideType top,left,right,bottom,point 对应 slideType,设置与起始点的距离 例如设置slideTypeFloatingSlideType.onRightAndBottom,则需要传入bottomright 设置 slideTypeFloatingSlideType.onPoint 则需要传入 point

Implementation

updatePosition({
  FloatingSlideType? slideType,
  double? top,
  double? left,
  double? right,
  double? bottom,
  Point<double>? point,
}) {
  if (slideType != null) {
    _floatingData.slideType = slideType;
  }

  // 根据 slideType 设置对应的位置参数
  switch (_floatingData.slideType) {
    case FloatingSlideType.onLeftAndTop:
      if (top != null) _floatingData.top = top;
      if (left != null) _floatingData.left = left;
      break;
    case FloatingSlideType.onLeftAndBottom:
      if (bottom != null) _floatingData.bottom = bottom;
      if (left != null) _floatingData.left = left;
      break;
    case FloatingSlideType.onRightAndTop:
      if (top != null) _floatingData.top = top;
      if (right != null) _floatingData.right = right;
      break;
    case FloatingSlideType.onRightAndBottom:
      if (bottom != null) _floatingData.bottom = bottom;
      if (right != null) _floatingData.right = right;
      break;
    case FloatingSlideType.onPoint:
      if (point != null) _floatingData.point = point;
      break;
  }

  _commonControl.updatePosition();
}