我需要一个AlertDialog
with minHeight
of 50
。它包含一个ListView
. 如果ListView
超出屏幕它应该变成scrollable
。但由于某种原因我无法滚动。谁能向我解释为什么它不起作用:)
AlertDialog(
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(10)),
title: ... ,
content: ConstrainedBox(
constraints: new BoxConstraints(
minHeight: 50,
),
child: Column(
children: <Widget>[
Row(...),
Container(
child: ListView.builder(
shrinkWrap: true,
itemCount: list.length,
itemBuilder: (context, index) {
return GestureDetector(
onTap: () => _onTap(list[index]),
child: Row(
children: <Widget>[
Flexible(
flex: 1,
child: Checkbox(...),
),
Flexible(
flex: 3,
child: Text(list[index]),)
],
)
);
},
)
)
],
),
),
actions: <Widget>[
MaterialButton(
minWidth:100,
child: Text('Cancel'),
onPressed: (){
Navigator.of(context).pop();
}
),
MaterialButton(
minWidth:100,
elevation: 5.0,
color: Theme.of(context).accentColor,
child: Text('Save', style: TextStyle(color: Color(0xFFF6F5F5))),
onPressed: (){
}
)
],
);