public override void applyParentData(RenderObject renderObject) { D.assert(renderObject.parentData is _ActionSheetActionButtonParentData); _ActionSheetActionButtonParentData parentData = renderObject.parentData as _ActionSheetActionButtonParentData; if (parentData.isPressed != this.isPressed) { parentData.isPressed = this.isPressed; AbstractNodeMixinDiagnosticableTree targetParent = renderObject.parent; if (targetParent is RenderObject) { ((RenderObject)targetParent).markNeedsPaint(); } } }
void _drawButtonBackgroundsAndDividersStacked(Canvas canvas, Offset offset) { Offset dividerOffset = new Offset(0.0f, this.dividerThickness); Path backgroundFillPath = new Path(); // fillType = PathFillType.evenOdd backgroundFillPath.addRect(Rect.fromLTWH(0.0f, 0.0f, this.size.width, this.size.height)); Path pressedBackgroundFillPath = new Path(); Path dividersPath = new Path(); Offset accumulatingOffset = offset; RenderBox child = this.firstChild; RenderBox prevChild = null; while (child != null) { D.assert(child.parentData is _ActionSheetActionButtonParentData); _ActionSheetActionButtonParentData currentButtonParentData = child.parentData as _ActionSheetActionButtonParentData; bool isButtonPressed = currentButtonParentData.isPressed; bool isPrevButtonPressed = false; if (prevChild != null) { D.assert(prevChild.parentData is _ActionSheetActionButtonParentData); _ActionSheetActionButtonParentData previousButtonParentData = prevChild.parentData as _ActionSheetActionButtonParentData; isPrevButtonPressed = previousButtonParentData.isPressed; } bool isDividerPresent = child != this.firstChild; bool isDividerPainted = isDividerPresent && !(isButtonPressed || isPrevButtonPressed); Rect dividerRect = Rect.fromLTWH( accumulatingOffset.dx, accumulatingOffset.dy, this.size.width, this._dividerThickness ); Rect buttonBackgroundRect = Rect.fromLTWH( accumulatingOffset.dx, accumulatingOffset.dy + (isDividerPresent ? this.dividerThickness : 0.0f), this.size.width, child.size.height ); if (isButtonPressed) { backgroundFillPath.addRect(buttonBackgroundRect); pressedBackgroundFillPath.addRect(buttonBackgroundRect); } if (isDividerPainted) { backgroundFillPath.addRect(dividerRect); dividersPath.addRect(dividerRect); } accumulatingOffset += (isDividerPresent ? dividerOffset : Offset.zero) + new Offset(0.0f, child.size.height); prevChild = child; child = this.childAfter(child); } canvas.drawPath(backgroundFillPath, this._buttonBackgroundPaint); canvas.drawPath(pressedBackgroundFillPath, this._pressedButtonBackgroundPaint); canvas.drawPath(dividersPath, this._dividerPaint); }