Flutter Text控件,换行无效问题

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

1.附代码,参考注释部分的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/

上一篇:Webots入门(二)-build up a controller


下一篇:toggleRowExpansion实现表格的展开和收起功能(Element的table组件,展开行 type=“expand“ )