How to make the middle text centered vertically?
my current approach is like this:
Row _text2Value(
{required String title,
required String value1,
required String uom,
required String value2}) {
return Row(children: [
Text(title, style: TextStyle(fontSize: 8)),
Expanded(
child: Text('.' * 100, maxLines: 1, style: TextStyle(fontSize: 8))),
Text("$value1 $uom", style: TextStyle(fontSize: 8)),
Expanded(
child: Text('.' * 100, maxLines: 1, style: TextStyle(fontSize: 8))),
Text(value2, style: TextStyle(fontSize: 8))
]);
}
4
Answers
The below code should work for you.
Just refer to your code I have try something using Expanded Widget. you can used Flexible Widget as well instead of Expanded.
Custom Method:
Implement Custom Method:
Mobile Screen, Web Screen
To vertically center widgets in a Row in Flutter and separate them with dots, you can use the
Row
widget withmainAxisAlignment: MainAxisAlignment.center
for alignment andCrossAxisAlignment.center
for vertical centering. UseText("•")
as a separator. For example:This approach ensures proper centering and dot separation between the widgets.