Floating constructor
Floating(
- Widget child, {
- FloatingSlideType slideType = FloatingSlideType.onRightAndBottom,
- double? top,
- double? left,
- double? right,
- double? bottom,
- Point<
double> ? point, - double moveOpacity = 0.3,
- bool isPosCache = true,
- bool isShowLog = true,
- bool isSnapToEdge = true,
- bool isStartScroll = true,
- double slideTopHeight = 0,
- double slideBottomHeight = 0,
- double snapToEdgeSpace = 0,
- SlideStopType slideStopType = SlideStopType.slideStopAutoType,
child
需要悬浮的 widget
slideType
,可参考FloatingSlideType
top
,left
,left
,bottom
,point
对应 slideType
,
例如设置slideType
为FloatingSlideType.onRightAndBottom,则需要传入bottom
和right
设置 slideType
为 FloatingSlideType.onPoint 则需要传入 point
isPosCache
启用之后当调用之后 Floating.close 重新调用 Floating.open 后会保持之前的位置
isSnapToEdge
是否自动吸附边缘,默认为 true ,请注意,移动默认是有透明动画的,如需要关闭透明度动画,
请修改 moveOpacity
为 1
isStartScroll
是否启动悬浮窗滑动,默认为 true,false 表示无法滑动悬浮窗
slideTopHeight
滑动边界控制,可滑动到顶部的距离
slideBottomHeight
滑动边界控制,可滑动到底部的距离
snapToEdgeSpace
边缘吸附的距离
slideStopType
移动后回弹停靠的位置
Implementation
Floating(
Widget child, {
FloatingSlideType slideType = FloatingSlideType.onRightAndBottom,
double? top,
double? left,
double? right,
double? bottom,
Point<double>? point,
double moveOpacity = 0.3,
bool isPosCache = true,
bool isShowLog = true,
bool isSnapToEdge = true,
bool isStartScroll = true,
double slideTopHeight = 0,
double slideBottomHeight = 0,
double snapToEdgeSpace = 0,
SlideStopType slideStopType = SlideStopType.slideStopAutoType,
}) {
_floatingData = FloatingData(slideType,
left: left,
right: right,
top: top,
bottom: bottom,
point: point,
snapToEdgeSpace: snapToEdgeSpace);
_log = FloatingLog(isShowLog);
_commonControl = CommonControl();
_commonControl.setInitIsScroll(isStartScroll);
_scrollPositionControl = ScrollPositionControl();
_scrollPositionManager = ScrollPositionManager(_scrollPositionControl);
_floatingView = FloatingView(
child,
_floatingData,
isPosCache,
isSnapToEdge,
_listener,
_scrollPositionControl,
_commonControl,
_log,
moveOpacity: moveOpacity,
slideTopHeight: slideTopHeight,
slideBottomHeight: slideBottomHeight,
slideStopType: slideStopType,
);
}