Beispiel #1
0
        bool _handleScrollNotification(ScrollNotification notification)
        {
            ScrollMetrics metrics = notification.metrics;

            if (metrics.maxScrollExtent <= metrics.minScrollExtent)
            {
                return(false);
            }

            if (notification is ScrollUpdateNotification ||
                notification is OverscrollNotification)
            {
                if (_fadeoutAnimationController.status != AnimationStatus.forward)
                {
                    _fadeoutAnimationController.forward();
                }
                _fadeoutTimer?.cancel();
                _painter.update(notification.metrics, notification.metrics.axisDirection);
            }
            else if (notification is ScrollEndNotification)
            {
                if (_dragScrollbarPositionY == null)
                {
                    _startFadeoutTimer();
                }
            }
            return(false);
        }
Beispiel #2
0
        bool _handleScrollNotification(ScrollNotification notification)
        {
            ScrollMetrics metrics = notification.metrics;

            if (metrics.maxScrollExtent <= metrics.minScrollExtent)
            {
                return(false);
            }
            if (!_useCupertinoScrollbar.Value &&
                (notification is ScrollUpdateNotification ||
                 notification is OverscrollNotification))
            {
                if (_fadeoutAnimationController.status != AnimationStatus.forward)
                {
                    _fadeoutAnimationController.forward();
                }

                _materialPainter.update(
                    notification.metrics,
                    notification.metrics.axisDirection
                    );
                if (!widget.isAlwaysShown)
                {
                    _fadeoutTimer?.cancel();
                    _fadeoutTimer = Timer.create(ScrollbarUtils._kScrollbarTimeToFade, () => {
                        _fadeoutAnimationController.reverse();
                        _fadeoutTimer = null;
                    });
                }
            }
            return(false);
        }