visualDensity static method
Returns a VisualDensity from the specified string or map.
If the specified value is a string, then it is interpreted as follows:
adaptivePlatformDensity: returns VisualDensity.adaptivePlatformDensity (which varies by platform).comfortable: returns VisualDensity.comfortable.compact: returns VisualDensity.compact.standard: returns VisualDensity.standard.
Otherwise, if the specified value is a map, then the keys horizontal and
vertical (doubles) are used to create a custom VisualDensity. The
specified values must be in the range given by
VisualDensity.minimumDensity to VisualDensity.maximumDensity. Missing
values are interpreted as zero.
Implementation
static Map<String, dynamic>? visualDensity(VisualDensity? density) {
if (density == null) return null;
return {'horizontal': density.horizontal, 'vertical': density.vertical};
}