Beispiel #1
0
 public override Widget buildToolbar(BuildContext context, Rect globalEditableRegion, Offset position,
                                     TextSelectionDelegate selectionDelegate)
 {
     return(new ConstrainedBox(
                constraints: BoxConstraints.tight(globalEditableRegion.size),
                child: new CustomSingleChildLayout(
                    layoutDelegate: new _TextSelectionToolbarLayout(
                        MediaQuery.of(context).size,
                        globalEditableRegion,
                        position
                        ),
                    child: new _TextSelectionToolbar(
                        handleCut: this.canCut(selectionDelegate)
                     ? () => this.handleCut(selectionDelegate)
                     : (VoidCallback)null,
                        handleCopy: this.canCopy(selectionDelegate)
                     ? () => this.handleCopy(selectionDelegate)
                     : (VoidCallback)null,
                        handlePaste: this.canPaste(selectionDelegate)
                     ? () => this.handlePaste(selectionDelegate)
                     : (VoidCallback)null,
                        handleSelectAll: this.canSelectAll(selectionDelegate)
                     ? () => this.handleSelectAll(selectionDelegate)
                     : (VoidCallback)null
                        )
                    )
                ));
 }
Beispiel #2
0
        public override Widget build(BuildContext context)
        {
            D.assert(MaterialD.debugCheckHasMaterial(context));
            ThemeData themeData = Theme.of(context);
            Size      size;

            switch (this.widget.materialTapTargetSize ?? themeData.materialTapTargetSize)
            {
            case MaterialTapTargetSize.padded:
                size = new Size(2 * Constants.kRadialReactionRadius + 8.0f,
                                2 * Constants.kRadialReactionRadius + 8.0f);
                break;

            case MaterialTapTargetSize.shrinkWrap:
                size = new Size(2 * Constants.kRadialReactionRadius, 2 * Constants.kRadialReactionRadius);
                break;

            default:
                throw new Exception("Unknown material tap target size");
            }

            BoxConstraints additionalConstraints = BoxConstraints.tight(size);

            return(new _RadioRenderObjectWidget(
                       selected: this.widget.value == this.widget.groupValue,
                       activeColor: this.widget.activeColor ?? themeData.toggleableActiveColor,
                       inactiveColor: this._getInactiveColor(themeData),
                       onChanged: this._enabled ? this._handleChanged : (ValueChanged <bool?>)null,
                       additionalConstraints: additionalConstraints,
                       vsync: this
                       ));
        }
Beispiel #3
0
        public override Widget buildToolbar(
            BuildContext context,
            Rect globalEditableRegion,
            Offset position,
            TextSelectionDelegate selectionDelegate
            )
        {
            float availableHeight
                = globalEditableRegion.top - MediaQuery.of(context).padding.top - CustomTextSelectionControlsUtils._kToolbarScreenPadding;
            _ArrowDirection direction = availableHeight > CustomTextSelectionControlsUtils._kToolbarHeight
                ? _ArrowDirection.down
                : _ArrowDirection.up;

            float y = direction == _ArrowDirection.up
                ? globalEditableRegion.height + CustomTextSelectionControlsUtils._kToolbarHeight + 6.0f
                : 0.0f;

            return(new ConstrainedBox(
                       constraints: BoxConstraints.tight(globalEditableRegion.size),
                       child: new CustomSingleChildLayout(
                           layoutDelegate: new _TextSelectionToolbarLayout(
                               MediaQuery.of(context).size,
                               globalEditableRegion,
                               new Offset(position.dx, position.dy + y)
                               ),
                           child: new _TextSelectionToolbar(
                               handleCut: this.canCut(selectionDelegate) ? () => this.handleCut(selectionDelegate) : (VoidCallback)null,
                               handleCopy: this.canCopy(selectionDelegate) ? () => this.handleCopy(selectionDelegate) : (VoidCallback)null,
                               handlePaste: this.canPaste(selectionDelegate) ? () => this.handlePaste(selectionDelegate) : (VoidCallback)null,
                               handleSelectAll: this.canSelectAll(selectionDelegate) ? () => this.handleSelectAll(selectionDelegate) : (VoidCallback)null,
                               arrowDirection: direction
                               )
                           )
                       ));
        }
