showPopWindow static method

void showPopWindow(
  1. dynamic context,
  2. String? text,
  3. GlobalKey<State<StatefulWidget>> popKey, {
  4. PopupDirection popDirection = PopupDirection.bottom,
  5. double arrowHeight = 6.0,
  6. TextStyle? textStyle = const TextStyle(fontSize: 16, color: Color(0xFFFFFFFF)),
  7. Color? backgroundColor = const Color(0xFF1A1A1A),
  8. bool hasCloseIcon = false,
  9. double offset = 0,
  10. Widget? widget,
  11. EdgeInsets paddingInsets = const EdgeInsets.only(left: 18, top: 14, right: 18, bottom: 14),
  12. double borderRadius = 8,
  13. Color? borderColor = Colors.transparent,
  14. double borderWidth = 1,
  15. bool canWrap = false,
  16. double spaceMargin = 20,
  17. double? arrowOffset,
  18. VoidCallback? dismissCallback,
  19. double turnOverFromBottom = 50.0,
})

显示 popUpWindow text 显示的文本内容 popKey 依附的组件和 BrnPopUpWindow 组件共同持有的 GlobalKey popDirection 箭头的方向 arrowHeight 箭头的高度,默认 6 textStyle 文本样式 backgroundColor popUpWindow 的背景颜色,默认 Color(0xFF1A1A1A) hasCloseIcon 是否显示关闭图标,默认为 false,不显示 offset 距离 targetView 垂直方向的偏移量 widget 自定义 pop 视图 paddingInsets 容器内边距,默认为 EdgeInsets.only(left: 18, top: 14, right: 18, bottom: 14) borderRadius 容器圆角,默认为 4 borderColor 边框颜色,默认为 Colors.transparent borderWidth 边框宽度,默认为 1 canWrap 是否能多行显,默认 false,单行显示 spaceMargin 距离 targetView 边线的距离,默认 20 arrowOffset 箭头图标水平方向的绝对偏移量,为 null 时则自动计算 dismissCallback popUpWindow 消失回调,此回调会在 pop 之后执行 turnOverFromBottom popWindow 小于此值的时候,自动将 popWindow 在 targetView 上面弹出,默认 50

Implementation

static void showPopWindow(context, String? text, GlobalKey popKey,
    {PopupDirection popDirection = PopupDirection.bottom,
    double arrowHeight = 6.0,
    TextStyle? textStyle =
        const TextStyle(fontSize: 16, color: Color(0xFFFFFFFF)),
    Color? backgroundColor = const Color(0xFF1A1A1A),
    bool hasCloseIcon = false,
    double offset = 0,
    Widget? widget,
    EdgeInsets paddingInsets =
        const EdgeInsets.only(left: 18, top: 14, right: 18, bottom: 14),
    double borderRadius = 8,
    Color? borderColor = Colors.transparent,
    double borderWidth = 1,
    bool canWrap = false,
    double spaceMargin = 20,
    double? arrowOffset,
    VoidCallback? dismissCallback,
    double turnOverFromBottom = 50.0}) {
  assert(popKey.currentContext != null &&
      popKey.currentContext!.findRenderObject() != null);
  if (popKey.currentContext == null ||
      popKey.currentContext!.findRenderObject() == null) return;
  Navigator.push(
      context,
      PhoenixPopupRoute(
          child: PopupWindow(
        context,
        arrowHeight: arrowHeight,
        text: text,
        popKey: popKey,
        textStyle: textStyle,
        backgroundColor: backgroundColor,
        isShowCloseIcon: hasCloseIcon,
        offset: offset,
        popDirection: popDirection,
        widget: widget,
        paddingInsets: paddingInsets,
        borderRadius: borderRadius,
        borderColor: borderColor ?? Colors.transparent,
        canWrap: canWrap,
        spaceMargin: spaceMargin,
        arrowOffset: arrowOffset,
        turnOverFromBottom: turnOverFromBottom,
      )));
}