Skip to content

Commit

Permalink
🐛 fix: constraints is null before layout.
Browse files Browse the repository at this point in the history
  • Loading branch information
answershuto committed May 13, 2022
1 parent fbeacb9 commit e2b8e61
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions kraken/lib/src/css/render_style.dart
Expand Up @@ -639,9 +639,9 @@ class CSSRenderStyle
// Should ignore renderStyle of display inline when searching for ancestors to stretch width.
if (ancestorRenderStyle != null) {
// If parentElement is WidgetElement, should not search for ancestors and get maxWidth of constraints for logicalWidth.
if (ancestorRenderStyle.target.renderObjectManagerType == RenderObjectManagerType.FLUTTER_ELEMENT && renderBoxModel!.parent is RenderBox) {
RenderBox renderBox = renderBoxModel!.parent as RenderBox;
logicalWidth = renderBox.constraints.maxWidth;
RenderObject? renderObject = renderBoxModel!.parent as RenderObject;
if (ancestorRenderStyle.target.renderObjectManagerType == RenderObjectManagerType.FLUTTER_ELEMENT && renderObject is RenderBox && renderObject.hasSize) {
logicalWidth = renderObject.constraints.maxWidth;
} else {
logicalWidth = ancestorRenderStyle.contentBoxLogicalWidth;
}
Expand Down

0 comments on commit e2b8e61

Please sign in to comment.