0

下面的代码代表我实现页面的方式,知道所有内容都在列表视图中,其他元素在顶部。

Container(
  height : productsProvider.allproductsList.isNotEmpty &&
           allproductsList.length != 2 &&
           allproductsList.length != 1
           ? allproductsList.length % 2 == 0
           ? (allproductsList.length /2) *(260)
           : ((allproductsList.length /2) *(265)) +(265)
           : 300,
  child : PageView(
            children : <Widget> [
              for( i < categorieslist )
                 child : Container(
                   child : GridVew.count(
                     children[ // my list of products]
                     )
                  )
             ]
          )

4

1 回答 1

0

如果你list of products的太长,你可能需要使用 builder 函数进行延迟加载。

这是长列表的示例ListViewhttps ://flutter.dev/docs/cookbook/lists/long-lists

这是文档GridView.builderhttps ://api.flutter.dev/flutter/widgets/GridView/GridView.builder.html

于 2020-10-13T06:58:11.267 回答