简体   繁体   English

Flutter Wrap ListView.builder 水平

[英]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,.我使用了 ListView.builder,我想包装 Horizo​​ntal & scroll Vertical,。 I spend a lot of time on this stack...我花了很多时间在这个堆栈上......

My data from local JSON, with Future Builder and return to ListView.builder...我的数据来自本地 JSON,使用 Future Builder 并返回到 ListView.builder...

please see attach..请看附件。。

Thanks All...谢谢大家...

在模拟器中调试

Replace your Container with the below code.用以下代码替换您的 Container。

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

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

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