Floating constructor

Floating(
  1. Widget child, {
  2. FloatingSlideType slideType = FloatingSlideType.onRightAndBottom,
  3. double? top,
  4. double? left,
  5. double? right,
  6. double? bottom,
  7. double moveOpacity = 0.3,
  8. bool isPosCache = true,
  9. bool isShowLog = true,
  10. bool isSnapToEdge = true,
  11. bool isStartScroll = true,
  12. double slideTopHeight = 0,
  13. double slideBottomHeight = 0,
  14. double snapToEdgeSpace = 0,
  15. SlideStopType slideStopType = SlideStopType.slideStopAutoType,
})

child需要悬浮的 widget slideType,可参考FloatingSlideType

top,left,left,bottom 对应 slideType, 例如设置slideTypeFloatingSlideType.onRightAndBottom,则需要传入bottomright

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,
  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,
      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,
  );
}