Column width set to widest child

Hi everyone,

I’m new to both Rust and Iced and I’m hoping to get some help with creating a sidebar-like column of buttons on my UI. What I would like to achieve is a layout where the column’s width is dictated by the widest button, and the other buttons are expanded to fill the available horizontal space.

What I came up with so far (see screenshot and code), will either cause the sidebar to be as wide as the window (if each button has width(Length::Fill), which is commented out in the code snippet), or the column will be as wide as the widest button, but all the other buttons will not expand to fill the available horizontal space (I’d like to see the right edges aligned).

Is there a way to achieve this using Iced?

Thanks a bunch!

fn make_side_bar(&self) -> Element<Message> {
    let side_button = |tab, title| {
        button(text(title))
            .style(if self.active_tab == tab {
                Button::Primary
            } else {
                Button::Secondary
            })
            .on_press(Message::ActivateTab(tab))
            //.width(Length::Fill)
            .into()
    };

    let children: Vec<Element<_>> = vec![
        side_button(
            ActiveTab::Project,
            if let ProjectState::ProjectOpened(_) = self.project_state {
                "Project"
            } else {
                "Open"
            },
        ),
        side_button(ActiveTab::Encrypt, "Encrypt")
    ];

    Column::with_children(children).width(Length::Shrink).into()
}