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:
Adam Barth
2015-11-16 23:23:54 -08:00
parent 6f0464c006
commit c769d120c4
4 changed files with 132 additions and 12 deletions

View File

@@ -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)
)
);
}