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

我是从Flutter开始的,我遇到了一个我无法构建的布局,在一个可视化示例下面:

enter image description here

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

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,)
                    ],)
        )
    ]
)

相关文章

这篇文章主要讲解了“FlutterComponent动画的显和隐怎么实现...
这篇文章主要讲解了“flutter微信聊天输入框功能如何实现”,...
本篇内容介绍了“Flutter之Navigator的高级用法有哪些”的有...
这篇文章主要介绍“Flutter怎么使用Android原生播放器”,在...
Flutter开发的android端如何修改APP名称,logo,版本号,具体...
Flutter路由管理初识路由概念一.路由管理1.1.Route1.2.Mater...