Beispiel #4
0
        public override void performLayout(Size size)
        {
            float  columnCardX      = size.width / 5.0f;
            float  columnCardWidth  = size.width - columnCardX;
            float  columnCardHeight = size.height / this.cardCount;
            float  rowCardWidth     = size.width;
            Offset offset           = this.translation.alongSize(size);
            float  columnCardY      = 0.0f;
            float  rowCardX         = -(this.selectedIndex * rowCardWidth);

            float columnTitleX  = size.width / 10.0f;
            float rowTitleWidth = size.width * ((1 + this.tCollapsed) / 2.25f);
            float rowTitleX     = (size.width - rowTitleWidth) / 2.0f - this.selectedIndex * rowTitleWidth;

            const float paddedSectionIndicatorWidth = AnimationWidgetsUtils.kSectionIndicatorWidth + 8.0f;
            float       rowIndicatorWidth           = paddedSectionIndicatorWidth +
                                                      (1.0f - this.tCollapsed) * (rowTitleWidth - paddedSectionIndicatorWidth);
            float rowIndicatorX = (size.width - rowIndicatorWidth) / 2.0f - this.selectedIndex * rowIndicatorWidth;

            for (int index = 0; index < this.cardCount; index++)
            {
                Rect   columnCardRect = Rect.fromLTWH(columnCardX, columnCardY, columnCardWidth, columnCardHeight);
                Rect   rowCardRect    = Rect.fromLTWH(rowCardX, 0.0f, rowCardWidth, size.height);
                Rect   cardRect       = this._interpolateRect(columnCardRect, rowCardRect).shift(offset);
                string cardId         = $"card{index}";
                if (this.hasChild(cardId))
                {
                    this.layoutChild(cardId, BoxConstraints.tight(cardRect.size));
                    this.positionChild(cardId, cardRect.topLeft);
                }

                Size   titleSize         = this.layoutChild($"title{index}", BoxConstraints.loose(cardRect.size));
                float  columnTitleY      = columnCardRect.centerLeft.dy - titleSize.height / 2.0f;
                float  rowTitleY         = rowCardRect.centerLeft.dy - titleSize.height / 2.0f;
                float  centeredRowTitleX = rowTitleX + (rowTitleWidth - titleSize.width) / 2.0f;
                Offset columnTitleOrigin = new Offset(columnTitleX, columnTitleY);
                Offset rowTitleOrigin    = new Offset(centeredRowTitleX, rowTitleY);
                Offset titleOrigin       = this._interpolatePoint(columnTitleOrigin, rowTitleOrigin);
                this.positionChild($"title{index}", titleOrigin + offset);

                Size   indicatorSize         = this.layoutChild($"indicator{index}", BoxConstraints.loose(cardRect.size));
                float  columnIndicatorX      = cardRect.centerRight.dx - indicatorSize.width - 16.0f;
                float  columnIndicatorY      = cardRect.bottomRight.dy - indicatorSize.height - 16.0f;
                Offset columnIndicatorOrigin = new Offset(columnIndicatorX, columnIndicatorY);
                Rect   titleRect             = Rect.fromPoints(titleOrigin, titleSize.bottomRight(titleOrigin));
                float  centeredRowIndicatorX = rowIndicatorX + (rowIndicatorWidth - indicatorSize.width) / 2.0f;
                float  rowIndicatorY         = titleRect.bottomCenter.dy + 16.0f;
                Offset rowIndicatorOrigin    = new Offset(centeredRowIndicatorX, rowIndicatorY);
                Offset indicatorOrigin       = this._interpolatePoint(columnIndicatorOrigin, rowIndicatorOrigin);
                this.positionChild($"indicator{index}", indicatorOrigin + offset);

                columnCardY   += columnCardHeight;
                rowCardX      += rowCardWidth;
                rowTitleX     += rowTitleWidth;
                rowIndicatorX += rowIndicatorWidth;
            }
        }
