Add a Positioned constructor from a Rect
A common pattern is to use a Positioned with a Sized box to give both an offset from the edge as well as a fixed size to the child. This patch rolls into into the Stack layout algorithm for simplicity. Fixes #250
This commit is contained in:
@@ -54,12 +54,10 @@ class Marker extends StatelessComponent {
|
||||
return new Positioned(
|
||||
left: position.x - size / 2.0,
|
||||
top: position.y - size / 2.0,
|
||||
width: size,
|
||||
height: size,
|
||||
child: new IgnorePointer(
|
||||
child: new Container(
|
||||
width: size,
|
||||
height: size,
|
||||
child: new CustomPaint(onPaint: paintMarker)
|
||||
)
|
||||
child: new CustomPaint(onPaint: paintMarker)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user