Answers for "UserScrollNotification in flutter"

0

UserScrollNotification in flutter

NotificationListener<ScrollNotification>(
  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.
)
Posted by: Guest on January-08-2021

Code answers related to "Dart"

Browse Popular Code Answers by Language