Beispiel #1
0
        public override void didChangeDependencies()
        {
            base.didChangeDependencies();

            ThemeData theme = Theme.of(this.context);

            this._themeColor      = theme.highlightColor.withOpacity(1.0f);
            this._textDirection   = Directionality.of(this.context);
            this._materialPainter = this._BuildMaterialScrollbarPainter();
        }
Beispiel #2
0
        public static bool _hitTestInteractive(GlobalKey customPaintKey, Offset offset)
        {
            if (customPaintKey.currentContext == null)
            {
                return(false);
            }
            CustomPaint      customPaint = customPaintKey.currentContext.widget as CustomPaint;
            ScrollbarPainter painter     = customPaint.foregroundPainter as ScrollbarPainter;
            RenderBox        renderBox   = customPaintKey.currentContext.findRenderObject() as RenderBox;
            Offset           localOffset = renderBox.globalToLocal(offset);

            return(painter.hitTestInteractive(localOffset));
        }
Beispiel #3
0
 public override void didChangeDependencies()
 {
     base.didChangeDependencies();
     m_ScrollbarPainter = new ScrollbarPainter(
         ScrollbarColor,
         textDirection: TextDirection.ltr,
         ScrollbarThickness,
         fadeoutOpacityAnimation: this.m_FadeoutOpacityAnimation,
         ScrollbarMainAxisMargin,
         ScrollbarCrossAxisMargin,
         ScrollbarRadius,
         ScrollbarMinLength,
         ScrollbarMinOverscrollLength
         );
 }
Beispiel #4
0
 public override void didChangeDependencies()
 {
     base.didChangeDependencies();
     if (_painter == null)
     {
         _painter = _buildCupertinoScrollbarPainter(context);
     }
     else
     {
         _painter.textDirection = Directionality.of(context);
         _painter.color         = CupertinoDynamicColor.resolve(CupertinoScrollbarUtils._kScrollbarColor, context);
         _painter.padding       = MediaQuery.of(context).padding;
     }
     WidgetsBinding.instance.addPostFrameCallback((TimeSpan duration) => {
         if (widget.isAlwaysShown)
         {
             D.assert(widget.controller != null);
             widget.controller.position.didUpdateScrollPositionBy(0);
         }
     });
 }
Beispiel #5
0
        public override void didChangeDependencies()
        {
            base.didChangeDependencies();

            D.assert((() => {
                _useCupertinoScrollbar = null;
                return(true);
            }));

            ThemeData theme = Theme.of(context);

            switch (theme.platform)
            {
            case RuntimePlatform.IPhonePlayer:
            case RuntimePlatform.OSXPlayer:
            case RuntimePlatform.OSXEditor:
                _fadeoutTimer?.cancel();
                _fadeoutTimer = null;
                _fadeoutAnimationController.reset();
                _useCupertinoScrollbar = true;
                break;

            default:
                _themeColor            = theme.highlightColor.withOpacity(1.0f);
                _textDirection         = Directionality.of(context);
                _materialPainter       = _buildMaterialScrollbarPainter();
                _useCupertinoScrollbar = false;
                WidgetsBinding.instance.addPostFrameCallback((TimeSpan duration) => {
                    if (widget.isAlwaysShown)
                    {
                        D.assert(widget.controller != null);
                        widget.controller.position.didUpdateScrollPositionBy(0);
                    }
                });
                break;
            }

            D.assert(_useCupertinoScrollbar != null);
        }
Beispiel #6
0
 public override void didChangeDependencies()
 {
     base.didChangeDependencies();
     this._textDirection    = Directionality.of(context: this.context);
     this._scrollbarPainter = this._buildScrollbarPainter();
 }