Flutter   发布时间:2022-05-03  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了mobile – Flutter – 位于另一个小部件下方的列表视图大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
我是从Flutter开始的,我遇到了一个我无法构建的布局,在一个可视化示例下面:

mobile – Flutter – 位于另一个小部件下方的列表视图

我已经尝试过类似的东西:

class MyApp extends StatelessWidget {
          @override
          Widget build(BuildContext context) {
            return new MaterialApp(
              title: 'Welcome to Flutter',home: new Scaffold(
                  appBar: new AppBar(
                    title: new Text('App'),),body: new column(
                      children: <Widget>[
                        new Text('LISTA',style: new TextStyle(
                              fontSize: 15.2,fontWeight: FontWeight.bold,)
                        ),new Container(
                          height: 200.0,child: new ListView(
                            children: <Widget>[
                              new RaisedButton(
                                onPressed: null,child: new Text("text button"),new Padding(padding: new EdgeInsets.all(5.00)),new RaisedButton(
                                onPressed: null,child: new Text("text button 2"),)
                            ],)
                      ]
                  )
              ),);
          }
        }

但是对于Container来说它需要一个高度,我需要它来占据屏幕的其余部分.

解决方法

new column(
    children: <Widget>[
        new Text('LISTA',style: new TextStyle(
            fontSize: 15.2,)),new Expanded(
            child: new Container(
                decoration: new BoxDecoration(color: Colors.bluE),height: 200.0,child: new ListView(
                    children: <Widget>[
                        new RaisedButton(
                            onPressed: null,new RaisedButton(
                            onPressed: null,)
                    ],)
        )
    ]
)

大佬总结

以上是大佬教程为你收集整理的mobile – Flutter – 位于另一个小部件下方的列表视图全部内容,希望文章能够帮你解决mobile – Flutter – 位于另一个小部件下方的列表视图所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。