Flutter 文本对齐
Flutter text aligment
我正在使用行来显示此文本。但是,当我使用扩展小部件制作多行第二个文本(例如 AMD Ryzen ... / 30 天 ...)时,第一个文本(例如 Processor/OS)变为垂直居中,我想要那个垂直顶部。我尝试了几个小部件,如对齐等,但没有用。
代码:
Widget _specificationRow(String title, String description) {
return new Row(children: [
Padding(
padding: const EdgeInsets.all(5.0),
child: Align(
alignment: Alignment.topRight,
child: Text(
'• $title :',
style: TextStyle(
color: Colors.deepOrange,
fontSize: 15.0,
fontFamily: "GoogleSans"),
),
),
),
Expanded(
child: Padding(
padding: const EdgeInsets.all(5.0),
child: Text(
'$description',
maxLines: 3,
overflow: TextOverflow.clip,
style: TextStyle(
fontSize: 15.0,
fontFamily: "GoogleSans"),
),
),
),
]);
}
Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'• title : ',
style: TextStyle(
color: Colors.deepOrange,
fontSize: 15.0,
fontFamily: "GoogleSans"),
),
Expanded(
child: Text(
'sfdadfafdsfseriewhfkjsvk shfhskdfhs sdfsd fyesruwefkj\nsdfassdfsafdsafd',
maxLines: 3,
style: TextStyle(fontSize: 15.0, fontFamily: "GoogleSans"),
),
),
],
),
请提供crossAxisAlignment: CrossAxisAlignment.start
我正在使用行来显示此文本。但是,当我使用扩展小部件制作多行第二个文本(例如 AMD Ryzen ... / 30 天 ...)时,第一个文本(例如 Processor/OS)变为垂直居中,我想要那个垂直顶部。我尝试了几个小部件,如对齐等,但没有用。
代码:
Widget _specificationRow(String title, String description) {
return new Row(children: [
Padding(
padding: const EdgeInsets.all(5.0),
child: Align(
alignment: Alignment.topRight,
child: Text(
'• $title :',
style: TextStyle(
color: Colors.deepOrange,
fontSize: 15.0,
fontFamily: "GoogleSans"),
),
),
),
Expanded(
child: Padding(
padding: const EdgeInsets.all(5.0),
child: Text(
'$description',
maxLines: 3,
overflow: TextOverflow.clip,
style: TextStyle(
fontSize: 15.0,
fontFamily: "GoogleSans"),
),
),
),
]);
}
Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'• title : ',
style: TextStyle(
color: Colors.deepOrange,
fontSize: 15.0,
fontFamily: "GoogleSans"),
),
Expanded(
child: Text(
'sfdadfafdsfseriewhfkjsvk shfhskdfhs sdfsd fyesruwefkj\nsdfassdfsafdsafd',
maxLines: 3,
style: TextStyle(fontSize: 15.0, fontFamily: "GoogleSans"),
),
),
],
),
请提供crossAxisAlignment: CrossAxisAlignment.start