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
This commit is contained in:
@@ -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;
|
||||
|
||||
45
packages/unit/test/widget/flex_test.dart
Normal file
45
packages/unit/test/widget/flex_test.dart
Normal file
@@ -0,0 +1,45 @@
|
||||
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);
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user