gpt4 book ai didi

flutter - 如何对齐 TextFields 例如列中的文本()?

转载 作者:IT王子 更新时间:2023-10-29 07:10:56 25 4
gpt4 key购买 nike

我正在尝试绘制一个对话框/弹出窗口,当用户点击谷歌地图中的标记时会显示该对话框/弹出窗口。

问题是文本字段在对话框中没有对齐。您可以在下面的图片中看到它:

所以,我想知道如何对齐文本,以便每个新文本都从垂直的一行开始。

Look at the time, and day-leadings

这是我的代码:

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),
),
),
],
),
),
),
),
),
),

最佳答案

使用 mainAxisAlignment:在每一行上使用 MainAxisAlignment.spaceBetween,日期将左对齐,时间将右对齐。

关于flutter - 如何对齐 TextFields 例如列中的文本()?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57082336/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com