Shrink wrap when constraints are infinite.
This commit is contained in:
@@ -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) {
|
||||
|
||||
15
packages/unit/test/widget/center_test.dart
Normal file
15
packages/unit/test/widget/center_test.dart
Normal 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()]);
|
||||
});
|
||||
});
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user