mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
Make RRect immutable and replace RRect.setRectXY with a fromRectXY constructor
This commit is contained in:
parent
5ea50bf485
commit
bf74bac537
@ -151,8 +151,8 @@ class _RenderCheckbox extends RenderToggleable {
|
||||
// Create an inner rectangle to cover inside of rectangle. This is needed to avoid
|
||||
// painting artefacts caused by overlayed paintings.
|
||||
Rect innerRect = rect.deflate(1.0);
|
||||
ui.RRect rrect = new ui.RRect()
|
||||
..setRectXY(rect, _kEdgeRadius, _kEdgeRadius);
|
||||
ui.RRect rrect = new ui.RRect.fromRectXY(
|
||||
rect, _kEdgeRadius, _kEdgeRadius);
|
||||
|
||||
// Outline of the empty rrect
|
||||
paint.style = ui.PaintingStyle.stroke;
|
||||
|
||||
@ -124,8 +124,8 @@ class _RenderSwitch extends RenderToggleable {
|
||||
Rect rect = new Rect.fromLTWH(offset.dx,
|
||||
offset.dy + _kSwitchHeight / 2.0 - _kTrackHeight / 2.0, _kTrackWidth,
|
||||
_kTrackHeight);
|
||||
ui.RRect rrect = new ui.RRect()
|
||||
..setRectXY(rect, _kTrackRadius, _kTrackRadius);
|
||||
ui.RRect rrect = new ui.RRect.fromRectXY(
|
||||
rect, _kTrackRadius, _kTrackRadius);
|
||||
canvas.drawRRect(rrect, paint);
|
||||
|
||||
if (_radialReaction != null)
|
||||
|
||||
@ -949,7 +949,7 @@ class BoxPainter {
|
||||
canvas.drawRect(rect, _backgroundPaint);
|
||||
} else {
|
||||
double radius = _getEffectiveBorderRadius(rect);
|
||||
canvas.drawRRect(new ui.RRect()..setRectXY(rect, radius, radius), _backgroundPaint);
|
||||
canvas.drawRRect(new ui.RRect.fromRectXY(rect, radius, radius), _backgroundPaint);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -1043,8 +1043,8 @@ class BoxPainter {
|
||||
double width = _decoration.border.top.width;
|
||||
double radius = _getEffectiveBorderRadius(rect);
|
||||
|
||||
ui.RRect outer = new ui.RRect()..setRectXY(rect, radius, radius);
|
||||
ui.RRect inner = new ui.RRect()..setRectXY(rect.deflate(width), radius - width, radius - width);
|
||||
ui.RRect outer = new ui.RRect.fromRectXY(rect, radius, radius);
|
||||
ui.RRect inner = new ui.RRect.fromRectXY(rect.deflate(width), radius - width, radius - width);
|
||||
canvas.drawDRRect(outer, inner, new Paint()..color = color);
|
||||
}
|
||||
|
||||
|
||||
@ -587,7 +587,7 @@ class RenderClipRRect extends RenderProxyBox {
|
||||
void paint(PaintingContext context, Offset offset) {
|
||||
if (child != null) {
|
||||
Rect rect = offset & size;
|
||||
ui.RRect rrect = new ui.RRect()..setRectXY(rect, xRadius, yRadius);
|
||||
ui.RRect rrect = new ui.RRect.fromRectXY(rect, xRadius, yRadius);
|
||||
context.paintChildWithClipRRect(child, offset.toPoint(), rect, rrect);
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user