简体   繁体   English

Flutter listview.builder上方的滚动轮播

[英]Flutter Scroll Carousel above listview.builder

I'd like to add carousel above in listview.builder but the scrolling only happens below in carousel, and the carousel is fixed我想在 listview.builder 上面添加轮播,但滚动只发生在轮播下面,并且轮播是固定的

// scroll carousel here // 在此处滚动轮播

new Expanded(
                child: new ListView.builder(
                    itemCount: 4,
                    itemBuilder: (BuildContext context, int index) {
                         return itemFeed(context: context, index: index);
                    }
                )
            )

You can use a Column to achieve this.您可以使用Column来实现此目的。 Remember to wrap the ListView.builder with a Expanded widget inside the Column .请记住在ListView.builder中使用Expanded小部件包装Column

Example -例子 -

Column(
      mainAxisSize: MainAxisSize.max,
      children: <Widget>[
        Container(
          height: 100.0,
          width: double.infinity,
          child: Text('Fixed Box'),
          color: Colors.pink,
        ),
        Expanded(
          child: ListView.builder(
            itemBuilder: (context, index) => Text("Index - " + index.toString()),
            itemCount: 100,
          ),
        )
      ],
    )

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM