visualDensity static method

Map<String, dynamic>? visualDensity(
  1. VisualDensity? density
)

Returns a VisualDensity from the specified string or map.

If the specified value is a string, then it is interpreted as follows:

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};
}