context menu: Adjust toggleable entry label alignment (#24549)

Previously, we were passing an `IconSize` that had a default size. Given
the check icon is small by default, when the entry is not toggled, that
caused a slight misalignment between the toggled and not-toggled items.
I'm passing now the same icon element but inside an opacity 0 div. Open
to other suggestions if this feels clunky.

| Before | After |
|--------|--------|
| <img width="946" alt="Screenshot 2025-02-10 at 7 58 28 AM"
src="https://github.com/user-attachments/assets/4d2b3f12-72c5-4c8d-acaf-c16230250560"
/> | <img width="943" alt="Screenshot 2025-02-10 at 7 58 37 AM"
src="https://github.com/user-attachments/assets/2df64752-7273-4bdc-9f6b-5153ed52c889"
/> |

Release Notes:

- N/A
This commit is contained in:
Danilo Leal 2025-02-10 08:19:58 -03:00 committed by GitHub
parent e72f7b4e22
commit d15a61a1aa
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -672,15 +672,16 @@ impl Render for ContextMenu {
*toggle, *toggle,
|list_item, (position, toggled)| { |list_item, (position, toggled)| {
let contents = if toggled { let contents = if toggled {
v_flex().flex_none().child( div().flex_none().child(
Icon::new(IconName::Check) Icon::new(IconName::Check)
.color(Color::Accent) .color(Color::Accent)
.size(*icon_size) .size(*icon_size)
) )
} else { } else {
v_flex().flex_none().size( div().flex_none().child(
IconSize::default().rems(), Icon::new(IconName::Check)
) .size(*icon_size)
).opacity(0.)
}; };
match position { match position {
IconPosition::Start => { IconPosition::Start => {