From 571b190f07df4837ffa275df4c2a80089e8f599f Mon Sep 17 00:00:00 2001 From: Markus Aksli <68219924+markusaksli-nc@users.noreply.github.com> Date: Wed, 7 Oct 2020 23:32:03 +0300 Subject: [PATCH] Explained parent constraints in SizedBox (#66639) --- packages/flutter/lib/src/widgets/basic.dart | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/packages/flutter/lib/src/widgets/basic.dart b/packages/flutter/lib/src/widgets/basic.dart index f371a92169..220f78c238 100644 --- a/packages/flutter/lib/src/widgets/basic.dart +++ b/packages/flutter/lib/src/widgets/basic.dart @@ -2036,9 +2036,15 @@ class CustomMultiChildLayout extends MultiChildRenderObjectWidget { /// A box with a specified size. /// -/// If given a child, this widget forces its child to have a specific width -/// and/or height (assuming values are permitted by this widget's parent). If -/// either the width or height is null, this widget will try to size itself to +/// If given a child, this widget forces it to have a specific width and/or height. +/// These values will be ignored if this widget's parent does not permit them. +/// For example, this happens if the parent is the screen (forces the child to +/// be the same size as the parent), or another [SizedBox] (forces its child to +/// have a specific width and/or height). This can be remedied by wrapping the +/// child [SizedBox] in a widget that does permit it to be any size up to the +/// size of the parent, such as [Center] or [Align]. +/// +/// If either the width or height is null, this widget will try to size itself to /// match the child's size in that dimension. If the child's size depends on the /// size of its parent, the height and width must be provided. /// @@ -2079,6 +2085,8 @@ class CustomMultiChildLayout extends MultiChildRenderObjectWidget { /// * [FittedBox], which sizes and positions its child widget to fit the parent /// according to a given [BoxFit] discipline. /// * The [catalog of layout widgets](https://flutter.dev/widgets/layout/). +/// * [Understanding constraints](https://flutter.dev/docs/development/ui/layout/constraints), +/// an in-depth article about layout in Flutter. class SizedBox extends SingleChildRenderObjectWidget { /// Creates a fixed size box. The [width] and [height] parameters can be null /// to indicate that the size of the box should not be constrained in