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

Adding padding to a container which contains a checkbox causes the checkbox text to dissapear #2677

Open
4 tasks done
Adam-Ladd opened this issue Nov 28, 2024 · 0 comments
Open
4 tasks done
Labels
bug Something isn't working

Comments

@Adam-Ladd
Copy link

Is your issue REALLY a bug?

  • My issue is indeed a bug!
  • I am not crazy! I will not fill out this form just to ask a question or request a feature. Pinky promise.

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?

When I add padding to a container with a checkbox inside the text of the checkbox disappears

e.g.

use iced;

#[derive(Default)]
struct State {
   is_checked: bool,
}

#[derive(Debug, Clone)]
enum Message {
    Toggled(bool),
}

fn view(state: &State) -> iced::Element<'_, Message> {
    let paid_checkbox = {
        let checkbox = iced::widget::checkbox("test", state.is_checked).on_toggle(Message::Toggled);
        iced::widget::container(checkbox).center_y(30)
    };
    
    // paid_checkbox.into()                                     // checkbox text shows
    paid_checkbox.padding(10).into()                  // checkbox text doesn't show

}

fn update(state: &mut State, message: Message) {
    match message {
        Message::Toggled(is_checked) => {
            state.is_checked = is_checked;
        }
    }
}

fn main() -> iced::Result {
    iced::run("test", update, view)
}

What is the expected behavior?

I expect adding padding to add padding around the checkbox text not remove it

Version

crates.io release

Operating System

Linux

Do you have any log output?

No response

@Adam-Ladd Adam-Ladd added the bug Something isn't working label Nov 28, 2024
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

No branches or pull requests

1 participant