我正在使用ListTile中的复选框,如下所示:
ListTile(
leading: Checkbox(
value: _isChecked,
onChanged: (v) {
setState(() {
_isChecked = !_isChecked;
});
},
),
title: Text("is Bathroom"),
);
如何禁用该复选框?我知道复选框小部件是无状态的.但是,在material 子程序包中是否提供了其他可以做到这一点的Widget呢?类似InputDecorator的东西.
另外,我对DropdownButton也有同样的问题.我使用它从下拉列表中 Select 表单中的一个项目,如下所示.
InputDecorator(
decoration: InputDecoration(
labelText: "Type",
hintText: "Choose the type",
),
isEmpty: _type == null,
child: DropdownButton<int>(
value: _type,
isDense: true,
onChanged: (value) {
setState(() {
_type = value;
});
},
items: _buildDropdownItemList(),
),
);
我在InputDecoration中try 了enable参数,但这只是改变了装饰.用户仍然可以更改 Select .