Commit 528ff0f1 authored by Adam Barth's avatar Adam Barth

onPressed not called when in a Positioned Flex

We were setting the main axis extent to zero because we had a sign error.

Fixes #918
parent ff74d9ec
......@@ -420,16 +420,16 @@ class RenderFlex extends RenderBox with ContainerRenderObjectMixin<RenderBox, Fl
betweenSpace = 0.0;
switch (_direction) {
case FlexDirection.horizontal:
size = constraints.constrain(new Size(-_overflow, crossSize));
size = constraints.constrain(new Size(_overflow, crossSize));
crossSize = size.height;
assert(size.width >= -_overflow);
remainingSpace = size.width - -_overflow;
assert(size.width >= _overflow);
remainingSpace = size.width - _overflow;
break;
case FlexDirection.vertical:
size = constraints.constrain(new Size(crossSize, -_overflow));
size = constraints.constrain(new Size(crossSize, _overflow));
crossSize = size.width;
assert(size.height >= -_overflow);
remainingSpace = size.height - -_overflow;
assert(size.height >= _overflow);
remainingSpace = size.height - _overflow;
break;
}
_overflow = 0.0;
......
import 'package:sky/widgets.dart';
import 'package:test/test.dart';
import 'widget_tester.dart';
void main() {
test('Can hit test flex children of stacks', () {
WidgetTester tester = new WidgetTester();
bool didReceiveTap = false;
tester.pumpFrame(() {
return new Container(
decoration: const BoxDecoration(
backgroundColor: const Color(0xFF00FF00)
),
child: new Stack([
new Positioned(
top: 10.0,
left: 10.0,
child: new Column([
new GestureDetector(
onTap: () {
didReceiveTap = true;
},
child: new Container(
decoration: const BoxDecoration(
backgroundColor: const Color(0xFF0000FF)
),
width: 100.0,
height: 100.0,
child: new Center(
child: new Text('X')
)
)
)
])
)
])
);
});
tester.tap(tester.findText('X'));
expect(didReceiveTap, isTrue);
});
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment