fix(segmented_button): use correct divider color when vertical

This commit is contained in:
Jeremy Soller 2024-09-11 14:29:36 -06:00
parent 2faaeddb05
commit c497c227ce
No known key found for this signature in database
GPG key ID: D02FD439211AF56F
3 changed files with 15 additions and 8 deletions

View file

@ -39,7 +39,7 @@ pub fn focus<Message: 'static>(id: Id) -> Command<Message> {
pub enum ItemBounds {
Button(Entity, Rectangle),
Divider(Rectangle),
Divider(Rectangle, bool),
}
/// Isolates variant-specific behaviors from [`SegmentedButton`].
@ -1299,7 +1299,7 @@ where
ItemBounds::Button(entity, bounds) => (entity, bounds),
// Draw a divider between buttons
ItemBounds::Divider(bounds) => {
ItemBounds::Divider(bounds, accented) => {
renderer.fill_quad(
renderer::Quad {
bounds,
@ -1308,7 +1308,11 @@ where
},
{
let theme = crate::theme::active();
Background::Color(theme.cosmic().small_widget_divider().into())
if accented {
Background::Color(theme.cosmic().small_widget_divider().into())
} else {
Background::Color(theme.cosmic().primary_container_divider().into())
}
},
);