pub struct VisualDensity {
pub horizontal: f32,
pub vertical: f32,
}Expand description
How compact the controls are — the reference’s VisualDensity.
Two numbers from −4 to 4, one per axis. Each step is four logical pixels on a control’s base size: a button at the compact density (−2, −2) is 8 px shorter than at the standard one, and its padding loses 8 px across. Zero is the standard density.
A theme carries one (Theme::visual_density). Unset,
it follows the theme’s platform as the reference’s does
(default_for_platform): standard on phones, compact
on the desktops, where a pointer is precise and a screen holds more.
Fields§
§horizontal: f32Across: negative is narrower.
vertical: f32Down: negative is shorter.
Implementations§
Source§impl VisualDensity
impl VisualDensity
Sourcepub const COMFORTABLE: Self
pub const COMFORTABLE: Self
A step tighter than standard on both axes.
Sourcepub const fn default_for_platform(platform: TargetPlatform) -> Self
pub const fn default_for_platform(platform: TargetPlatform) -> Self
The density a platform’s controls have: standard on Android, iOS and Fuchsia,
compact on Linux, macOS and Windows (theme_data.dart:3252).
Sourcepub fn base_size_adjustment(self) -> (f32, f32)
pub fn base_size_adjustment(self) -> (f32, f32)
What it adds to a control’s base size, in logical pixels: four per step, on
each axis (theme_data.dart:3307).