ListView嵌套ListView

162 阅读1分钟
    return Scaffold(
      body: ListView(
        scrollDirection: Axis.vertical,
        
        children: <Widget>[

          //....一些布局代码

          ListView.builder(
              itemCount: list.length,
              shrinkWrap: true, 
              physics: new NeverScrollableScrollPhysics(),
              itemBuilder: (context,index){
                return 
                //....一些布局代码
              },
            );
        ],
      )
    );

这次就最主要的是下面的代码,使得我们可以实现ListView嵌套ListView

shrinkWrap: true,                               //解决无限高度问题
physics: new NeverScrollableScrollPhysics(),        //禁用滑动事件