我正在学习可重复使用的自定义小工具.
在这里,我想创建一个默认灯光 colored颜色 为灰色的容器,但在应用Colors.grey.shade200时显示错误
看起来像是 colored颜色 .灰色是常量,但.shade200不是常量值
那么我们如何才能使用色调作为恒定的.
class RoundedContainer extends StatelessWidget {
final Color backgroundColor;
const RoundedContainer({
super.key,
this.backgroundColor= Colors.grey.shade200,//showing error
});