showPopMenu static method

dynamic showPopMenu(
  1. BuildContext context, {
  2. required GlobalKey<State<StatefulWidget>> originKey,
  3. required List<PopModel> itemsData,
  4. dynamic clickCallback(
    1. int,
    2. PopModel
    )?,
  5. bool? noTriangle,
  6. Color? backgroundColor,
  7. String? selectedText,
  8. Color? itemTitleColor,
  9. Color? itemIconColor,
  10. Color? itemSelectedColor,
  11. double? itemHeight,
  12. double? itemWidth,
  13. Color? dividerColor,
  14. double? triangleHeight,
  15. double? triangleWidth,
  16. double? maxHeight,
})

Implementation

static showPopMenu(
  BuildContext context, {

  ///弹窗view位置上方所在widget的标识
  required GlobalKey originKey,

  ///item数据源
  required List<PopModel> itemsData,

  ///item点击选中时回调
  Function(int, PopModel)? clickCallback,

  ///不展示小三角 默认展示
  bool? noTriangle,

  ///弹窗背景色
  Color? backgroundColor,

  ///默认选中的item标题
  String? selectedText,

  ///item字体颜色
  Color? itemTitleColor,

  ///item图标颜色
  Color? itemIconColor,

  ///item选中时字体颜色
  Color? itemSelectedColor,

  ///item高度 默认50
  double? itemHeight,

  ///item宽度 默认120
  double? itemWidth,

  ///item间隔线颜色
  Color? dividerColor,

  ///小三角高度默认10
  double? triangleHeight,

  ///小三角宽度 默认14
  double? triangleWidth,

  ///列表弹窗最大高度,若设置最大高度则可滑动 否则高度自适应
  final double? maxHeight,
}) {
  showDialog(
    context: context,
    useSafeArea: false,
    barrierDismissible: false,
    builder: (context) {
      return PopupView(
        originKey: originKey,
        itemsData: itemsData,
        clickCallback: clickCallback,
        noTriangle: noTriangle,
        selText: selectedText,
        bgColor: backgroundColor,
        itemHeight: itemHeight,
        itemWidth: itemWidth,
        itemIconColor: itemIconColor,
        itemSelectedColor: itemSelectedColor,
        itemTitleColor: itemTitleColor,
        triangleWidth: triangleWidth,
        triangleHeight: triangleHeight,
        dividerColor: dividerColor,
        maxHeight: maxHeight,
      );
    },
  );
}