Visitar URL original
Colored box and container optimization by dnfield · Pull Request #50979 · flutter/flutter · GitHub
Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
add back assert
  • Loading branch information
dnfield committed Feb 18, 2020
commit 04d5eb1c806e90d9d79416148611f1a95bd4f547
9 changes: 9 additions & 0 deletions packages/flutter/lib/src/widgets/container.dart
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,11 @@ class Container extends StatelessWidget {
/// Creates a widget that combines common painting, positioning, and sizing widgets.
///
/// The `height` and `width` values include the padding.
///
/// The `color` and `decoration` arguments cannot both be supplied, since
/// it would potentially result in the decoration drawing over the background
/// color. To supply a decoration with a color, use `decoration: new

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

drop the new here since it is no optional?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

/// BoxDecoration(color: color)`.
Container({
Key key,
this.alignment,
Expand All @@ -312,6 +317,10 @@ class Container extends StatelessWidget {
assert(decoration == null || decoration.debugAssertIsValid()),
assert(constraints == null || constraints.debugAssertIsValid()),
assert(clipBehavior != null),
assert(color == null || decoration == null,
'Cannot provide both a color and a decoration\n'
'To provide both, use "decoration: new BoxDecoration(color: color)".'

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Don't need the new here?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

),
constraints =
(width != null || height != null)
? constraints?.tighten(width: width, height: height)
Expand Down