如果 CupertinoTextField 不为空,我想将 CupertinoDialogAction 设置为启用,否则默认情况下它应该被禁用,我也设置了“isDefaultAction:false”,但它仍然是可点击的。
showDialog(
context: context,
builder: (BuildContext context) => CupertinoAlertDialog(
actions: [
CupertinoDialogAction(
onPressed: () => (Navigator.of(context).pop()),
child: Text("Cancel"),
),
CupertinoDialogAction(
child: Text("Save"),
isDefaultAction: false,
),
],
title: Text("New Folder"),
content: Column(
children: <Widget>[
Padding(
padding: const EdgeInsets.all(8.0),
child: Text("Enter a name for this folder"),
),
Container(
height: 30,
child: CupertinoTextField(
controller: folderName,
placeholder: "Name",
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8),
),
),
)
],
),
),
);