Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to solve "A RenderFlex overflowed by 143 pixels on the right." error in text?

Tags:

flutter

dart

enter image description here

This is my cardview code:

Column(
    crossAxisAlignment: CrossAxisAlignment.start,
    children: <Widget>[
        TitleText(text: "Item name mmmmmmmmm $index"),
        SizedBox(height: 20.0),
        Body1Text(text: "Discount mmmmmmmm",color: Colors.red,),
        SizedBox(height: 5.0),
        SubHeadText(text: "Price ,mmmmmmmmmmmmmmmmmm",color: Colors.red,)

    ],
),
like image 724
Vithani Ravi Avatar asked Jan 07 '19 07:01

Vithani Ravi


People also ask

How do I fix RenderFlex overflow?

Hence to resolve the issue, just wrap your entire body content with ListView as below: return Scaffold( resizeToAvoidBottomPadding: false, body: ListView( // use ListView instead of Column children: <Widget>[ Padding( padding: const EdgeInsets.

How do I fix my RenderFlex error?

Solution of the Error: In case of Column Error, such as "A RenderFlex overflowed by pixels on the bottom", you need to wrap Column() with SingleChildScrollView() widget.

How do you avoid right overflow in flutter?

Solution : The solution to resolve this overflow error is to make your entire widget or in our case the Column scrollable. We can do that by wrapping our Column inside a SingleChildScrollView.


1 Answers

Just Wrap you - Card with -Flexible Widget.

Row(
    children: <Widget>[
      Flexible(
        child: Card(
          child: Column(
            crossAxisAlignment: CrossAxisAlignment.start,
            children: <Widget>[
              Text("Item name mmmasdaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaammmmmm"),
              SizedBox(height: 15.0,),
              Text(
                "Discount mmmmmmmm",
              ),
              SizedBox(height: 5.0,),
              Text(
                "Price ,mmmmmmmmmdgfdgfdgfdgfdgfdgfdgfdgfdgfdgfdgfdgfdgfdgfdgfdgfdgfdgfdgfdgfdgfdgfdgfdgfdgfdgfdgfdgfdgfdgfdgfdgfdgfdgfdgfdgfdgfmmmmmmmmm",
              )
            ],
          ),
        ),
      ),
    ],
  ),
like image 183
anmol.majhail Avatar answered Sep 23 '22 10:09

anmol.majhail