visualDensity static method

VisualDensity visualDensity(
  1. BuildContext context
)

The simulated visual density for the currently selected device.

Implementation

static VisualDensity visualDensity(BuildContext context) {
  final deviceType = context.select(
    (DevicePreviewStore store) => store.deviceInfo.identifier.type,
  );
  if (deviceType == DeviceType.desktop || deviceType == DeviceType.laptop) {
    return VisualDensity.compact;
  }
  return VisualDensity.standard;
}