颤振中容器的自动高度

安德烈·哈夫里亚克

我写了一个页面,在顶部一切都很好,应该是这样。在底部,我有一个事件的历史。我的容器的宽度是自动确定的(取决于屏幕的宽度),高度 - 不,在不同的设备上不同的高度(底部的缩进不同)。是否可以自动确定高度(到屏幕末端)??另外,我想在这个容器的底部添加一个滚动条,这样当事件出现在那里时,我可以在底部和顶部滚动它们。我会很感激你的帮助。

我的页面: 在此处输入图片说明

我的代码:

 Widget build(BuildContext context) {
    return Scaffold(
      body: Container(
        decoration: BoxDecoration(
        color:Colors.white12
        ),
        child: Column(
          mainAxisAlignment: MainAxisAlignment.start,
          children: <Widget>[

            Column(
                children: <Widget>[
                  SizedBox(height: 20.0),
                  Row(
                    mainAxisAlignment: MainAxisAlignment.spaceAround,
                    children: <Widget>[
                      FlatButton(
                        textColor: Colors.blueGrey,
                        color: Colors.transparent,
                        child: Text('yes',textScaleFactor: 2.5),
                        onPressed: null,
                        padding: EdgeInsets.fromLTRB(30.0, 10.0, 30, 10.0),
                      ),
                      FlatButton(
                        textColor: Colors.blueGrey,
                        color: Colors.transparent,
                        child: Text('no',textScaleFactor: 2.5),
                        onPressed: null,
                        padding: EdgeInsets.fromLTRB(30.0, 10.0, 30, 10.0),
                      )
                    ],
                  ),
                  SizedBox(height: 15.0),
                  Container(
                      child: Text(('20000' == null ? '' : '10000'), style: TextStyle(fontSize: 45.0,color: Colors.blueGrey)),
                      padding: EdgeInsets.fromLTRB(0, 0.0, 0, 20.0),
                  ),
                  Container(
                    child: Text("weight", style: TextStyle(fontSize: 20.0,color: Colors.blueGrey)),
                    padding: EdgeInsets.only(top: 2, bottom:40, left:0, right:0),
                  ),
                  Center(
                      child: Container(
                        alignment: Alignment.center,
                        width: double.infinity,
                        height: 430,
                        decoration: BoxDecoration(
                            border: Border.all(
                                width: 1.5
                            ),
                            borderRadius: BorderRadius.circular(25)
                        ),
                        child: new Column(
                          children: [
                            Container(
                                child: Text("history events", style: TextStyle(fontSize: 20.0,color: Colors.blueGrey)),
                                padding: EdgeInsets.all(2.0)
                            ),
                          ],
                        ),

                      )//Container
                  )
                ]
            )
          ],
        ),
      ),
      floatingActionButton: FloatingActionButton(
        onPressed: () {
          setState(() {
            _scanQR();
          });
        },
        child: const Icon(Icons.qr_code),
        backgroundColor: Colors.pink,

      ),
    );
  }

我的 scrin(更新代码后)

在此处输入图片说明

亚什拉吉
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Column(
        mainAxisSize: MainAxisSize.min,
        children: <Widget>[
          Expanded(
              child: Scrollbar(
                  child: new ListView(
            shrinkWrap: true,
            children: [
              SizedBox(height: 20.0),
              Row(
                mainAxisAlignment: MainAxisAlignment.spaceAround,
                children: <Widget>[
                  FlatButton(
                    textColor: Colors.blueGrey,
                    color: Colors.transparent,
                    child: Text('yes', textScaleFactor: 2.5),
                    onPressed: null,
                    padding: EdgeInsets.fromLTRB(30.0, 10.0, 30, 10.0),
                  ),
                  FlatButton(
                    textColor: Colors.blueGrey,
                    color: Colors.transparent,
                    child: Text('no', textScaleFactor: 2.5),
                    onPressed: null,
                    padding: EdgeInsets.fromLTRB(30.0, 10.0, 30, 10.0),
                  )
                ],
              ),
              SizedBox(height: 15.0),
              Container(
                child: Text(('20000' == null ? '' : '10000'), style: TextStyle(fontSize: 45.0, color: Colors.blueGrey)),
                padding: EdgeInsets.fromLTRB(0, 0.0, 0, 20.0),
              ),
              Container(
                child: Text("weight", style: TextStyle(fontSize: 20.0, color: Colors.blueGrey)),
                padding: EdgeInsets.only(top: 2, bottom: 40, left: 0, right: 0),
              ),
              Container(
                  alignment: Alignment.center,
                  decoration: BoxDecoration(border: Border.all(width: 1.5), borderRadius: BorderRadius.circular(25)),
                  child: Column(
                    children: [
                      Center(
                          child: Container(
                              height: 65,
                              child: Text("history events", style: TextStyle(fontSize: 25.0, color: Colors.blueGrey)),
                              padding: EdgeInsets.all(2.0))),
                      Container(
                          child: Text("Event 1", style: TextStyle(fontSize: 50.0, color: Colors.blueGrey)),
                          padding: EdgeInsets.all(2.0)),
                      SizedBox(
                        height: 200,
                      ),
                      Container(
                          child: Text("Event 2", style: TextStyle(fontSize: 50.0, color: Colors.blueGrey)),
                          padding: EdgeInsets.all(2.0)),
                      SizedBox(
                        height: 200,
                      ),
                      Container(
                          child: Text("Event 3", style: TextStyle(fontSize: 50.0, color: Colors.blueGrey)),
                          padding: EdgeInsets.all(2.0)),
                      SizedBox(
                        height: 50,
                      ),
                    ],
                  )),
            ],
          )))
        ],
      ),
      floatingActionButton: FloatingActionButton(
        onPressed: () {
          setState(() {
            // _scanQR();
          });
        },
        child: const Icon(Icons.qr_code),
        backgroundColor: Colors.pink,
      ),
    );
  }

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章