Shrink wrap when constraints are infinite.

This commit is contained in:
Andrew Wilson
2015-09-11 10:08:47 -07:00
parent 639f9d9b06
commit 380cfb265f
2 changed files with 18 additions and 2 deletions

View File

@@ -194,8 +194,9 @@ class RenderPositionedBox extends RenderShiftedBox {
markNeedsLayout();
}
bool get _shinkWrapWidth => _shrinkWrap == ShrinkWrap.width || _shrinkWrap == ShrinkWrap.both;
bool get _shinkWrapHeight => _shrinkWrap == ShrinkWrap.height || _shrinkWrap == ShrinkWrap.both;
// These are only valid during performLayout() and paint(), since they rely on constraints which is only set after layout() is called.
bool get _shinkWrapWidth => _shrinkWrap == ShrinkWrap.width || _shrinkWrap == ShrinkWrap.both || constraints.maxWidth == double.INFINITY;
bool get _shinkWrapHeight => _shrinkWrap == ShrinkWrap.height || _shrinkWrap == ShrinkWrap.both || constraints.maxHeight == double.INFINITY;
void performLayout() {
if (child != null) {

View File

@@ -0,0 +1,15 @@
import 'package:sky/widgets.dart';
import 'package:test/test.dart';
import 'widget_tester.dart';
void main() {
test('Can be placed in an infinte box', () {
WidgetTester tester = new WidgetTester();
tester.pumpFrame(() {
return new Block([new Center()]);
});
});
}