flutter Notification冒泡通知机制
发布日期:2021-05-10 13:59:04 浏览次数:19 分类:精选文章

本文共 3338 字,大约阅读时间需要 11 分钟。

Flutter Notification������������������������

���������������������������������������InheritedWidget������������������������������ widget ��������������������������������������������������������� Notification ������������������������������������������������������������������������������Notification���������������������������Flutter��������������������������������������������������� widget ������������������


���������Notification���������������

Notification ���Flutter ������������������������������������ widget ��������������������������������������������������������� widget ��������������������������������������� NotificationListener ������������������������������������������������������������������������������������������ ���������������Notification Bubbling������


���������������������

��������������������������������������������������������������������������������������������������������������������� widget ���������������������������������������������������������������������������������������������

  • ���������
    • ������������������������������������������������������������������������������
    • ��������������� widget ���������������������

������������������������������������������

������ Flutter ������������������������������������������

1. ������������������ ListView���

  • ��������������������� ListView��������������������������������������������������������������� ScrollNotification������
  • ������������������������������ NotificationListener ���������������������������������������������������������

2. ���������������������

  • ��������������������������������������������������� widget ��������������� widget ������������������������
  • ������������������������������������������������������������������

������������������ NotificationListener

������������������������������������������������ NotificationListener���

class MyNotificationListener extends NotificationListener {
void onNotification(final Notification notification, final BuildContext context) {
// ������������
if (notification is ScrollNotification) {
// ������������������
}
// ���������������������
super.onNotification(notification, context);
}
}

������������������������������������������������������������������������������������������������������������������������������������������������ListView������������������


��������� InheritedWidget ���������

InheritedWidget ��� Notification ������������������������������������������������������

  • InheritedWidget���������������������������������������������������
  • Notification��������������������������������������������� widget ���������������

���������������������Flutter��� widget ���������������������������������������������������������������������������������


������

������������������������������������ Flutter ��� Notification ��������������������������������������������������������������������������������������������������������������������� widget ������������������������������������������������������������������������Notifications ������������������������������������������������������������

��������������������������������������������� Flutter ��������������������������������������������������������������������������������������������������������������������������������������� Notification ���������������������������������������������

上一篇:flutter InheritedWidget 组件的用法详解
下一篇:flutter 基于Timer实现的倒计时以及周期性任务

发表评论

最新留言

关注你微信了!
[***.104.42.241]2025年04月21日 13时11分27秒