'Text Overflow inside container creating design such as messenger messages in which text is inside container in which height and width not mentioned
I want container to maintain its height and width according to the text without the text overflowing such as if there is small text width is small but if text is long then width takes up size as possible and rest goes to next Line. Please help
Container(
padding: EdgeInsets.symmetric(vertical: 10, horizontal: 15),
child: Text(
message.text,
style: TextStyle(
color: message.isSender
? Colors.white
: Theme.of(context).textTheme.bodyText1?.color,
),
),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(40),
color: KprimaryColor.withOpacity(message.isSender ? 1 : 0.1)),
),
Solution 1:[1]
Set width to your container, I think it should fix the problem
Solution 2:[2]
You have to Wrap it with Expanded or Flexible it will stretch the width and height Note: Flexible must be used under the following Widgets Row,Column,Stack.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Temirlan Almassov |
Solution 2 | Sneha G Sneha |