RefreshIndicator 上的列表未更新

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

加载刷新小部件后,屏幕上小部件上应显示的值列表不会更新。是什么原因造成的?通过热重载,它会更新,但是当手动强制该值时,它不会随下拉列表更新。

颤振代码:

  RefreshIndicator(
              onRefresh: () async {
                setState(() async {
                    lista= await getList(context);
                });
              },
              child: Container(
                      child: ListView.builder(
                          shrinkWrap: true,
                          itemCount: lista.length,
                          itemBuilder: (BuildContext context, int index) {
                            return getRow(lista[index]);
                          })),
                ),
flutter dart listview
1个回答
0
投票

更改刷新部分,如下所示

onRefresh: () async {
          var listItems = await getList(context);
          setState(() {
            lista = listItems ;
          });
© www.soinside.com 2019 - 2024. All rights reserved.