From 50cc94d944ada88bf3d7fcd1d2741b7104b9b1d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A9ctor=20Ram=C3=B3n=20Jim=C3=A9nez?= Date: Tue, 22 Apr 2025 19:41:00 +0200 Subject: [PATCH] Fix even height distribution logic in `grid` widget --- widget/src/grid.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/widget/src/grid.rs b/widget/src/grid.rs index 26e741db..62471cfe 100644 --- a/widget/src/grid.rs +++ b/widget/src/grid.rs @@ -202,9 +202,10 @@ where let cell_height = match self.height { Sizing::AspectRatio(ratio) => Some(cell_width / ratio), Sizing::EvenlyDistribute(Length::Shrink) => None, - Sizing::EvenlyDistribute(_) => { - Some(available.height / total_rows as f32) - } + Sizing::EvenlyDistribute(_) => Some( + (available.height - self.spacing * (total_rows - 1) as f32) + / total_rows as f32, + ), }; let cell_limits = layout::Limits::new(