【发布时间】:2019-03-19 05:50:15
【问题描述】:
我正在使用 Align Widget 将子项集中在一行中,但它不起作用...我做错了什么?
这是代码:
.... 主页.dart ....
@override
Widget build(BuildContext context){
_context = context;
return new Scaffold(
appBar: new AppBar(title: Text("MiniCon")),
body: new Container(child: new Column(children:[
new Align(alignment:Alignment.center,child:new Row(children:[
_commons.makeEditText("Ahorro Real", grey, false),
_commons.makeEditText("Ahorro Actual", black, true),
_commons.makeEditText("Gastos", black, true)
])),
new Row(children:[
_commons.makeEditText("Ahorro Real", grey, false)
])
])));
}
.... _commons.dart ....
Widget makeEditText(String label, Color labelColor, bool enabled) {
return
new Padding(padding:EdgeInsets.all(2.5), child:
new Container(decoration:
new BoxDecoration(border:
new Border.all(width:2.0)),padding: new
new EdgeInsets.all(10.0),width:110.0,child:
new TextField(enabled: enabled,
style: TextStyle(color: labelColor),
decoration: new InputDecoration(
labelStyle: TextStyle(fontSize: 15.0), labelText: label),
)));
}
提前致谢!!
【问题讨论】: