Unverified Commit 89204384 authored by Shi-Hao Hong's avatar Shi-Hao Hong Committed by GitHub

`child` param doc update in Ink and Ink.image (#35211)

* Add doc suggesting Container for BoxDecorations that have no child widget
parent a1d3edc4
......@@ -110,11 +110,14 @@ class Ink extends StatefulWidget {
///
/// The [height] and [width] values include the [padding].
///
/// The `color` argument is a shorthand for `decoration: new
/// BoxDecoration(color: color)`, which means you cannot supply both a `color`
/// and a `decoration` argument. If you want to have both a `color` and a
/// `decoration`, you can pass the color as the `color` argument to the
/// `BoxDecoration`.
/// The `color` argument is a shorthand for
/// `decoration: BoxDecoration(color: color)`, which means you cannot supply
/// both a `color` and a `decoration` argument. If you want to have both a
/// `color` and a `decoration`, you can pass the color as the `color`
/// argument to the `BoxDecoration`.
///
/// If there is no intention to render anything on this decoration, consider
/// using a [Container] with a [BoxDecoration] instead.
Ink({
Key key,
this.padding,
......@@ -127,7 +130,7 @@ class Ink extends StatefulWidget {
assert(decoration == null || decoration.debugAssertIsValid()),
assert(color == null || decoration == null,
'Cannot provide both a color and a decoration\n'
'The color argument is just a shorthand for "decoration: new BoxDecoration(color: color)".'
'The color argument is just a shorthand for "decoration: BoxDecoration(color: color)".'
),
decoration = decoration ?? (color != null ? BoxDecoration(color: color) : null),
super(key: key);
......@@ -136,13 +139,16 @@ class Ink extends StatefulWidget {
/// a [Material].
///
/// This argument is a shorthand for passing a [BoxDecoration] that has only
/// its [BoxDecoration.image] property set to the [new Ink] constructor. The
/// its [BoxDecoration.image] property set to the [Ink] constructor. The
/// properties of the [DecorationImage] of that [BoxDecoration] are set
/// according to the arguments passed to this method.
///
/// The `image` argument must not be null. The `alignment`, `repeat`, and
/// `matchTextDirection` arguments must not be null either, but they have
/// default values.
/// The `image` argument must not be null. If there is no
/// intention to render anything on this image, consider using a
/// [Container] with a [BoxDecoration.image] instead.
///
/// The `alignment`, `repeat`, and `matchTextDirection` arguments must not
/// be null either, but they have default values.
///
/// See [paintImage] for a description of the meaning of these arguments.
Ink.image({
......@@ -194,8 +200,8 @@ class Ink extends StatefulWidget {
/// constructor: set the `color` argument instead of the `decoration`
/// argument.
///
/// A shorthand for specifying just an image is also available using the [new
/// Ink.image] constructor.
/// A shorthand for specifying just an image is also available using the
/// [Ink.image] constructor.
final Decoration decoration;
/// A width to apply to the [decoration] and the [child]. The width includes
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment