Flutter 弹窗
2019-06-26 本文已影响0人
独孤流
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: <Widget>[
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
);

3、底部弹出弹窗
showModalBottomSheet(
context: context,
builder: (BuildContext context) {
return xxxx;
},
);
