Shahbaz
Shahbaz

Reputation: 825

How to dynamically change container size with text quantity in flutter?

I want to create a container in flutter which changes its height according to the amount of text present in it.

If there is more text, it should cover more height, if text is less, it should cover less height.

Upvotes: 0

Views: 1201

Answers (1)

Anas
Anas

Reputation: 1073

You can use fitted Box and width of container will help you to increase height dramatically.

FittedBox(fit: BoxFit.fill,
        child: Container(width: 70,
          child:
      Text('hello '), color: Colors.red,
      )
         )       

Upvotes: 2

Related Questions