Beispiel #5
0
        protected override void performLayout()
        {
            this._size = this.configuration.size;
            D.assert(this._size.isFinite);

            if (this.child != null)
            {
                this.child.layout(BoxConstraints.tight(this._size));
            }
        }
Beispiel #6
0
        protected override void performLayout()
        {
            D.assert(_rootTransform != null);
            _size = configuration.size;
            D.assert(_size.isFinite);

            if (child != null)
            {
                child.layout(BoxConstraints.tight(_size));
            }
        }
 public override Widget build(BuildContext context) {
     return new Material(
         child: new SingleChildScrollView(
             child: new Container(
                 width: 40.0f,
                 height: 40.0f,
                 constraints: BoxConstraints.tight(new Size(40, 600)),
                 color: AsScreenCanvas.CLColors.red,
                 child: new Center(child: new Text("Beijing"))
             )
         )
     );
 }
Beispiel #8
0
        public override Widget build(BuildContext context)
        {
            D.assert(material_.debugCheckHasMaterial(context));
            ThemeData themeData = Theme.of(context);
            Size      size;

            switch (widget.materialTapTargetSize ?? themeData.materialTapTargetSize)
            {
            case MaterialTapTargetSize.padded:
                size = new Size(2 * material_.kRadialReactionRadius + 8.0f,
                                2 * material_.kRadialReactionRadius + 8.0f);
                break;

            case MaterialTapTargetSize.shrinkWrap:
                size = new Size(2 * material_.kRadialReactionRadius, 2 * material_.kRadialReactionRadius);
                break;

            default:
                throw new Exception("Unknown target size: " + widget.materialTapTargetSize);
            }

            size += (widget.visualDensity ?? themeData.visualDensity).baseSizeAdjustment;
            BoxConstraints additionalConstraints = BoxConstraints.tight(size);

            return(new FocusableActionDetector(
                       actions: _actionMap,
                       focusNode: widget.focusNode,
                       autofocus: widget.autofocus,
                       enabled: enabled,
                       onShowFocusHighlight: _handleFocusHighlightChanged,
                       onShowHoverHighlight: _handleHoverChanged,
                       child: new Builder(
                           builder: (BuildContext _context) => {
                return new _CheckboxRenderObjectWidget(
                    value: widget.value,
                    tristate: widget.tristate,
                    activeColor: widget.activeColor ?? themeData.toggleableActiveColor,
                    checkColor: widget.checkColor ?? new Color(0xFFFFFFFF),
                    inactiveColor: enabled ? themeData.unselectedWidgetColor : themeData.disabledColor,
                    focusColor: widget.focusColor ?? themeData.focusColor,
                    hoverColor: widget.hoverColor ?? themeData.hoverColor,
                    onChanged: widget.onChanged,
                    additionalConstraints: additionalConstraints,
                    vsync: this,
                    hasFocus: _focused,
                    hovering: _hovering
                    );
            }
                           )
                       ));
        }
 RenderBox tap()
 {
     return(new RenderPointerListener(
                onPointerDown: this._handlePointerDown,
                behavior: HitTestBehavior.opaque,
                child: new RenderConstrainedBox(
                    additionalConstraints: BoxConstraints.tight(Size.square(100)),
                    child: new RenderDecoratedBox(
                        decoration: new BoxDecoration(
                            color: new Color(0xFF00FF00)
                            )
                        ))
                ));
 }
