Container with color optimization

Summary

Context

Migration guide

Timeline

References

Summary

A new ColoredBox widget has been added to the framework,
and the Container widget has been optimized to use it
if a user specifies a color instead of a decoration.

Context

It is very common to use the Container widget as follows:

return

Container

color:

Colors

red

);

Previously, this code resulted in a widget hierarchy that used a
BoxDecoration to actually paint the background color.
The BoxDecoration widget covers many cases other than
just painting a background color,
and is not as efficient as the new ColoredBox widget,
which only paints a background color.

Migration guide