flutter 动态高度

Container(
      padding: EdgeInsets.only(left: 15, right: 15, top: 5),
      // height: 50,
      constraints: BoxConstraints(
        minHeight: 50,
        // maxHeight: 250
      ),
      // padding: EdgeInsets.all(15),
      child: IntrinsicHeight(

        child: Column(
          children: [
            Expanded(
                child: Row(
                  mainAxisAlignment: MainAxisAlignment.spaceBetween,
                  children: [
                    Expanded(
                        child: Row(
                          mainAxisAlignment: MainAxisAlignment.start,
                          crossAxisAlignment: CrossAxisAlignment.center,
                          children: [
                            Container(
                              constraints: BoxConstraints(
                                // minHeight: 50,
                                  maxWidth: 250
                              ),
                              child: Text(
                                "某某某公司",
                                style: TextStyle(
                                    fontSize: 17,
                                    color: Color(0xff444444),
                                    fontWeight: FontWeight.w600
                                ),
                                // softWrap: false,
                                // overflow: TextOverflow.ellipsis
                              ),
                            ),
                            SizedBox(width: 5,),
                            Center(
                              child: Image.asset("images/CMC_more.png",
                                package: "work_outside_c",
                                width: 8,
                                height: 12,),
                            )
                          ],
                        )
                    ),
                    SizedBox(width: 20,),
                    Text(getWanchengStatus(), style: TextStyle(
                        fontSize: 14,
                        color: getWanchengStatusColor(),
                        fontWeight: FontWeight.w600
                    ))
                  ],
                )
            ),
            Container(
              color: Color(0xffDDDDDD),
              // margin: EdgeInsets.only(left: 15, right: 15),
              height: 1,
            )
          ],
        ),
      ),
    )

IntrinsicHeight

constraints设置了最小高度

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

友情链接更多精彩内容