📜  Flutter 中的 UserScrollNotification - Dart 代码示例

📅  最后修改于: 2022-03-11 14:48:04.347000             🧑  作者: Mango

代码示例1
NotificationListener(
  onNotification: (ScrollNotification notification) {
    if (notification is UserScrollNotification) {
      if (notification.direction == ScrollDirection.forward) {
        // Handle scroll down.
      } else if (notification.direction == ScrollDirection.reverse) {
        // Handle scroll up.
      }
    }

    // Returning null (or false) to
    // "allow the notification to continue to be dispatched to further ancestors".
    return null;
  },
  child: ListView(..), // Or whatever scroll view you use.
)