iced_aw
iced_aw copied to clipboard
Why does Grid insert spaces between narrow columns to the right of a wider column? (and how to avoid)
Hi, I'm trying to learn to use Grid
and GridRow
for text-alignment purposes.
When I use this code, it does what I expect:
fn view(&self) -> Element<Self::Message> {
let row = GridRow::with_elements(vec![
Text::new("x"),
Text::new("x"),
Text::new("x"),
Text::new("x"),
Text::new("longer string of text"),
]);
let grid = Grid::with_rows(vec![row]).column_width(Length::Fixed(5.0));
grid.into()
}
The cells are all together with no space between them. But if I move the cell with wider text from the last to the first like this:
let row = GridRow::with_elements(vec![
Text::new("longer string of text"),
Text::new("x"),
Text::new("x"),
Text::new("x"),
Text::new("x"),
]);
now I get this:
Now instead of the cells being together, they are spaced out. Why? Yes I have read the documentation but no I still don't understand the logic. In both cases I have set the width of all columns to a fixed value of 5. What if I want both the wider cell to be on the left and also for the cells to have no space between them? How can I accomplish that?
(Also this is just a single-row example, my use case has multiple rows so the standard iced Row
apparently will not meet my need for a grid.)
Thanks!