dropdown_button: Fix incorrect rounded when ghost button selected (#1011)

| Before | After |
| - | - |
| <img width="218" alt="SCR-20250625-psed"
src="https://github.com/user-attachments/assets/873db4e9-d169-4273-bee9-58332b41c00f"
/> | <img width="222" alt="SCR-20250625-prxz"
src="https://github.com/user-attachments/assets/48f8cb35-cd67-47ac-bbb9-2739e1aa16b9"
/> |
This commit is contained in:
Floyd Wang 2025-06-25 18:11:30 +08:00 committed by GitHub
parent 692ee83b61
commit f7d536531d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -109,9 +109,9 @@ impl Selectable for DropdownButton {
impl RenderOnce for DropdownButton { impl RenderOnce for DropdownButton {
fn render(self, _: &mut Window, _: &mut App) -> impl IntoElement { fn render(self, _: &mut Window, _: &mut App) -> impl IntoElement {
let is_ghost = self let rounded = self
.variant .variant
.map(|variant| variant.is_ghost()) .map(|variant| variant.is_ghost() && !self.selected)
.unwrap_or(false); .unwrap_or(false);
div() div()
@ -124,9 +124,9 @@ impl RenderOnce for DropdownButton {
.rounded(self.rounded) .rounded(self.rounded)
.border_corners(Corners { .border_corners(Corners {
top_left: true, top_left: true,
top_right: is_ghost, top_right: rounded,
bottom_left: true, bottom_left: true,
bottom_right: is_ghost, bottom_right: rounded,
}) })
.border_edges(Edges { .border_edges(Edges {
left: true, left: true,
@ -146,15 +146,15 @@ impl RenderOnce for DropdownButton {
.icon(IconName::ChevronDown) .icon(IconName::ChevronDown)
.rounded(self.rounded) .rounded(self.rounded)
.border_edges(Edges { .border_edges(Edges {
left: is_ghost, left: rounded,
top: true, top: true,
right: true, right: true,
bottom: true, bottom: true,
}) })
.border_corners(Corners { .border_corners(Corners {
top_left: is_ghost, top_left: rounded,
top_right: true, top_right: true,
bottom_left: is_ghost, bottom_left: rounded,
bottom_right: true, bottom_right: true,
}) })
.selected(self.selected) .selected(self.selected)