我从api得到响应,在api中我得到了一些值,但是我的值显示在卡的中心,我只想显示然后在卡的左侧。
代码:
return Scaffold(
body: new ListView.builder(
itemCount: _itemcount,
padding: EdgeInsets.only(top: 50),
itemBuilder: (BuildContext context, int index) {
return new Container(
child: new Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: <Widget>[
new Card(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10.0)),
child: Container(
padding: EdgeInsets.all(20.0),
child: Column(
children: <Widget>[
new Text("next"),
new Padding(padding: EdgeInsets.only(top: 2.0)),
new Text("previous")
],
),
))
],
),
);
}));
我最近的查看:
答案 0 :(得分:1)
尝试
return Scaffold(
body: new ListView.builder(
itemCount: _itemcount,
padding: EdgeInsets.only(top: 50),
itemBuilder: (BuildContext context, int index) {
return new Container(
child: new Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: <Widget>[
new Card(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10.0)
),
child: Container(
padding: EdgeInsets.all(20.0),
child: Row(
children: <Widget>[
Column(
children: <Widget>[
new Text("next"),
new Padding(padding: EdgeInsets.only(top: 2.0)),
new Text("previous")
],
),
],
),
)
)
],
),
);
})
);
通过将Column
包裹在Row
中,将内容推到Card
的左侧