I want a colour for container but getting error while using colour.
my code:-
Container( color:Colors.red, width: 50, height: 50, decoration: BoxDecoration( borderRadius: BorderRadius.circular(50))),
CodePudding user response:
You can't use "color" and "decoration" at the same time. You need to pass the "color" parameter to the "BoxDecoration" widget like this:
Container(
width: 50,
height: 50,
decoration: BoxDecoration(
color:Colors.red,
borderRadius: BorderRadius.circular(50)
)
),
CodePudding user response:
You cannot add color to the container if you add decorations. The solution is to enter color into the decoration box as follows
Container(
width: 50,
height: 50,
decoration: BoxDecoration(color: Color.red)
)
CodePudding user response:
Please use color in BoxDecoration like this
Container( width: 50, height: 50, decoration: BoxDecoration( borderRadius: BorderRadius.circular(50),color:Colors.red,)),
CodePudding user response:
You can't give both colors and decoration to Container(). If you are looking to give color and decoration to Container, give color inside Boxdecoration
Container( width: 50, height: 50, decoration: BoxDecoration(color: Color.red) )
CodePudding user response:
Use color inside container directly to set the background for the children. If you use any decoration then it will conflict with outside color. In those case you need to give color inside decoration.