Beispiel #10
0
        Widget buildMaterialSwitch(BuildContext context)
        {
            D.assert(MaterialD.debugCheckHasMaterial(context));
            ThemeData theme  = Theme.of(context);
            bool      isDark = theme.brightness == Brightness.dark;

            Color activeThumbColor = this.widget.activeColor ?? theme.toggleableActiveColor;
            Color activeTrackColor = this.widget.activeTrackColor ?? activeThumbColor.withAlpha(0x80);

            Color inactiveThumbColor;
            Color inactiveTrackColor;

            if (this.widget.onChanged != null)
            {
                Color black32 = new Color(0x52000000); // Black with 32% opacity
                inactiveThumbColor = this.widget.inactiveThumbColor ??
                                     (isDark ? Colors.grey.shade400 : Colors.grey.shade50);
                inactiveTrackColor = this.widget.inactiveTrackColor ?? (isDark ? Colors.white30 : black32);
            }
            else
            {
                inactiveThumbColor = this.widget.inactiveThumbColor ??
                                     (isDark ? Colors.grey.shade800 : Colors.grey.shade400);
                inactiveTrackColor = this.widget.inactiveTrackColor ?? (isDark ? Colors.white10 : Colors.black12);
            }

            return(new _SwitchRenderObjectWidget(
                       dragStartBehavior: this.widget.dragStartBehavior,
                       value: this.widget.value,
                       activeColor: activeThumbColor,
                       inactiveColor: inactiveThumbColor,
                       activeThumbImage: this.widget.activeThumbImage,
                       inactiveThumbImage: this.widget.inactiveThumbImage,
                       activeTrackColor: activeTrackColor,
                       inactiveTrackColor: inactiveTrackColor,
                       configuration: ImageUtils.createLocalImageConfiguration(context),
                       onChanged: this.widget.onChanged,
                       additionalConstraints: BoxConstraints.tight(this.getSwitchSize(theme)),
                       vsync: this
                       ));
        }
 public override Widget build(BuildContext context)
 {
     return(new Positioned(
                left: 40.0f,
                bottom: 40.0f,
                child: new DragTarget <int>(
                    onAccept: obj => {
         Debug.Log("ON ACCEPTED ..." + obj);
         this.setState(() => { this.value += obj; });
     },
                    builder: (inner_context2, accepted, rejected) => {
         return new Container(
             width: 40.0f,
             height: 40.0f,
             constraints: BoxConstraints.tight(new Size(40, 40)),
             color: CLColors.red,
             child: new Center(child: new Text("" + this.value))
             );
     }
                    )
                ));
 }
Beispiel #12
0
        protected override void performLayout()
        {
            this._hasVisualOverflow = false;

            if (this._onstageChildCount == 0)
            {
                return;
            }

            this._resolve();
            D.assert(this._resolvedAlignment != null);

            // Same BoxConstraints as used by RenderStack for StackFit.expand.
            BoxConstraints nonPositionedConstraints = BoxConstraints.tight(this.constraints.biggest);

            RenderBox child = this._firstOnstageChild;

            while (child != null)
            {
                StackParentData childParentData = child.parentData as StackParentData;

                if (!childParentData.isPositioned)
                {
                    child.layout(nonPositionedConstraints, parentUsesSize: true);
                    childParentData.offset = this._resolvedAlignment.alongOffset(this.size - child.size as Offset);
                }
                else
                {
                    this._hasVisualOverflow =
                        RenderStack.layoutPositionedChild(child, childParentData, this.size, this._resolvedAlignment) ||
                        _hasVisualOverflow;
                }

                D.assert(child.parentData == childParentData);
                child = childParentData.nextSibling;
            }
        }
        public override Widget build(BuildContext context)
        {
            D.assert(MaterialD.debugCheckHasMaterial(context));
            ThemeData themeData = Theme.of(context);
            Size      size;

            switch (this.widget.materialTapTargetSize ?? themeData.materialTapTargetSize)
            {
            case MaterialTapTargetSize.padded:
                size = new Size(2 * Constants.kRadialReactionRadius + 8.0f,
                                2 * Constants.kRadialReactionRadius + 8.0f);
                break;

            case MaterialTapTargetSize.shrinkWrap:
                size = new Size(2 * Constants.kRadialReactionRadius, 2 * Constants.kRadialReactionRadius);
                break;

            default:
                throw new Exception("Unknown target size: " + this.widget.materialTapTargetSize);
            }

            BoxConstraints additionalConstraints = BoxConstraints.tight(size);

            return(new _CheckboxRenderObjectWidget(
                       value: this.widget.value,
                       tristate: this.widget.tristate,
                       activeColor: this.widget.activeColor ?? themeData.toggleableActiveColor,
                       checkColor: this.widget.checkColor ?? new Color(0xFFFFFFFF),
                       inactiveColor: this.widget.onChanged != null
                    ? themeData.unselectedWidgetColor
                    : themeData.disabledColor,
                       onChanged: this.widget.onChanged,
                       additionalConstraints: additionalConstraints,
                       vsync: this
                       ));
        }
