improv: use the new menu column widget

This commit is contained in:
Ashley Wulber 2026-07-08 18:27:28 -04:00 • committed by Jacob Kauffmann
parent 6a19629f15
commit 05f09fe33c
3 changed files with 30 additions and 24 deletions

View file

@ -388,7 +388,12 @@ impl<M: From<Message> + Send + 'static> Common<M> {
let mut other = *other_rect; let mut other = *other_rect;
other.x += x; other.x += x;
other.y += y; other.y += y;
let rad = CornerRadius {
top_left: 8,
top_right: 8,
bottom_left: 8,
bottom_right: 8,
};
rects.append(&mut rounded_rect_strips(other, rad)); rects.append(&mut rounded_rect_strips(other, rad));
} }

View file

@ -24,7 +24,8 @@ use cosmic::iced::platform_specific::shell::wayland::commands::subsurface::repos
use cosmic::iced::runtime::core::window::Id as SurfaceId; use cosmic::iced::runtime::core::window::Id as SurfaceId;
use cosmic::iced::runtime::platform_specific::wayland::subsurface::SctkSubsurfaceSettings; use cosmic::iced::runtime::platform_specific::wayland::subsurface::SctkSubsurfaceSettings;
use cosmic::iced::{ use cosmic::iced::{
self, Alignment, Background, Border, Length, Point, Rectangle, Size, Subscription, window, self, Alignment, Background, Border, Color, Length, Point, Rectangle, Size, Subscription,
window,
}; };
use cosmic::widget::{id_container, text}; use cosmic::widget::{id_container, text};
use cosmic::{Element, executor, surface, theme, widget}; use cosmic::{Element, executor, surface, theme, widget};
@ -537,7 +538,7 @@ impl App {
let dropdown_menu = |items: Vec<_>| { let dropdown_menu = |items: Vec<_>| {
let item_cnt = items.len(); let item_cnt = items.len();
let items = widget::column::with_children(items); let items = widget::menu::menu_column::MenuColumn::with_children(items);
let items = if item_cnt > 7 { let items = if item_cnt > 7 {
Element::from( Element::from(
widget::scrollable(items) widget::scrollable(items)

View file

@ -14,7 +14,6 @@ use cosmic::iced::runtime::platform_specific::wayland::subsurface::SctkSubsurfac
use cosmic::iced::{ use cosmic::iced::{
self, Alignment, Background, Border, Length, Point, Rectangle, Size, Subscription, self, Alignment, Background, Border, Length, Point, Rectangle, Size, Subscription,
}; };
use cosmic::widget::indeterminate_circular;
use cosmic::{Element, executor, surface, theme, widget}; use cosmic::{Element, executor, surface, theme, widget};
use cosmic_config::CosmicConfigEntry; use cosmic_config::CosmicConfigEntry;
use cosmic_greeter_daemon::{TimeAppletConfig, UserData}; use cosmic_greeter_daemon::{TimeAppletConfig, UserData};
@ -373,7 +372,7 @@ impl App {
let dropdown_menu = |items: Vec<_>| { let dropdown_menu = |items: Vec<_>| {
let item_cnt = items.len(); let item_cnt = items.len();
let items = widget::column::with_children(items); let items = widget::menu::menu_column::MenuColumn::with_children(items);
let items = if item_cnt > 7 { let items = if item_cnt > 7 {
Element::from( Element::from(
widget::scrollable(items) widget::scrollable(items)
@ -383,7 +382,8 @@ impl App {
Element::from(items) Element::from(items)
}; };
let menu = widget::container(items) let menu: widget::Container<'_, Message, cosmic::prelude::Theme> =
widget::container(items)
.padding(1) .padding(1)
//TODO: move style to libcosmic //TODO: move style to libcosmic
.class(theme::Container::custom(|theme| { .class(theme::Container::custom(|theme| {