其他分享
首页 > 其他分享> > Flutter Text控件,换行无效问题

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/

标签:控件,Container,Text,Expanded,value,children,child,Flutter,Row
来源: https://www.cnblogs.com/tongbiao/p/13942707.html