Flutter底部弹出框showModalBottomSheet实现顶部圆角

无图无真相~

Flutter底部弹出框showModalBottomSheet实现顶部圆角_第1张图片

由于showModalBottomSheet默认的背景颜色为白色,这时需要将showModalBottomSheet的背景颜色设置为透明,然后将内部控件设置为圆角即可。

具体代码:

void _clickSpec(){
    _specModel.initData(model.normInfoBean.norms);
    showModalBottomSheet(
      context: context,
      isScrollControlled: true,
      backgroundColor: Colors.transparent,//重点
      builder: (BuildContext context) {
        return GoodsSpecSelectDialog(
          model: _specModel,
          onSelected: (bean, count) {
            norms = bean;
            setState(() {
              _selectName = "已选:"+bean.normName + ",数量:" + count.toString();
            });
          },
        );
      },
    );
  }

内部控件设置为圆角:

Container(
    decoration: BoxDecoration(
        borderRadius: BorderRadius.only(topLeft: Radius.circular(10),topRight:          
             Radius.circular(10)),
          color: Colors.white
    )
)

 

你可能感兴趣的:(Flutter)