可用空间不足时,展开的小部件不会展开

时间:2019-10-20 12:01:50

标签: flutter flutter-layout

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

without debug paint with debug paing

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

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

1 个答案:

答案 0 :(得分:-1)

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

相关问题