flutter-layoutflutter-widgetflutter-rowflutter-column

RenderBox was not laid out: RenderRepaintBoundary#5291c relayoutBoundary=up1 NEEDS-PAINT


I have a form widget which holds the Column as its child. The reason of Column widget is to have username and password fields one after another-password field in new line. In addition, I need to have username and password logos next to the respective fields, so I decided to use Row widget which will hold the Icon and TextFormField. However, flutter provides me error. Can someone please help?

Row(
        children: [
          
      Padding(
        padding: const EdgeInsets.symmetric(vertical: 15, horizontal: 30),
        child: TextFormField(
        
        enabled: formFieldEditable,
        validator: emptyNullValidatorForFormField,
        
        decoration: InputDecoration(
         focusedBorder: _inputFormFieldOutlineInputBorder(
          borderSideWidth: ProjectSpecifics.signinScreenInputBorderWidth,
          borderSideColor: ProjectSpecifics.signInPageInputBorder,
        ),
        
        enabledBorder:_inputFormFieldOutlineInputBorder(
          borderSideWidth: ProjectSpecifics.signinScreenInputBorderWidth,
          borderSideColor: ProjectSpecifics.signInPageInputBorder,
        ),
        
          
        /*icon: Container(
          decoration: BoxDecoration(
            border: Border.all(
              color: const Color(0xFF5663FE),
              width: 2,
            ),
        
            borderRadius: BorderRadius.circular(5),
          ),
          child: const Icon(
            Icons.email,
            color: ProjectSpecifics.signInPageInputBorder,
          ),
        ),*/
        
        labelText: "EMAIL"),
        
        
                onChanged: (val) {
        emailVariableReference = val;
                },
        ),
      ),],
      ),

Solution

  • Wrap TextFormField with Flexible or Expanded widget.

    Column(
      mainAxisAlignment: MainAxisAlignment.start,
      mainAxisSize: MainAxisSize.min,
      children: [
        Row(
          mainAxisSize: MainAxisSize.min,
          children: [
            Icon(Icons.radar),
            Expanded(child: TextFormField()),
          ],
        ),
        Row(
          mainAxisSize: MainAxisSize.min,
          children: [
            Icon(Icons.abc),
            Flexible(child: TextFormField()),
          ],
        ),
      ],
    ),