Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
466 views
in Technique[技术] by (71.8m points)

flutter中ListView设置了Axis.horizontal,高度如何自适应

Container(
          height: 413,
          margin: EdgeInsets.only(left: 36),
          child: ListView.builder(
            scrollDirection: Axis.horizontal,
            itemCount: goodsList.length,
            padding: EdgeInsets.zero,
            itemBuilder: (context, position) {
              return Container(
                margin: EdgeInsets.only(right: 30),
                width: 260,
                child: RowCardItem(
                  cardData: goodsList[position],
                  imgHeight: 260,
                  imgWidth: 260,
                ),
              );
            },
          ),
        )

不想给外层Container设定高度,想让高度随内容自适应


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
          shrinkWrap: true,

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
...