RectangleComponent.fromRect constructor
RectangleComponent.fromRect(})
This factory will create a RectangleComponent from a positioned Rect.
Implementation
factory RectangleComponent.fromRect(
Rect rect, {
Vector2? scale,
double? angle,
Anchor anchor = Anchor.topLeft,
int? priority,
Paint? paint,
List<Paint>? paintLayers,
ComponentKey? key,
List<Component>? children,
}) {
return RectangleComponent(
position: anchor == Anchor.topLeft
? rect.topLeft.toVector2()
: Anchor.topLeft.toOtherAnchorPosition(
rect.topLeft.toVector2(),
anchor,
rect.size.toVector2(),
),
size: rect.size.toVector2(),
scale: scale,
angle: angle,
anchor: anchor,
priority: priority,
paint: paint,
paintLayers: paintLayers,
key: key,
children: children,
);
}