I changed my SDK version for flutter to min , so that I can fix my code for null safety.
There is one issue that I don’t understand,
this line produces the following error:
The argument type 'Color?' can't be assigned to the parameter type 'Color' border: Border.all(color: Colors.grey, width: 1),
but if I change
Colors.grey with whatever value that doesn’t use
, it will work,
Colors.grey works perfectly fine.
What should I change here to keep using
You can use
0xFFE0E0E0 for grey.
To pick material colors you can use this tool.
To select a specific color from one of the swatches, index into the swatch using an integer for the specific color desired, as follows:
Color selection = Colors.green!; // Selects a mid-range green.
Each ColorSwatch constant is a color and can used directly. For example:
Container( color: Colors.blue, // same as Colors.blue or Colors.blue.shade500 )
Answered By – Simon Sot
Answer Checked By – Mary Flores (FlutterFixes Volunteer)