From 07f99987432c0cd78861dc7b4ae595d1bd092599 Mon Sep 17 00:00:00 2001 From: Ian Hickson Date: Fri, 28 Oct 2016 20:33:03 -0700 Subject: [PATCH] Merge in all information from the layout models docs (#6588) This makes https://flutter.io/basic-widgets/#layout-models redundant with the dartdocs. --- packages/flutter/lib/src/widgets/basic.dart | 136 +++++++++++++++----- 1 file changed, 103 insertions(+), 33 deletions(-) diff --git a/packages/flutter/lib/src/widgets/basic.dart b/packages/flutter/lib/src/widgets/basic.dart index c2ec0ab096..0ca09edf56 100644 --- a/packages/flutter/lib/src/widgets/basic.dart +++ b/packages/flutter/lib/src/widgets/basic.dart @@ -1433,25 +1433,30 @@ class BlockBody extends MultiChildRenderObjectWidget { /// A widget that uses the stack layout algorithm for its children. /// -/// This class is useful if you want to overlap several children in a -/// simple way, for example having some text and an image, overlaid -/// with a gradient and a button attached to the bottom. +/// This class is useful if you want to overlap several children in a simple +/// way, for example having some text and an image, overlaid with a gradient and +/// a button attached to the bottom. /// -/// If you want to lay a number of children out in a particular -/// pattern, or if you want to make a custom layout manager, you -/// probably want to use [CustomMultiChildLayout] instead. In -/// particular, when using a Stack you can't position children -/// relative to their size or the stack's own size. +/// Each child of a [Stack] widget is either _positioned_ or _non-positioned_. +/// Positioned children are those wrapped in a [Positioned] widget that has at +/// least one non-null property. The stack sizes itself to contain all the +/// non-positioned children, which are positioned according to [alignment] +/// (which defaults to the top-left corner). The positioned children are then +/// placed relative to the stack according to their top, right, bottom, and left +/// properties. /// -/// For more details about the stack layout algorithm, see -/// [RenderStack]. To control the position of child widgets, see the -/// [Positioned] widget. +/// For more details about the stack layout algorithm, see [RenderStack]. +/// +/// If you want to lay a number of children out in a particular pattern, or if +/// you want to make a custom layout manager, you probably want to use +/// [CustomMultiChildLayout] instead. In particular, when using a [Stack] you +/// can't position children relative to their size or the stack's own size. /// /// See also: /// /// * [Flow] -/// * [Align] (which sizes itself based on its child's size and positions -/// the child according to a [FractionalOffset] value) +/// * [Align], which sizes itself based on its child's size and positions +/// the child according to a [FractionalOffset] value. /// * [CustomSingleChildLayout] /// * [CustomMultiChildLayout] class Stack extends MultiChildRenderObjectWidget { @@ -1497,6 +1502,10 @@ class Stack extends MultiChildRenderObjectWidget { } /// A [Stack] that shows a single child from a list of children. +/// +/// The displayed child is the one with the given [index]. +/// +/// For more details, see [Stack]. class IndexedStack extends Stack { /// Creates a [Stack] widget that paints a single child. /// @@ -1530,6 +1539,18 @@ class IndexedStack extends Stack { /// the [Positioned] widget to its enclosing [Stack] must contain only /// [StatelessWidget]s or [StatefulWidget]s (not other kinds of widgets, like /// [RenderObjectWidget]s). +/// +/// If a widget is wrapped in a [Positioned], then it is a _positioned_ widget +/// in its [Stack]. If the [top] property is non-null, the top edge of this child +/// will be positioned [top] layout units from the top of the stack widget. The +/// [right], [bottom], and [left] properties work analogously. +/// +/// If both the [top] and [bottom] properties are non-null, then the child will +/// be forced to have exactly the height required to satisfy both constraints. +/// Similarly, setting the [right] and [left] properties to non-null values will +/// force the child to have a particular width. Alternatively the [width] and +/// [height] properties can be used to give the dimensions, with one +/// corresponding position property (e.g. [top] and [height]). class Positioned extends ParentDataWidget { /// Creates a widget that controls where a child of a [Stack] is positioned. /// @@ -1877,17 +1898,34 @@ class GridPlacementData extends ParentDataWidget