1

我需要创建这样的东西(我说的是占位符的右侧):

在此处输入图像描述

我写了下一个代码:

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

          ),
        ),
      ],
    ),
  )
  );

但结果是: 在此处输入图像描述

4

1 回答 1

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,
                  ),
                ),
              ],
            ),
          ),
        );
      },
    );
}
于 2019-10-15T10:17:10.583 回答