close

TextField inside of Row causes layout exception: Unable to calculate size

Hello Guys How are you all ? Hope You all Are fine. In todays tutorial we are going to solve TextField inside of Row causes layout exception: Unable to calculate size error in flutter.

I’m attempting to create a column that has 3 rows. First children is Row [Image] Second Children in Row [TextField] and Third Children is Row [Buttons]. When I run I get the following exception:

Solution 1

Question: How to solve TextField inside of Row causes layout exception: Unable to calculate size ?
Answer: This error occurs due to TextField expands in horizontal direction and so does the Row , so we need to constrain the width of the TextField , there are many ways of doing it. you should use Flexible to use a Textfield inside a row.

Use Expanded

Solution 2

Use Flexible

Solution 3

Wrap it in Container or SizedBox and provide width

Solution 4

use Flexible to use a Textfield inside a row.

Solution 5

The solution is to wrap your Text() inside one of the following widgets: Either Expanded or Flexible. So, your code using Expanded will be like:

This Above 5 Solution Is Worked For Me. Hope it work for you too.

So it’s all About this error. Hope this tutorial helped you a lot. Comment below Your thoughts and your queries. And Also Comment on your suggestion here.

Also Read

Leave a Comment

%d bloggers like this: