RenderFlex 在底部溢出了 14 个像素。相关的导致错误的小部件是 AlertDialog

时间:2021-06-24 17:10:12

标签: android flutter dart popup render

我正在创建一个对话框,当我单击编辑图标按钮时它会打开,但是当我单击文本字段输入文本时,它会向我发送此错误

SELECT SUBSTRING(col, 1, CHARINDEX('|', col) - 1)
FROM yourTable;

这是我的对话框代码

════════ Exception caught by rendering library ═════════════════════════════════
A RenderFlex overflowed by 14 pixels on the bottom.
The relevant error-causing widget was
AlertDialog

这是我的对话框的样子

enter image description here

当点击第一个文本框时,它看起来像这样

enter image description here

请帮我解决它。

2 个答案:

答案 0 :(得分:1)

您可以将scrollable的{​​{1}}参数设置为AlertDialog以避免溢出:

true

答案 1 :(得分:1)

    AlertDialog alert = AlertDialog( 
        scrollable: true, 
        //contentPadding:EdgeInsets.fromLTRB(0, 20, 0, 20),
        insetPadding: EdgeInsets.symmetric(vertical: 150),
        //contentPadding: const EdgeInsets.all(16.0),
        title: Text("Request to change time",style: TextStyle(fontWeight: FontWeight.bold,color: Colors.blue[500])),  
        
        content:Container(child: SingleChildScrollView( 
          scrollDirection: Axis.vertical,
        child:Column(
          crossAxisAlignment: CrossAxisAlignment.spaceBetween,
          children:<Widget> [
          
          TextField(
            decoration: InputDecoration(labelText: date,hintText: "Date"),
            controller:dateController ,
          ),
          TextField(
            decoration: InputDecoration(labelText: timein,hintText: "Time in"),
            controller:timeinController ,
          ),
          TextField(
            decoration: InputDecoration(labelText:timeout,hintText: "Time out"),
            controller:timeoutController ,
          ),
          
         ]), 
      )
      ),
      actions: [  
          okButton,  
          
        ],  
      );  
          showDialog(  
        context: context,  
        builder: (BuildContext context) {  
          return alert;  
        },  
      );  
     
        
      }