向上/向下滚动时ListView滞后

问题描述 投票:4回答:1

我不知道问题是在我的代码中还是在ListView中。看看我的最终(编辑)代码here

我正在进行分页。当我到达最后一页并向上/向下滚动ListView时,滚动变得迟钝。我认为可能会因为这条线而发生。

    leading: CircleAvatar(backgroundImage: NetworkImage(arrayOfProducts[index]['thumbnail'] ?? "")),

NetworkImage可能需要时间来加载图像。不确定,但我认为滞后是由它引起的。所以我添加了新的包cached_network_image并将我的代码更改为:

    leading: CircleAvatar(child: CachedNetworkImage(
                      imageUrl: arrayOfProducts[index]['thumbnail'] ?? "",
                      placeholder: new CircularProgressIndicator(),
                      errorWidget: new Icon(Icons.error),
                    )),

但它仍然是滞后的,以前的图像现在在滚动时被隐藏。

listview dart flutter
1个回答
1
投票

当使用图像时,这是Flutter中的一个已知问题:Link to Issue

© www.soinside.com 2019 - 2024. All rights reserved.