Image 如何将颜色与';A';在数字之前?
伙计们,我怎么能把像我附加在材质设计中的图片中的颜色,在代码中有“A”加入到我的颤振应用程序中呢Image 如何将颜色与';A';在数字之前?,image,flutter,dart,Image,Flutter,Dart,伙计们,我怎么能把像我附加在材质设计中的图片中的颜色,在代码中有“A”加入到我的颤振应用程序中呢 您可以使用以下代码,顺便说一句,0xff表示不透明度,后跟颜色的十六进制代码 color: Color(0xffeeff41), 无法将字符串/Char添加到材质颜色中。根据文件: /// Creates a color swatch with a variety of shades. /// /// The `primary` argument should be the 32 bi
您可以使用以下代码,顺便说一句,0xff表示不透明度,后跟颜色的十六进制代码
color: Color(0xffeeff41),
无法将
字符串/Char
添加到材质颜色中。根据文件:
/// Creates a color swatch with a variety of shades.
///
/// The `primary` argument should be the 32 bit ARGB value of one of the
/// values in the swatch, as would be passed to the [new Color] constructor
/// for that same color, and as is exposed by [value]. (This is distinct from
/// the specific index of the color in the swatch.)
const MaterialColor(int primary, Map<int, Color> swatch) : super(primary, swatch);
然后你可以像这样使用它:
teal[300]
或teal.shade300
字母“A”只是“重音”的缩写,应该用于浮动操作按钮和交互元素,例如:
- 文本字段和光标
- 文本选择
- 进度条
- 选择控件、按钮和滑块链接
如果我想使用前10种颜色,我可以写color:colors.lime[200],这是否意味着我需要从11开始对所有颜色使用十六进制代码?如果你说的是材质颜色,前面的“A”表示重音,那么对于A100,你可以使用color:colors.lightGreenAccent[100],同样对于A200,A300等。以下是材料设计颜色指南,供您参考。
static MaterialColor teal = MaterialColor(
0xFF009688, // default color, normally matches [500]
<int, Color>{
50: Color(0xFFE0F2F1),
100: Color(0xFFB2DFDB),
200: Color(0xFF80CBC4),
300: Color(0xFF4DB6AC),
400: Color(0xFF26A69A),
500: Color(0xFF009688), // same as primary
600: Color(0xFF00897B),
700: Color(0xFF00796B),
800: Color(0xFF00695C),
900: Color(0xFF004D40),
},
);
static MaterialAccentColor tealAccent = MaterialAccentColor(
0xFF64FFDA, // default color, normally matches [200]
<int, Color>{
100: Color(0xFFA7FFEB),
200: Color(0xFF64FFDA), // same as primary
400: Color(0xFF1DE9B6),
700: Color(0xFF00BFA5),
},
);