颤振项目中的主色板错误

时间:2021-07-14 16:27:50

标签: android flutter dart

enter image description here

当我选择颜色时有一条红线,我认为他无法识别所选的颜色

1 个答案:

答案 0 :(得分:0)

primarySwatch 需要一个 MaterialColor

ThemeData

Turn any color to Material Color for flutter

Map<int, Color> color = {
  50:Color.fromRGBO(136,14,79, .1),
  100:Color.fromRGBO(136,14,79, .2),
  200:Color.fromRGBO(136,14,79, .3),
  300:Color.fromRGBO(136,14,79, .4),
  400:Color.fromRGBO(136,14,79, .5),
  500:Color.fromRGBO(136,14,79, .6),
  600:Color.fromRGBO(136,14,79, .7),
  700:Color.fromRGBO(136,14,79, .8),
  800:Color.fromRGBO(136,14,79, .9),
  900:Color.fromRGBO(136,14,79, 1),
};


MaterialColor colorCustom = MaterialColor(0xFF880E4F, color);

theme: ThemeData(
  primarySwatch: colorCustom,
  bottomAppBarColor: colorCustom
),

Example