I have a row widget, where the warning icon is displayed next to two text sections. In the screenshot, it looks like the alignment of the icon is at the upper level of the biggest text. I have the mainAxisAlignment and the crossAxisAlignment, and textBaseline all defined to make sure they all align at the bottom, however the icon does not seem to follow the rule. I have a screenshot and my code to also show as well.
This is how I want it to look like:
With everything aligned at the bottom
In the screen shot you can see the warning Icon is slightly higher than the rest of the text. Here is my code (in dart):
Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.baseline,
textBaseline: TextBaseline.alphabetic,
children: [
InkWell(
onTap: () {
showModalBottomSheet<void>(
context: context,
builder: (BuildContext context) {
return const SizedBox(
child: WarningModal(),
);
},
);
},
child: const Icon(Icons.warning_amber_rounded, size: 30.0),
),
Text('$$progressAmt',
style: const TextStyle(
fontWeight: FontWeight.w800, fontSize: 24)),
Text(' of $totalProgress',
style: const TextStyle(fontSize: 16)),
]
2
Answers
Hope this helps:
Update crossAxisAlignment to
crossAxisAlignment: CrossAxisAlignment.center,
Update
to
crossAxisAlignment: CrossAxisAlignment.center
This should solve the issue. for you.