展开的小部件在空间可用时不会扩展

问题描述 投票:0回答:1

我正在创建一个ListView.builder,其中包含FireBase数据库中的每个“帖子”。一个帖子中必须包含3个部分;发布标题,发布文字,发布照片(如果用户包含)。我正在尝试在此代码下设计此模式。

<< img src =“ https://image.soinside.com/eyJ1cmwiOiAiaHR0cHM6Ly9pLmltZ3VyLmNvbS9yMVg0ZkVMLnBuZyJ9” alt =“没有调试油漆”>“

return Container(
            decoration: BoxDecoration(
              border: Border(
                bottom: BorderSide(color: Colors.grey, width: 1.0),
              ),
            ),
            child: Row(
              crossAxisAlignment: CrossAxisAlignment.start,
              children: <Widget>[
                Expanded(
                  child: Container(
                    child: Column(
                      crossAxisAlignment: CrossAxisAlignment.stretch,
                      children: <Widget>[
                        Text(
                          document['postTitle'].toUpperCase(),
                          textAlign: TextAlign.center,
                          style: TextStyle(
                            fontSize: 18.0,
                            fontWeight: FontWeight.bold,
                          ),
                        ),
                        SizedBox(
                          height: 10.0,
                        ),
                        Text(document['postText']),
                      ],
                    ),
                  ),
                ),
                Container(
                  width: 100.0,
                  height: 100.0,
                  child: document['postPhoto'] != null
                      ? Image.network(
                          asyncSnapShot.data,
                          fit: BoxFit.fill,
                        )
                      : null,
                ),
              ],
            ),
          );

我希望发布的文字遍布可用空间。

flutter flutter-layout
1个回答
-1
投票

您可以尝试使用此软件包https://pub.dev/packages/drop_cap_text,也许可以解决您的问题。

© www.soinside.com 2019 - 2024. All rights reserved.