将AlertDialog包裹在Flexible中,并将flex值设置为0,这将强制AlertDialog与其兄弟小部件平分可用空间,从而避免RenderFlex溢出问题。
示例代码如下:
Column(
children: [
// other widgets
Flexible(
flex: 0,
child: AlertDialog(
// your alert dialog content here
),
),
],
);