Flutter 弹窗

1、showDialog
showDialog:半透明背景弹窗

showDialog(
                                context: context,
                                barrierDismissible: false,
                                builder: (BuildContext context) {
                                  return xxxxx;
                                });

打电话弹窗:
AlertDialog:alert内容
BaseDialog:自定义的

void _showCallPhoneDialog(String phone){
    showDialog(
        context: context,
        barrierDismissible: false,
        builder: (BuildContext context) {
          return AlertDialog(
            title: Text('提示'),
            content: Text('是否拨打:$phone ?'),
            actions: [
              FlatButton(
                onPressed: () => NavigatorUtils.goBack(context),
                child: Text('取消'),
              ),
              FlatButton(
                onPressed: (){
                  Utils.launchTelURL(phone);
                  NavigatorUtils.goBack(context);
                },
                textColor: Colours.text_red,
                child: Text('拨打'),
              ),
            ],
          );
        });
  }
打电话

2、showPopupWindow

showPopupWindow(
      context: context,
      fullWidth: false,
      isShowBg: true,
      position: position,
      elevation: 0.0,
      child:xxxx
);

Simulator Screen Shot - iPhone Xʀ - 2019-06-24 at 21.19.17.png

3、底部弹出弹窗

showModalBottomSheet(
      context: context,
      builder: (BuildContext context) {
        return xxxx;
      },
    );
Simulator Screen Shot - iPhone Xʀ - 2019-06-24 at 21.21.21.png

你可能感兴趣的:(Flutter 弹窗)