【发布时间】:2021-07-13 16:46:21
【问题描述】:
我是编程新手,我想为颤振容器小部件的颜色分配一个类属性。
Padding(
padding: EdgeInsets.only(left: 15),
child: Container(
width: 4,
height: 50,
color: Colors.driver.color,
),
),
我尝试这样做,但结果显示错误
The getter 'driver' isn't defined for the type 'Colors'.
这是来自模型文件
color: 'blue[800]',
如果我在文本小部件中使用它,它会完美运行
Text(
driver.points,
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.bold
),
),
【问题讨论】:
-
driver.color还不够吗?如果没有,您能否使用gist分享模型文件内容。
标签: flutter dart colors containers