comfortablePlatformDensity property
VisualDensity
get
comfortablePlatformDensity
Returns a VisualDensity that is defaultTargetPlatform adaptive to VisualDensity.comfortable instead of to VisualDensity.compact.
For desktop platforms, this returns VisualDensity.comfortable, and for other platforms, it returns the default VisualDensity.standard.
This is a variant of the VisualDensity.adaptivePlatformDensity that returns VisualDensity.compact for desktop platforms.
The comfortable visual density is useful on desktop and desktop web laptops that have touch screens as it keeps touch targets a bit larger than when using compact.
Implementation
static VisualDensity get comfortablePlatformDensity {
switch (defaultTargetPlatform) {
case TargetPlatform.android:
case TargetPlatform.iOS:
case TargetPlatform.fuchsia:
break;
case TargetPlatform.linux:
case TargetPlatform.macOS:
case TargetPlatform.windows:
return VisualDensity.comfortable;
}
return VisualDensity.standard;
}