This adds 2 more cards in a flex, but...
I identified issues with z-index when 'free-forming' the position of items.
I also find the lack of drop support disturbing.
So I created issues for that.
https://github.com/domokit/sky_engine/issues/612 (drag/drop)
https://github.com/domokit/sky_engine/issues/613 (z-index)
diff --git a/lib/card.dart b/lib/card.dart
index ab0b11d..48d815e 100644
--- a/lib/card.dart
+++ b/lib/card.dart
@@ -65,7 +65,7 @@
}
void _onPointerMove(sky.Event e) {
- sky.GestureEvent ge = e as sky.GestureEvent;
+ sky.PointerEvent ge = e as sky.PointerEvent;
setState(() {
dx += ge.dx;
dy += ge.dy;
@@ -95,7 +95,7 @@
onPointerMove: _onPointerMove,
onPointerUp: _onPointerUp
),
- //padding: const EdgeDims.all(8.0),
+ padding: const EdgeDims.all(8.0),
//margin: const EdgeDims.symmetric(horizontal: 8.0),
decoration: new BoxDecoration(
backgroundColor: (this.scrolling ? const Color(0xFFFF0000) : const Color(0xFF0000FF)),
diff --git a/lib/main.dart b/lib/main.dart
index 6db808f..fb389e4 100644
--- a/lib/main.dart
+++ b/lib/main.dart
@@ -14,16 +14,20 @@
double dx = 0.0;
double dy = 0.0;
- Card c = new Card.fromString("classic h1");
-
Transform makeTransform() {
- return new Transform(
+ return new Container(
child: new MyButton(
child: new Text('Engage'),
onPressed: _handleOnPressedCallback,
onPointerDown: _handleOnPointerDownCallback,
onPointerMove: _handleOnPointerMoveCallback
),
+ padding: const EdgeDims.all(8.0),
+ //margin: const EdgeDims.symmetric(horizontal: 8.0),
+ decoration: new BoxDecoration(
+ backgroundColor: const Color(0xFF0000FF),
+ borderRadius: 5.0
+ ),
transform: new vector_math.Matrix4.identity().translate(dx, dy)
);
}
@@ -75,7 +79,11 @@
new Center(child: new Text('We did it!')),
new Center(child: new MyToolBar()),
makeTransform(),
- new CardComponent(c, true)
+ new Flex([
+ new CardComponent(new Card.fromString("classic h1"), true),
+ new CardComponent(new Card.fromString("classic sk"), true),
+ new CardComponent(new Card.fromString("classic d5"), true)
+ ])
], direction: FlexDirection.vertical));
}
}