我正在尝试绘制一个对话框/弹出窗口,当用户点击Google地图中的标记时会显示该对话框。
问题是文本字段在对话框中未对齐。您可以在下面的图片中看到它:
所以,我想知道如何对齐文本,以便每个新文本都垂直于一行。
这是我的代码:
child: Material(
color: Colors.transparent,
child: ScaleTransition(
scale: scaleAnimation,
child: Container(
decoration: ShapeDecoration(
color: Colors.blueGrey[900],
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(15.0))),
child: Padding(
padding: const EdgeInsets.fromLTRB(40, 20, 40, 15),
child: Container(
child: Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Container(
child: Text(
'Stackoverflow Restaurant',
style: new TextStyle(
fontSize: 20.0,
color: textColorPopup,
fontWeight: FontWeight.bold),
),
),
Container(
padding: EdgeInsets.fromLTRB(0, 20, 0, 0),
child: Text(
'Open hours',
style: new TextStyle(
fontSize: fontSizeWeekDays, color: textColorPopup),
),
),
Container(
padding: EdgeInsets.fromLTRB(0, 10, 0, 0),
child: Row(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Text(
'MON',
style: new TextStyle(
fontSize: fontSizeOpenHours,
color: textColorPopup),
),
SizedBox(
width: 30.0,
),
Text(
'15.00 - 03.00',
style: new TextStyle(
fontSize: fontSizeOpenHours,
color: textColorPopup),
),
],
),
),
Container(
padding: EdgeInsets.fromLTRB(0, 5, 0, 0),
child: Row(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Text(
'TUE',
style: new TextStyle(
fontSize: fontSizeOpenHours,
color: textColorPopup),
),
SizedBox(
width: 30.0,
),
Text(
'15.00 - 03.00',
style: new TextStyle(
fontSize: fontSizeOpenHours,
color: textColorPopup),
),
],
),
),
Container(
padding: EdgeInsets.fromLTRB(0, 5, 0, 0),
child: Row(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Text(
'WEN',
style: new TextStyle(
fontSize: fontSizeOpenHours,
color: textColorPopup),
),
SizedBox(
width: 30.0,
),
Text(
'15.00 - 03.00',
style: new TextStyle(
fontSize: fontSizeOpenHours,
color: textColorPopup),
),
],
),
),
Container(
padding: EdgeInsets.fromLTRB(0, 5, 0, 0),
child: Row(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Text(
'THU',
style: new TextStyle(
fontSize: fontSizeOpenHours,
color: textColorPopup),
),
SizedBox(
width: 30.0,
),
Text(
'15.00 - 03.00',
style: new TextStyle(
fontSize: fontSizeOpenHours,
color: textColorPopup),
),
],
),
),
Container(
padding: EdgeInsets.fromLTRB(0, 5, 0, 0),
child: Row(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Text(
'FRI',
style: new TextStyle(
fontSize: fontSizeOpenHours,
color: textColorPopup),
),
SizedBox(
width: 30.0,
),
Text(
'15.00 - 03.00',
style: new TextStyle(
fontSize: fontSizeOpenHours,
color: textColorPopup),
),
],
),
),
Container(
padding: EdgeInsets.fromLTRB(0, 20, 0, 0),
child: Row(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Text(
'SAT',
style: new TextStyle(
fontSize: fontSizeOpenHours,
color: textColorPopup),
),
SizedBox(
width: 30.0,
),
Text(
'15.00 - 03.00',
style: new TextStyle(
fontSize: fontSizeOpenHours,
color: textColorPopup),
),
],
),
),
Container(
padding: EdgeInsets.fromLTRB(0, 5, 0, 30),
child: Row(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Text(
'SUN',
style: new TextStyle(
fontSize: fontSizeOpenHours,
color: textColorPopup),
),
SizedBox(
width: 30.0,
),
Text(
'15.00 - 03.00',
style: new TextStyle(
fontSize: fontSizeOpenHours,
color: textColorPopup),
),
],
),
),
RaisedButton(
padding: EdgeInsets.fromLTRB(60, 0, 60, 0),
color: Colors.white,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(20.0),
),
onPressed: _dismissAlertDialog,
child: Text(
'CLOSE',
style: TextStyle(
fontSize: 18,
color: Colors.black,
fontStyle: FontStyle.normal),
),
),
],
),
),
),
),
),
),
答案 0 :(得分:2)
在每行上使用mainAxisAlignment:MainAxisAlignment.spaceBetween,“天”将向左对齐,“时间”将向右对齐。