Beispiel #14
0
        protected override void performLayout()
        {
            BoxConstraints constraints = this.constraints;

            _resolve();
            D.assert(_resolvedAlignment != null);
            _hasVisualOverflow = false;
            bool hasNonPositionedChildren = false;

            if (childCount == 0)
            {
                size = constraints.biggest;
                D.assert(size.isFinite);
                return;
            }

            float width  = constraints.minWidth;
            float height = constraints.minHeight;

            BoxConstraints nonPositionedConstraints = null;

            switch (fit)
            {
            case StackFit.loose:
                nonPositionedConstraints = constraints.loosen();
                break;

            case StackFit.expand:
                nonPositionedConstraints = BoxConstraints.tight(constraints.biggest);
                break;

            case StackFit.passthrough:
                nonPositionedConstraints = constraints;
                break;
            }
            D.assert(nonPositionedConstraints != null);

            RenderBox child = firstChild;

            while (child != null)
            {
                StackParentData childParentData = child.parentData as StackParentData;
                D.assert(childParentData != null);
                if (!childParentData.isPositioned)
                {
                    hasNonPositionedChildren = true;

                    child.layout(nonPositionedConstraints, parentUsesSize: true);

                    Size childSize = child.size;
                    width  = Mathf.Max(width, childSize.width);
                    height = Mathf.Max(height, childSize.height);
                }

                child = childParentData.nextSibling;
            }

            if (hasNonPositionedChildren)
            {
                size = new Size(width, height);
                D.assert(size.width == constraints.constrainWidth(width));
                D.assert(size.height == constraints.constrainHeight(height));
            }
            else
            {
                size = constraints.biggest;
            }

            D.assert(size.isFinite);

            child = firstChild;
            while (child != null)
            {
                StackParentData childParentData = child.parentData as StackParentData;

                if (!childParentData.isPositioned)
                {
                    childParentData.offset = _resolvedAlignment.alongOffset(size - child.size as Offset);
                }
                else
                {
                    _hasVisualOverflow = layoutPositionedChild(child, childParentData, size, _resolvedAlignment) || _hasVisualOverflow;
                }

                D.assert(child.parentData == childParentData);
                child = childParentData.nextSibling;
            }
        }
            public override Widget build(BuildContext context)
            {
                var entries = new List <OverlayEntry>();

                var entry_bg = new OverlayEntry(
                    inner_context => new Container(
                        color: CLColors.white
                        ));

                var entry = new OverlayEntry(
                    inner_context => new Positioned(
                        left: 0.0f,
                        bottom: 0.0f,
                        child: new GestureDetector(
                            onTap: () => { },
                            child: new Draggable <int>(
                                5,
                                child: new Container(
                                    color: CLColors.blue,
                                    width: 30.0f,
                                    height: 30.0f,
                                    constraints: BoxConstraints.tight(new Size(30, 30)),
                                    child: new Center(child: new Text("5"))
                                    ),
                                feedback: new Container(
                                    color: CLColors.green,
                                    width: 30.0f,
                                    height: 30.0f),
                                //maxSimultaneousDrags: 1,
                                childWhenDragging: new Container(
                                    color: CLColors.black,
                                    width: 30.0f,
                                    height: 30.0f,
                                    constraints: BoxConstraints.tight(new Size(30, 30))
                                    )
                                )
                            )
                        )
                    );

                var entry3 = new OverlayEntry(
                    inner_context => new Positioned(
                        left: 0.0f,
                        bottom: 40.0f,
                        child: new GestureDetector(
                            onTap: () => { },
                            child:
                            new Draggable <int>(
                                8,
                                child: new Container(
                                    color: CLColors.background4,
                                    width: 30.0f,
                                    height: 30.0f,
                                    constraints: BoxConstraints.tight(new Size(30, 30)),
                                    child: new Center(child: new Text("8")))
                                ,
                                feedback: new Container(
                                    color: CLColors.green,
                                    width: 30.0f,
                                    height: 30.0f),
                                maxSimultaneousDrags: 1,
                                childWhenDragging: new Container(
                                    color: CLColors.black,
                                    width: 30.0f,
                                    height: 30.0f,
                                    constraints: BoxConstraints.tight(new Size(30, 30))
                                    )
                                )
                            )
                        )
                    );

                var entry2 = new OverlayEntry(
                    inner_context => new DragTargetWidget()
                    );

                entries.Add(entry_bg);
                entries.Add(entry);
                entries.Add(entry2);
                entries.Add(entry3);

                return(new Container(
                           color: CLColors.white,
                           child: new Overlay(
                               initialEntries: entries
                               )
                           ));
            }
