Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Why is row expanded?

I am trying to design a simple chat bubble with sender’s name and message. Why my row is expanded?
HEre is my code:

> Container(
>     padding: const EdgeInsets.symmetric(
>     horizontal: 10, vertical: 0),
>     child: Align(
>         alignment: widget.senderid ==
>         chatState.messages[index].senderid
>         ? Alignment.topLeft: Alignment.topRight,
>         child: Container(
>            decoration: BoxDecoration(
>            borderRadius: BorderRadius.circular(15),
>            color: widget.senderid ==chatState.messages[index].senderid
>                 ? Colors.grey.shade200
>                 : Colors.blue[200]),
>           padding: const EdgeInsets.symmetric(horizontal: 15, vertical: 5),
>           child: Column(
>                children: [ Row(children: [
>                    Text('alex')]),
>                     Text('chatState.messages[index].text!')]))));

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

To allow row to use minimum size you need to use mainAxisSize which is property of row.

Eg:

Row(
   mainAxisSize: MainAxisSize.min. //default is max
   children: [...]
)

Same property is available for Column as well if you want to make column to use minimum size.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading