show static method

void show(
  1. BuildContext context, {
  2. _ClickCallBack? clickCallback,
  3. Widget? popuContentWeight,
  4. double? topdp,
  5. double? leftdp,
  6. double? bottomdp,
  7. double? rightDP,
})

显示pop top 这距离不包含导航栏和状态栏

Implementation

static void show(BuildContext context,
    {_ClickCallBack? clickCallback,
    Widget? popuContentWeight,
    double? topdp,
    double? leftdp,
    double? bottomdp ,
    double? rightDP }) {
  // Cell
  Widget _buildMenuCell(dataArr) {
    return ListView.builder(
        itemCount: dataArr.length,
        itemExtent: _cellHeight,
        padding: const EdgeInsets.all(0.0),
        physics: const NeverScrollableScrollPhysics(),
        itemBuilder: (BuildContext context, int index) {
          return Material(
              color: ColorsUtil.hex2Color("#ffffff", alpha: 0.8),
              // color:_bgColor,
              child: InkWell(
                  onTap: () {
                    Navigator.pop(context);
                    if (clickCallback != null) {
                      clickCallback(index, _listData[index]['text']);
                    }
                  },
                  child: Row(
                    children: <Widget>[
                      const SizedBox(width: 25),
                      Image.asset(dataArr[index]['icon'],
                          width: _imgWH, height: _imgWH, color: Colors.white),
                      const SizedBox(width: 15),
                      Text(dataArr[index]['text'],
                          style: const TextStyle(
                              color: Colors.black, fontSize: _fontSize)),
                    ],
                  )));
        });
  }

  Widget _menusView(dataArr) {
    var cellH = dataArr.length * _cellHeight;
    var navH = VScreenUtils.navigationBarHeight;
    return Positioned(
      right: rightDP,
      bottom: bottomdp,
      left: leftdp,
      top: (topdp != null ? navH + topdp! : topdp),
      child: Column(
        crossAxisAlignment: CrossAxisAlignment.end,
        children: <Widget>[
          // Image.asset(AssetsRes.TAB_H_T, width: 28, height: 5),
          ClipRRect(
              borderRadius: BorderRadius.circular(5),

              child: Container(
                  // color: _bgColor,
                  // width: 160,
                  // height: cellH,
                  child: popuContentWeight ?? _buildMenuCell(dataArr)))
        ],
      ),
    );
  }

  Navigator.of(context)
      .push(DialogRouter(_BasePopMenus(child: _menusView(_listData))));
}