Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Length::Fill steals all the available space from other widgets #2186

Closed
2 tasks done
Exidex opened this issue Jan 5, 2024 · 1 comment · Fixed by #2192
Closed
2 tasks done

Length::Fill steals all the available space from other widgets #2186

Exidex opened this issue Jan 5, 2024 · 1 comment · Fixed by #2192
Labels
bug Something isn't working

Comments

@Exidex
Copy link
Contributor

Exidex commented Jan 5, 2024

Is there an existing issue for this?

  • I have searched the existing issues.

Is this issue related to iced?

  • My hardware is compatible and my graphics drivers are up-to-date.

What happened?

Using the following code, the text "doesn't show" is not present on the window

use iced::{Element, Length, Sandbox, Settings};
use iced::widget::{column, row, text, vertical_space};

pub fn main() -> iced::Result {
    App::run(Settings::default())
}

struct App;

impl Sandbox for App {
    type Message = ();

    fn new() -> Self {
        Self
    }

    fn title(&self) -> String {
        String::from("App")
    }

    fn update(&mut self, _: Self::Message) {
    }

    fn view(&self) -> Element<Self::Message> {
        let text1: Element<_> = text("text")
            .into();
        let text3: Element<_> = text("doesn't show")
            .into();

        let separator = vertical_space(Length::Fill)
            .into();

        let content: Element<_> = row(vec![text1, separator])
            .into();

        column(vec![content, text3])
            .into()
    }
}

What is the expected behavior?

I would expect it to use minimal possible space for the "doesn't show" text to show and place the widget on the bottom of the screen.

#1727 is possibly related but I felt like this is different use case

Version

crates.io release

Operating System

Linux

Do you have any log output?

No response

@Exidex Exidex added the bug Something isn't working label Jan 5, 2024
@hecrj
Copy link
Member

hecrj commented Jan 5, 2024

Currently, in order to get this to work, you need to set width(Length::Fill) both for the row and the column manually as well.

Coincidentally, I am currently working on a branch that fixes most of these inconsistencies.

quintenpalmer added a commit to quintenpalmer/protomusiq that referenced this issue Feb 15, 2024
This fixes an issue where Fill-width elements in the column would
disappear, maybe because of these issues:

iced-rs/iced#715
iced-rs/iced#2186
iced-rs/iced#2192
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants