我试图使 showModalBottomSheet() 的高度自动调整为内容。
我用过FractionallySizedBox,isScrollControlled: true但需要heightFactor提供。
有没有办法根据底部的内容调整底部工作表的高度?
isScrollControlled truemainAxisSize为min;shrinkWrap为true.例如:
showModalBottomSheet(
isScrollControlled: true,
backgroundColor: Colors.blue,
context: context,
builder: (context) {
return Column(
mainAxisSize: MainAxisSize.min,
children: [
Container(width: 100, height: 100, color: Colors.green),
Container(width: 300, height: 500, color: Colors.red),
Container(width: 100, height: 100, color: Colors.orange),
],
);
},
);
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2203 次 |
| 最近记录: |