fix: padding, spacing, context menu style, and settings buttons
This commit is contained in:
parent
0a32d27c70
commit
941cbf546b
38 changed files with 694 additions and 538 deletions
|
|
@ -6,6 +6,7 @@ use std::{collections::HashMap, process, time::Duration};
|
|||
use cosmic::{
|
||||
app::Command,
|
||||
applet::{menu_button, padded_control},
|
||||
cosmic_theme::Spacing,
|
||||
iced,
|
||||
iced::{
|
||||
alignment::{Horizontal, Vertical},
|
||||
|
|
@ -247,6 +248,13 @@ impl cosmic::Application for Power {
|
|||
}
|
||||
|
||||
fn view_window(&self, id: window::Id) -> Element<Message> {
|
||||
let Spacing {
|
||||
space_xxs,
|
||||
space_s,
|
||||
space_m,
|
||||
..
|
||||
} = theme::active().cosmic().spacing;
|
||||
|
||||
if matches!(self.popup, Some(p) if p == id) {
|
||||
let settings = menu_button(text::body(fl!("settings"))).on_press(Message::Settings);
|
||||
|
||||
|
|
@ -259,7 +267,7 @@ impl cosmic::Application for Power {
|
|||
text::body(fl!("lock-screen-shortcut")),
|
||||
]
|
||||
.align_items(Alignment::Center)
|
||||
.spacing(8)
|
||||
.spacing(space_xxs)
|
||||
)
|
||||
.on_press(Message::Action(PowerAction::Lock)),
|
||||
menu_button(
|
||||
|
|
@ -270,7 +278,7 @@ impl cosmic::Application for Power {
|
|||
text::body(fl!("log-out-shortcut")),
|
||||
]
|
||||
.align_items(Alignment::Center)
|
||||
.spacing(8)
|
||||
.spacing(space_xxs)
|
||||
)
|
||||
.on_press(Message::Action(PowerAction::LogOut)),
|
||||
];
|
||||
|
|
@ -283,14 +291,14 @@ impl cosmic::Application for Power {
|
|||
power_buttons("system-shutdown-symbolic", fl!("shutdown"))
|
||||
.on_press(Message::Action(PowerAction::Shutdown)),
|
||||
]
|
||||
.spacing(24)
|
||||
.padding([0, 24]);
|
||||
.spacing(space_m)
|
||||
.padding([0, space_m]);
|
||||
|
||||
let content = column![
|
||||
settings,
|
||||
padded_control(divider::horizontal::default()),
|
||||
padded_control(divider::horizontal::default()).padding([space_xxs, space_s]),
|
||||
session,
|
||||
padded_control(divider::horizontal::default()),
|
||||
padded_control(divider::horizontal::default()).padding([space_xxs, space_s]),
|
||||
power
|
||||
]
|
||||
.align_items(Alignment::Start)
|
||||
|
|
@ -319,7 +327,7 @@ impl cosmic::Application for Power {
|
|||
HashMap::from_iter(vec![("action", action), ("countdown", countdown)])
|
||||
))
|
||||
.primary_action(
|
||||
button(min_width_and_height(
|
||||
button::custom(min_width_and_height(
|
||||
text::body(fl!("confirm", HashMap::from_iter(vec![("action", action)])))
|
||||
.into(),
|
||||
142.0,
|
||||
|
|
@ -331,7 +339,7 @@ impl cosmic::Application for Power {
|
|||
.on_press(Message::Confirm),
|
||||
)
|
||||
.secondary_action(
|
||||
button(min_width_and_height(
|
||||
button::custom(min_width_and_height(
|
||||
text::body(fl!("cancel")).into(),
|
||||
142.0,
|
||||
32.0,
|
||||
|
|
@ -380,7 +388,7 @@ impl cosmic::Application for Power {
|
|||
}
|
||||
|
||||
fn power_buttons(name: &str, msg: String) -> cosmic::widget::Button<Message> {
|
||||
cosmic::widget::button(
|
||||
button::custom(
|
||||
column![text_icon(name, 40), text::body(msg)]
|
||||
.spacing(4)
|
||||
.align_items(Alignment::Center)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue