我想创建一行并排提交的多个文本。在行小部件内添加文本文件会导致错误,所以我搜索了这个问题并找到了一个解决方案,该解决方案使用灵活的小部件将文本字段放在一行中并且它工作得很好,但是当我尝试向文本文件添加填充以便有多个视野时提交的文本,这里不起作用,这是我的代码:
new Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
new Flexible(
child: new TextField(
decoration: InputDecoration(
contentPadding: EdgeInsets.all(10)
)
),
),
new Flexible(
child: new TextField(
decoration: InputDecoration(
contentPadding: EdgeInsets.all(10)
)
),
),
new Flexible(
child: new TextField(
decoration: InputDecoration(
contentPadding: EdgeInsets.all(10)
)
),
),
],
),
Run Code Online (Sandbox Code Playgroud)
如何在提交的文本中添加一些填充。我想知道有什么方法可以通过提交一个文本来实现这一目标?
che*_*ins 15
你可以SizedBox
在两者之间添加。在TextField
试图获得最大尺寸当您使用Flexible
所以没有空间在中间离开,即使你使用spaceBetween
。
new Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
new Flexible(
child: new TextField(
decoration: InputDecoration(
contentPadding: EdgeInsets.all(10)
)
),
),
SizedBox(width: 20.0,),
new Flexible(
child: new TextField(
decoration: InputDecoration(
contentPadding: EdgeInsets.all(10)
)
),
),
SizedBox(width: 20.0,),
new Flexible(
child: new TextField(
decoration: InputDecoration(
contentPadding: EdgeInsets.all(10)
)
),
),
],
),
Run Code Online (Sandbox Code Playgroud)
您也可以Padding
在TextField
.
new Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
new Flexible(
child: Padding(
padding: const EdgeInsets.all(20.0),
child: new TextField(
decoration: InputDecoration(
contentPadding: EdgeInsets.all(10)
)
),
),
),
new Flexible(
child: Padding(
padding: const EdgeInsets.all(20.0),
child: new TextField(
decoration: InputDecoration(
contentPadding: EdgeInsets.all(10)
)
),
),
),
new Flexible(
child: Padding(
padding: const EdgeInsets.all(20.0),
child: new TextField(
decoration: InputDecoration(
contentPadding: EdgeInsets.all(10)
)
),
),
),
],
),
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
10595 次 |
最近记录: |