bool _handleScrollNotification(ScrollNotification notification)
        {
            if (!widget.notificationPredicate(notification))
            {
                return(false);
            }

            if (notification is OverscrollNotification)
            {
                _GlowController        controller    = null;
                OverscrollNotification _notification = notification as OverscrollNotification;
                if (_notification.overscroll < 0.0f)
                {
                    controller = _leadingController;
                }
                else if (_notification.overscroll > 0.0f)
                {
                    controller = _trailingController;
                }
                else
                {
                    D.assert(false, () => "over scroll cannot be 0.0f.");
                }

                bool isLeading = controller == _leadingController;
                if (_lastNotificationType != typeof(OverscrollNotification))
                {
                    OverscrollIndicatorNotification confirmationNotification =
                        new OverscrollIndicatorNotification(leading: isLeading);
                    confirmationNotification.dispatch(context);
                    _accepted[isLeading] = confirmationNotification._accepted;
                }

                D.assert(controller != null);
                D.assert(_notification.metrics.axis() == widget.axis);
                if (_accepted[isLeading])
                {
                    if (_notification.velocity != 0.0f)
                    {
                        D.assert(_notification.dragDetails == null);
                        controller.absorbImpact(_notification.velocity.abs());
                    }
                    else
                    {
                        D.assert(_notification.overscroll != 0.0f);
                        if (_notification.dragDetails != null)
                        {
                            D.assert(_notification.dragDetails.globalPosition != null);
                            RenderBox renderer = (RenderBox)_notification.context.findRenderObject();
                            D.assert(renderer != null);
                            D.assert(renderer.hasSize);
                            Size   size     = renderer.size;
                            Offset position = renderer.globalToLocal(_notification.dragDetails.globalPosition);
                            switch (_notification.metrics.axis())
                            {
                            case Axis.horizontal:
                                controller.pull(_notification.overscroll.abs(), size.width,
                                                position.dy.clamp(0.0f, size.height), size.height);
                                break;

                            case Axis.vertical:
                                controller.pull(_notification.overscroll.abs(), size.height,
                                                position.dx.clamp(0.0f, size.width), size.width);
                                break;
                            }
                        }
                    }
                }
            }
            else if (notification is ScrollEndNotification || notification is ScrollUpdateNotification)
            {
                if ((notification as ScrollEndNotification).dragDetails != null)
                {
                    _leadingController.scrollEnd();
                    _trailingController.scrollEnd();
                }
            }

            _lastNotificationType = notification.GetType();
            return(false);
        }
 public static bool defaultScrollNotificationPredicate(ScrollNotification notification)
 {
     return(notification.depth == 0);
 }