Beispiel #16
0
        protected override void performLayout()
        {
            this._hasVisualOverflow = false;
            bool hasNonPositionedChildren = false;

            if (this.childCount == 0)
            {
                this.size = this.constraints.biggest;
                return;
            }

            float width  = this.constraints.minWidth;
            float height = this.constraints.minHeight;

            BoxConstraints nonPositionedConstraints = null;

            switch (this.fit)
            {
            case StackFit.loose:
                nonPositionedConstraints = this.constraints.loosen();
                break;

            case StackFit.expand:
                nonPositionedConstraints = BoxConstraints.tight(this.constraints.biggest);
                break;

            case StackFit.passthrough:
                nonPositionedConstraints = this.constraints;
                break;
            }


            RenderBox child = this.firstChild;

            while (child != null)
            {
                StackParentData childParentData = (StackParentData)child.parentData;

                if (!childParentData.isPositioned)
                {
                    hasNonPositionedChildren = true;

                    child.layout(nonPositionedConstraints, parentUsesSize: true);

                    Size childSize = child.size;
                    width  = Mathf.Max(width, childSize.width);
                    height = Mathf.Max(height, childSize.height);
                }

                child = childParentData.nextSibling;
            }

            if (hasNonPositionedChildren)
            {
                this.size = new Size(width, height);
                D.assert(this.size.width == this.constraints.constrainWidth(width));
                D.assert(this.size.height == this.constraints.constrainHeight(height));
            }
            else
            {
                this.size = this.constraints.biggest;
            }

            child = this.firstChild;
            while (child != null)
            {
                StackParentData childParentData = (StackParentData)child.parentData;

                if (!childParentData.isPositioned)
                {
                    childParentData.offset = this._alignment.alongOffset(this.size - child.size);
                }
                else
                {
                    BoxConstraints childConstraints = new BoxConstraints();

                    if (childParentData.left != null && childParentData.right != null)
                    {
                        childConstraints =
                            childConstraints.tighten(
                                width: this.size.width - childParentData.right - childParentData.left);
                    }
                    else if (childParentData.width != null)
                    {
                        childConstraints = childConstraints.tighten(width: childParentData.width);
                    }

                    if (childParentData.top != null && childParentData.bottom != null)
                    {
                        childConstraints =
                            childConstraints.tighten(
                                height: this.size.height - childParentData.bottom - childParentData.top);
                    }
                    else if (childParentData.height != null)
                    {
                        childConstraints = childConstraints.tighten(height: childParentData.height);
                    }

                    child.layout(childConstraints, parentUsesSize: true);

                    float x;
                    if (childParentData.left != null)
                    {
                        x = childParentData.left.Value;
                    }
                    else if (childParentData.right != null)
                    {
                        x = this.size.width - childParentData.right.Value - child.size.width;
                    }
                    else
                    {
                        x = this._alignment.alongOffset(this.size - child.size).dx;
                    }

                    if (x < 0.0 || x + child.size.width > this.size.width)
                    {
                        this._hasVisualOverflow = true;
                    }

                    float y;
                    if (childParentData.top != null)
                    {
                        y = childParentData.top.Value;
                    }
                    else if (childParentData.bottom != null)
                    {
                        y = this.size.height - childParentData.bottom.Value - child.size.height;
                    }
                    else
                    {
                        y = this._alignment.alongOffset(this.size - child.size).dy;
                    }

                    if (y < 0.0 || y + child.size.height > this.size.height)
                    {
                        this._hasVisualOverflow = true;
                    }

                    childParentData.offset = new Offset(x, y);
                }

                D.assert(child.parentData == childParentData);
                child = childParentData.nextSibling;
            }
        }
