This error means you cannot use the property color
along with the decoration.color
...
Examples
Paint a Container
Container(
color: Colors.red,
width:100,
height: 100
)
Create a Container
with rounded edges
Container(
decoration: BoxDecoration(
borderRadius: new BorderRadius.only(
topLeft: const Radius.circular(40.0),
topRight: const Radius.circular(40.0)
)
)
Explanation
The Container
owned the property Color
to make things easier for us, so we don’t need to create a BoxDecoration
just to change the color...
But when we need to change more things in the Container
we need to create the BoxDecoration
and then Flutter asks us to use the property color
of BoxDecoration
, because otherwise the Widget "would be confused" on where to pick up your color.
So whenever you need to, for example, create a Container
blue with rounded edges make:
Container(
decoration: BoxDecoration(
color: Colors.blue,
borderRadius: new BorderRadius.only(
topLeft: const Radius.circular(40.0),
topRight: const Radius.circular(40.0)
)
)
You could post the code so we can analyze it better ?
– Marcelo L