Reputation: 9044
I have a Row
with two Text
widgets in it:
Card(...
Padding(...
Column(...
Padding(...
Column(
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text('Text'),
Text('Long text'),
],
...
The output is something like this:
+----------------------------+
Text Long text
+----------------------------+
If the second text is larger than the available space, I want something like this:
+----------------------------+
Text Loooooooooooooooooooong
texttttttttttt
+----------------------------+
but I get overflow error:
+----------------------------+
Text Loooooooooooooooooooong texttttttttttt
+----------------------------+
What should I do?
Upvotes: 0
Views: 1977
Reputation: 598
I would use flex to prevent it from taking the full size of the view
Row(
children: [
Text('Text'),
Flexible(
child: Text(
'Loooooooooooooooooooong texttttttttttt ',
textAlign: TextAlign.right,
),
),
],
),
Upvotes: 1
Reputation: 16185
Wrap the second text in the Expanded widget
Row(
children: [
Text('Text'),
Expanded(
child: Text(
'Loooooooooooooooooooong texttttttttttt ',
textAlign: TextAlign.right,
),
),
],
),
Upvotes: 4