TLDR
Do
ThemeData(primarySwatch: Colors.lime),
Don't
ThemeData(primarySwatch: Colors.lime.shade700),
primarySwatch is not one color. It's all the possible material shades.
If you look into ThemeData
's doc it says :
The primary color palette (the [primarySwatch]), chosen from
one of the swatches defined by the material design spec. This
should be one of the maps from the [Colors] class that do not
have "accent" in their name.
This implies that when needed the material component will use primary[500] but may also use other shades !
In fact, primarySwatch
is a shortcut to set a bunch of different colors :
- primaryColor
- primaryColorLight/Dark
- accentColor
- ...
But you can override them separatly depending on your needs, with a Color
(and not the MaterialColor
that primarySwatch requires)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…