updatePosition method
dynamic
updatePosition({})
更新悬浮窗位置
slideType,悬浮窗坐标的起始点位置,可参考FloatingSlideType
top,left,right,bottom,point 对应 slideType,设置与起始点的距离
例如设置slideType为FloatingSlideType.onRightAndBottom,则需要传入bottom和right
设置 slideType为 FloatingSlideType.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();
}