Beispiel #17
0
        Widget buildMaterialSwitch(BuildContext context)
        {
            D.assert(material_.debugCheckHasMaterial(context));
            ThemeData theme  = Theme.of(context);
            bool      isDark = theme.brightness == Brightness.dark;

            Color activeThumbColor = widget.activeColor ?? theme.toggleableActiveColor;
            Color activeTrackColor = widget.activeTrackColor ?? activeThumbColor.withAlpha(0x80);
            Color hoverColor       = widget.hoverColor ?? theme.hoverColor;
            Color focusColor       = widget.focusColor ?? theme.focusColor;

            Color inactiveThumbColor;
            Color inactiveTrackColor;

            if (enabled)
            {
                Color black32 = new Color(0x52000000);
                inactiveThumbColor = widget.inactiveThumbColor ??
                                     (isDark ? Colors.grey.shade400 : Colors.grey.shade50);
                inactiveTrackColor = widget.inactiveTrackColor ?? (isDark ? Colors.white30 : black32);
            }
            else
            {
                inactiveThumbColor = widget.inactiveThumbColor ??
                                     (isDark ? Colors.grey.shade800 : Colors.grey.shade400);
                inactiveTrackColor = widget.inactiveTrackColor ?? (isDark ? Colors.white10 : Colors.black12);
            }

            return(new FocusableActionDetector(
                       actions: _actionMap,
                       focusNode: widget.focusNode,
                       autofocus: widget.autofocus,
                       enabled: enabled,
                       onShowFocusHighlight: _handleFocusHighlightChanged,
                       onShowHoverHighlight: _handleHoverChanged,
                       child: new Builder(
                           builder: (BuildContext subContext) => {
                return new _SwitchRenderObjectWidget(
                    dragStartBehavior: widget.dragStartBehavior,
                    value: widget.value,
                    activeColor: activeThumbColor,
                    inactiveColor: inactiveThumbColor,
                    hoverColor: hoverColor,
                    focusColor: focusColor,
                    activeThumbImage: widget.activeThumbImage,
                    onActiveThumbImageError: widget.onActiveThumbImageError,
                    inactiveThumbImage: widget.inactiveThumbImage,
                    onInactiveThumbImageError: widget.onInactiveThumbImageError,
                    activeTrackColor: activeTrackColor,
                    inactiveTrackColor: inactiveTrackColor,
                    configuration: ImageUtils.createLocalImageConfiguration(subContext),
                    onChanged: widget.onChanged,
                    additionalConstraints: BoxConstraints.tight(getSwitchSize(theme)),
                    hasFocus: _focused,
                    hovering: _hovering,
                    state: this
                    );
            }
                           )
                       ));
        }