RenderListWheelViewport对象在布局期间被赋予了无限大小

时间:2020-04-29 06:57:36

标签: flutter dart delegates flutter-layout infinite

我正在使用ListWheelScrollView小部件使我的列表项具有滚轮效果,但出现上述错误。我只想在单独的列表项中显示带有一些图像和文本的堆叠项,并为它们提供3D Wheeling效果。

下面是我的代码->

class ExploreWidget extends StatefulWidget {
  @override
  State<StatefulWidget> createState() => _ExploreState();
}

class _ExploreState extends State<ExploreWidget> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: null,
      body: Column(
        children: <Widget>[
          _header(),
          _exploreList()
        ],
      )
    );

  }

  Widget _header(){
    return SizedBox(
      height: 200,
      width: 800,
    );

  }

  Widget _exploreList(){
    return ListWheelScrollView.useDelegate(
      itemExtent: 75,
      childDelegate: ListWheelChildBuilderDelegate(
        builder:(context,index){
          return Container(
            height: 500,
            width: 800,
            child: Stack(
              children: <Widget>[
                Image(image: AssetImage(
                  _products[index].image
                )),
                Text(_products[index].name,style: Style.sectionTitleWhite,),
                Text('70% off',style: Style.cardListTitleWhite,),
              ],
            ),
          );
        }
      ),
    );
  }

}

1 个答案:

答案 0 :(得分:1)

由于实现 import pandas as pd data = list() # data can be a dictionary df = pd.Dataframe(data) df.to_csv('filename', sep='give tab space here') 小部件的方式而发生错误。该窗口小部件包装在npm i react-export-excel内部,而该窗口自身不会滚动。此外,您将返回一个具有无限大小的npm ERR! Error while executing: npm ERR! C:\Program Files\Git\cmd\git.EXE ls-remote -h -t https://github.com/sec uredeveloper/js-xlsx.git npm ERR! npm ERR! undefined npm ERR! exited with error code: 128 npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\cdku7557807\AppData\Roaming\npm-cache\_logs\2020-04-28T08_ 43_29_238Z-debug.log 。因此,它抛出了上述错误。要解决此问题,请将_exploreList()小部件包装在Column内,这仅需要最小的可用空间即可呈现和滚动。下面的工作示例代码:

ScrollView

现在您应该能够正确使用_exploreList()

enter image description here