卡中心

时间:2019-05-16 10:11:26

标签: flutter flutter-layout

我从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")
                            ],
                          ),
                        ))
                  ],
                ),
              );
            }));

我最近的查看:

My output

1 个答案:

答案 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的左侧