Flutter Text控件,换行无效问题(Row-Column-Row-Text )

1.Row  - Column - Row - Text 嵌套情况下会出现这个问题

2.附代码,参考注释部分的Expanded使用,

Container(
        padding: EdgeInsets.all(2),
        decoration: BoxDecoration(
          color: Colors.black38,
        ),
        child: Row(
          children: [
            Container(
              padding: EdgeInsets.all(10),
              width: 100,
              height: 100,
              child: Image.network(
                value['propertyImg'],
                fit: BoxFit.cover,
              ),
            ),
            // 超出元素的父级元素采用 Expanded
            Expanded(
              child: Container(
                height: 98,
                child: Column(
                  crossAxisAlignment: CrossAxisAlignment.start,
                  children: [
                    Container(
                      child: Text24(
                        text: value['propertyName'],
                      ),
                    ),
                    Row(
                      crossAxisAlignment: CrossAxisAlignment.start,
                      mainAxisSize: MainAxisSize.min,
                      children: <Widget>[
                        // 超出文字 采用Expanded
                        Expanded(
                          child: Text16(
                            text: value['propertyDesc'],
                          ),
                        )
                      ],
                    ),
                  ],
                ),
              ),
            ),
          ],
        ),
      ),

 

源: https://www.tongbiao.xyz/

其他:https://blog.csdn.net/u014627313/article/details/102729213

 

posted on 2020-11-07 22:28  童彪  阅读(2955)  评论(0编辑  收藏  举报

导航