Flutter 跳出視窗 showDialog
效果預覽
觸發的按鈕
RaisedButton(
color: mainColor[300],
textColor: Colors.white,
child: Text('提領',
style: TextStyle(color: Colors.white, fontSize: 17)),
onPressed: () {
_showAlertDialog(context);
},
),
跳窗的內容
Future<void> _showAlertDialog(BuildContext context) {
return showDialog<void>(
context: context,
builder: (BuildContext context) {
return AlertDialog(
title: Text('提領'),
content: Container(
height: 70 * StorageUtil.getDouble("textScaleFactor"),
child: Column(
children: [
Text('總金額:'+'9999', style: TextStyle(color: Colors.black)),
Text('提領金額:'+'9999', style: TextStyle(color: Colors.black)),
Text('金額結餘:'+'9999', style: TextStyle(color: Colors.black)),
],
),
),
actions: <Widget>[
FlatButton(
color: mainColor[200],
child: Text('取消', style: TextStyle(color: Colors.white)),
onPressed: () {
Navigator.of(context).pop();
},
),
FlatButton(
color: mainColor[500],
child: Text('確定'),
onPressed: () {
Navigator.of(context).pop();
},
),
],
);
},
);
}