简体   繁体   中英

Flutter Wrap ListView.builder Horizontal

Widget build(BuildContext context) {
    return Container(
      child: ListView.builder(
        shrinkWrap: true,
        scrollDirection: Axis.horizontal,
        itemCount: data[1].store.length,
        itemBuilder: (BuildContext context, int index) {
          return Wrap(
            children: [
              Text(data[1].store[index].number.toString()),
            ],
          );
        },
      ),
    );
  }

I used ListView.builder, I want to wrap Horizontal & scroll Vertical,. I spend a lot of time on this stack...

My data from local JSON, with Future Builder and return to ListView.builder...

please see attach..

Thanks All...

在模拟器中调试

Replace your Container with the below code.

 SingleChildScrollView(
    child: Column(
          children: [
            Wrap(
              children: List<Widget>.generate(
                1000,
                (int index) {
                  return Text(index.toString() + ' ');
                },
              ),
            )
          ],
        )),

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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