Cannot provide both a color and a decoration To provide both, use
"decoration: BoxDecoration(color: color)".
‘package:flutter/src/widgets/container.dart’: container.dart:1 Failed
assertion: line 273 pos 15: ‘color == null || decoration == null’
Widget build(BuildContext context) {
return Container(
padding: const EdgeInsets.all(15),
child: Text(title),
color: color,
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [
color.withOpacity(0.7),
color,
],
begin: Alignment.topLeft,
end: Alignment.bottomRight,
),
borderRadius: BorderRadius.circular(15),
),
);
}
3
Answers
You seem to have set a
decoration
already, so drop thecolor: color,
, because it’s not suported to do both.the error is self explanatory it says that when you are using decoration n the container you have to pass the color inside the decoration like this
}