【发布时间】:2019-11-21 12:17:53
【问题描述】:
在我的颤振项目中,我使用了一个 Row 水平对齐两个文本,第一个文本大小是固定的,但我希望第二个文本具有与屏幕大小一样多的宽度。
这是我的代码-
Container(
child: Padding(
padding: const EdgeInsets.all(10.0),
child: (
Row(
children: <Widget>[
Container(
width: 150,
color: Colors.blue,
child: Text("City: "),
),
Container(
color: Colors.red,
child: Text("London"),
)
],
)
),
),
),
Container(
child: Padding(
padding: const EdgeInsets.all(10.0),
child: (
Row(
children: <Widget>[
Container(
width: 150,
color: Colors.blue,
child: Text("Country: "),
),
Container(
color: Colors.red,
child: Text("England "),
)
],
)
),
),
),
Container(
child: Padding(
padding: const EdgeInsets.all(10.0),
child: (
Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Container(
width: 150,
color: Colors.blue,
child: Text("Address: "),
),
Container(
color: Colors.red,
child: Text("aaaaa zzzzz wwwww qqqqqq rrrrr"),
)
],
)
),
),
),
使用上面的代码,我得到了以下输出-
问题是图像中的黑色标记部分。
所以,我需要帮助来了解文本如何占用与屏幕尺寸一样多的宽度,其余文本将显示在下一行。
【问题讨论】: