如何在列内创建页眉,正文,页脚?

时间:2019-10-15 10:09:52

标签: flutter

我需要创建类似这样的内容(我正在谈论palceholder的右侧):

enter image description here

我写了下一个代码:

Card(
      child: Container(
    child: Row(
      crossAxisAlignment: CrossAxisAlignment.start,
      children: <Widget>[
        Placeholder(
          fallbackHeight: 100,
          fallbackWidth: 100,
        ),
        Container(
          padding: EdgeInsets.only(left: 8, right: 8),
          child: Column(
            children: <Widget>[
             SizedBox(
               child: Text("Header"),
             ),
             Flexible(child: Text("Body"), flex: 2),
             Text("Footer"),
            ]

          ),
        ),
      ],
    ),
  )
  );

但是结果是: enter image description here

1 个答案:

答案 0 :(得分:1)

//更新

 @override
  Widget build(BuildContext context) {

    double _deviceHeight = MediaQuery.of(context).size.height;

    return ListView.builder(
      itemCount: filmListList.length,
      itemBuilder: (BuildContext context, int index) {
        return Container(
          height: _deviceHeight,
          child: Card(
            child: Column(
              children: <Widget>[
                Flexible(
                  flex: 1,
                  child: Container(
                    color: Colors.red,
                  ),
                ),
                Flexible(
                  flex: 8,
                  child: Container(
                    color: Colors.yellow,
                  ),
                ),
                Flexible(
                  flex: 1,
                  child: Container(
                    color: Colors.green,
                  ),
                ),
              ],
            ),
          ),
        );
      },
    );
}