Flutter: Minimum height on horizontal list view

后端 未结 7 1077
鱼传尺愫
鱼传尺愫 2020-12-02 08:54

I\'m trying to create a horizontal scrolling list of items in Flutter, and I want that list to only take up the necessary height based on its children. By design “List

7条回答
  •  萌比男神i
    2020-12-02 09:04

    Use ConstrainedBox to set minHeight and maxHeight

    ConstrainedBox(
      constraints: new BoxConstraints(
        minHeight: 35.0,
        maxHeight: 160.0,
      ),
    
      child: new ListView(
        shrinkWrap: true,
        children: [
          new ListItem(),
          new ListItem(),
        ],
    
      ),
    )
    

提交回复
热议问题