-
-
Notifications
You must be signed in to change notification settings - Fork 4k
Core Checkbox #19665
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
base: main
Are you sure you want to change the base?
Core Checkbox #19665
Conversation
|
||
fn checkbox_on_key_input( | ||
mut ev: On<FocusedInput<KeyboardInput>>, | ||
q_checkbox: Query<(&CoreCheckbox, Has<Checked>, Has<InteractionDisabled>)>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a reason for querying for Has<InteractedDisabled>
instead of using a Without<InteractionDisabled
filter, or is it just stylistic?
display: Display::Flex, | ||
flex_direction: FlexDirection::Row, | ||
justify_content: JustifyContent::FlexStart, | ||
align_items: AlignItems::Center, | ||
align_content: AlignContent::Center, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These constraints don't do anything?
display: Display::Flex, | |
flex_direction: FlexDirection::Row, | |
justify_content: JustifyContent::FlexStart, | |
align_items: AlignItems::Center, | |
align_content: AlignContent::Center, | |
align_items: AlignItems::Center, |
Node { | ||
display: Display::Flex, | ||
width: Val::Px(16.0), | ||
height: Val::Px(16.0), | ||
border: UiRect::all(Val::Px(2.0)), | ||
..default() | ||
}, | ||
BorderColor::all(CHECKBOX_OUTLINE), // Border color for the checkbox | ||
BorderRadius::all(Val::Px(3.0)), | ||
children![ | ||
// Checkbox inner | ||
( | ||
Node { | ||
display: Display::Flex, | ||
width: Val::Px(8.0), | ||
height: Val::Px(8.0), | ||
position_type: PositionType::Absolute, | ||
left: Val::Px(2.0), | ||
top: Val::Px(2.0), | ||
..default() | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Node { | |
display: Display::Flex, | |
width: Val::Px(16.0), | |
height: Val::Px(16.0), | |
border: UiRect::all(Val::Px(2.0)), | |
..default() | |
}, | |
BorderColor::all(CHECKBOX_OUTLINE), // Border color for the checkbox | |
BorderRadius::all(Val::Px(3.0)), | |
children![ | |
// Checkbox inner | |
( | |
Node { | |
display: Display::Flex, | |
width: Val::Px(8.0), | |
height: Val::Px(8.0), | |
position_type: PositionType::Absolute, | |
left: Val::Px(2.0), | |
top: Val::Px(2.0), | |
..default() | |
}, | |
Node { | |
width: Val::Px(16.0), | |
height: Val::Px(16.0), | |
border: UiRect::all(Val::Px(2.0)), | |
padding: UiRect::all(Val::Px(2.0)), | |
..default() | |
}, | |
BorderColor::all(CHECKBOX_OUTLINE), // Border color for the checkbox | |
BorderRadius::all(Val::Px(3.0)), | |
children![ | |
// Checkbox inner | |
( | |
Node { | |
flex_grow: 1., | |
..default() | |
}, |
Objective
This is part of the "core widgets" effort: #19236.
Solution
This adds the "core checkbox" widget type.
Testing
Tested using examples core_widgets and core_widgets_observers.
Note to reviewers: I reorganized the code in the examples, so the diffs are large because of code moves.