defaultDensityForPlatform static method

VisualDensity defaultDensityForPlatform(
  1. TargetPlatform platform
)

Returns a VisualDensity that is adaptive based on the given platform.

For desktop platforms, this returns compact, and for other platforms, it returns a default-constructed VisualDensity.

See also:

Implementation

static VisualDensity defaultDensityForPlatform(TargetPlatform platform) {
  return switch (platform) {
    TargetPlatform.android || TargetPlatform.iOS || TargetPlatform.fuchsia => standard,
    TargetPlatform.linux || TargetPlatform.macOS || TargetPlatform.windows => compact,
  };
}