How to make two text widgets bottom aligned as shown in the picture in flutter?
enter image description here
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.end,
children: [
Row(
children: [
const Text(
'$',
style: TextStyle(fontSize: 12),
),
Text(
'${product.price}',
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: const TextStyle(fontSize: 16),
),
],
),
3
Answers
You don’t need Two Row Widget. So remove the parent Row and use the child Row as a Parent. Then add
crossAxisAlignment: CrossAxisAlignment.end
. Code:Hope it helps!
In Flutter, you can achieve this by using the RichText widget, which allows you to display different styles within a single text element. Here’s an example of how you can add text containing a dollar sign with different font sizes