createFloating static method

Floating createFloating({
  1. required String key,
  2. required Widget child,
  3. double? top,
  4. double? right,
  5. double? left,
  6. double? bottom,
  7. FloatingSlideType? slideType,
  8. FloatingAnimationType? animationType,
})

创建一个浮窗

Implementation

static Floating createFloating({
  required String key,
  required Widget child,
  double? top,
  double? right,
  double? left,
  double? bottom,
  FloatingSlideType? slideType,
  FloatingAnimationType? animationType,
}) {
  final containsKeys = _floatingKeys.contains(key);
  if (containsKeys) {
    return _floatingCache[key]!;
  } else {
    _floatingKeys.add(key);

    final floating = Floating(
      FloatingComponent(child: child),
      isSnapToEdge: false,
      slideType: slideType ?? FloatingSlideType.onRightAndBottom,
      openAnimationType: animationType ?? FloatingAnimationType.scale,
      isShowLog: false,
      top: top,
      right: right,
      left: left,
      bottom: bottom,
    );
    _floatingCache[key] = floating;
    return floating;
  }
}