我尝试将 RefreshIndicator 与 NotificationListener 一起使用,但它不起作用。
基本上我希望分页和拉动刷新都在同一屏幕上工作。
提前致谢!
最佳答案
您基本上必须将 RefreshIndicator
放入 NotificationListener
中。
示例:
return NotificationListener<ScrollEndNotification>(
onNotification: (scrollEnd) {
final metrics = scrollEnd.metrics;
if (metrics.atEdge) {
bool isTop = metrics.pixels == 0;
if (!isTop) {
loadMessages();
}
}
return true;
},
child: RefreshIndicator(
onRefresh: () async => setFutures(),
child: SingleChildScrollView(
child: MessagesFeed(
loadMore: loadMessages,
key: _messageFeedKey,
messages: snapshot.data!,
answers: false,
messageId: -1,
),
),
)
);
关于flutter - 当我使用NotificationListener时,RefreshIndicator在flutter中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/70603838/