fix(context menu): increase vertical item padding (#665)
This matches the context menu to the designs.
This commit is contained in:
parent
23d0a3bc74
commit
06150f7d44
5 changed files with 61 additions and 55 deletions
|
|
@ -84,12 +84,12 @@ impl Application for App {
|
||||||
fn view_window(&self, window_id: window::Id) -> Element<Message> {
|
fn view_window(&self, window_id: window::Id) -> Element<Message> {
|
||||||
match &self.dialog_opt {
|
match &self.dialog_opt {
|
||||||
Some(dialog) => dialog.view(window_id),
|
Some(dialog) => dialog.view(window_id),
|
||||||
None => widget::text("No dialog").into(),
|
None => widget::text::body("No dialog").into(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn view(&self) -> Element<Message> {
|
fn view(&self) -> Element<Message> {
|
||||||
let mut column = widget::column().spacing(8);
|
let mut column = widget::column().spacing(8).padding(8);
|
||||||
{
|
{
|
||||||
let mut button = widget::button::standard("Open File");
|
let mut button = widget::button::standard("Open File");
|
||||||
if self.dialog_opt.is_none() {
|
if self.dialog_opt.is_none() {
|
||||||
|
|
@ -130,11 +130,11 @@ impl Application for App {
|
||||||
if let Some(result) = &self.result_opt {
|
if let Some(result) = &self.result_opt {
|
||||||
match result {
|
match result {
|
||||||
DialogResult::Cancel => {
|
DialogResult::Cancel => {
|
||||||
column = column.push(widget::text("Cancel"));
|
column = column.push(widget::text::body("Cancel"));
|
||||||
}
|
}
|
||||||
DialogResult::Open(paths) => {
|
DialogResult::Open(paths) => {
|
||||||
for path in paths.iter() {
|
for path in paths.iter() {
|
||||||
column = column.push(widget::text(format!("{}", path.display())));
|
column = column.push(widget::text::body(format!("{}", path.display())));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
14
src/app.rs
14
src/app.rs
|
|
@ -1142,7 +1142,7 @@ impl App {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
widget::column::with_children(vec![
|
widget::column::with_children(vec![
|
||||||
widget::text(fl!("network-drive-description")).into(),
|
widget::text::body(fl!("network-drive-description")).into(),
|
||||||
table.into(),
|
table.into(),
|
||||||
])
|
])
|
||||||
.spacing(space_m)
|
.spacing(space_m)
|
||||||
|
|
@ -1269,7 +1269,7 @@ impl App {
|
||||||
])
|
])
|
||||||
.align_y(Alignment::Center)
|
.align_y(Alignment::Center)
|
||||||
.into(),
|
.into(),
|
||||||
widget::text(op.pending_text(progress, controller.state())).into(),
|
widget::text::body(op.pending_text(progress, controller.state())).into(),
|
||||||
]));
|
]));
|
||||||
}
|
}
|
||||||
children.push(section.into());
|
children.push(section.into());
|
||||||
|
|
@ -1280,8 +1280,8 @@ impl App {
|
||||||
for (_id, (op, controller, error)) in self.failed_operations.iter().rev() {
|
for (_id, (op, controller, error)) in self.failed_operations.iter().rev() {
|
||||||
let progress = controller.progress();
|
let progress = controller.progress();
|
||||||
section = section.add(widget::column::with_children(vec![
|
section = section.add(widget::column::with_children(vec![
|
||||||
widget::text(op.pending_text(progress, controller.state())).into(),
|
widget::text::body(op.pending_text(progress, controller.state())).into(),
|
||||||
widget::text(error).into(),
|
widget::text::body(error).into(),
|
||||||
]));
|
]));
|
||||||
}
|
}
|
||||||
children.push(section.into());
|
children.push(section.into());
|
||||||
|
|
@ -1290,7 +1290,7 @@ impl App {
|
||||||
if !self.complete_operations.is_empty() {
|
if !self.complete_operations.is_empty() {
|
||||||
let mut section = widget::settings::section().title(fl!("complete"));
|
let mut section = widget::settings::section().title(fl!("complete"));
|
||||||
for (_id, op) in self.complete_operations.iter().rev() {
|
for (_id, op) in self.complete_operations.iter().rev() {
|
||||||
section = section.add(widget::text(op.completed_text()));
|
section = section.add(widget::text::body(op.completed_text()));
|
||||||
}
|
}
|
||||||
children.push(section.into());
|
children.push(section.into());
|
||||||
}
|
}
|
||||||
|
|
@ -3713,10 +3713,10 @@ impl Application for App {
|
||||||
widget::row::with_children(vec![
|
widget::row::with_children(vec![
|
||||||
widget::icon(app.icon.clone()).size(32).into(),
|
widget::icon(app.icon.clone()).size(32).into(),
|
||||||
if app.is_default {
|
if app.is_default {
|
||||||
widget::text(fl!("default-app", name = app.name.as_str()))
|
widget::text::body(fl!("default-app", name = app.name.as_str()))
|
||||||
.into()
|
.into()
|
||||||
} else {
|
} else {
|
||||||
widget::text(app.name.to_string()).into()
|
widget::text::body(app.name.to_string()).into()
|
||||||
},
|
},
|
||||||
widget::horizontal_space().into(),
|
widget::horizontal_space().into(),
|
||||||
if *selected == i {
|
if *selected == i {
|
||||||
|
|
|
||||||
|
|
@ -806,9 +806,9 @@ impl Application for App {
|
||||||
for item in items.iter() {
|
for item in items.iter() {
|
||||||
if item.selected {
|
if item.selected {
|
||||||
actions.extend(
|
actions.extend(
|
||||||
item.preview_header().into_iter().map(|element| {
|
item.preview_header()
|
||||||
element.map(move |message| Message::from(message))
|
.into_iter()
|
||||||
}),
|
.map(|element| element.map(Message::from)),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@ macro_rules! menu_button {
|
||||||
.height(Length::Fixed(24.0))
|
.height(Length::Fixed(24.0))
|
||||||
.align_y(Alignment::Center)
|
.align_y(Alignment::Center)
|
||||||
)
|
)
|
||||||
.padding([theme::active().cosmic().spacing.space_xxxs, 16])
|
.padding([theme::active().cosmic().spacing.space_xxs, 16])
|
||||||
.width(Length::Fill)
|
.width(Length::Fill)
|
||||||
.class(theme::Button::MenuItem)
|
.class(theme::Button::MenuItem)
|
||||||
);
|
);
|
||||||
|
|
|
||||||
86
src/tab.rs
86
src/tab.rs
|
|
@ -1415,42 +1415,45 @@ impl Item {
|
||||||
|
|
||||||
let mut details = widget::column().spacing(space_xxxs);
|
let mut details = widget::column().spacing(space_xxxs);
|
||||||
details = details.push(widget::text::heading(self.name.clone()));
|
details = details.push(widget::text::heading(self.name.clone()));
|
||||||
details = details.push(widget::text(fl!("type", mime = self.mime.to_string())));
|
details = details.push(widget::text::body(fl!(
|
||||||
|
"type",
|
||||||
|
mime = self.mime.to_string()
|
||||||
|
)));
|
||||||
let mut settings = Vec::new();
|
let mut settings = Vec::new();
|
||||||
match &self.metadata {
|
match &self.metadata {
|
||||||
ItemMetadata::Path { metadata, children } => {
|
ItemMetadata::Path { metadata, children } => {
|
||||||
if metadata.is_dir() {
|
if metadata.is_dir() {
|
||||||
details = details.push(widget::text(fl!("items", items = children)));
|
details = details.push(widget::text::body(fl!("items", items = children)));
|
||||||
let size = match &self.dir_size {
|
let size = match &self.dir_size {
|
||||||
DirSize::Calculating(_) => fl!("calculating"),
|
DirSize::Calculating(_) => fl!("calculating"),
|
||||||
DirSize::Directory(size) => format_size(*size),
|
DirSize::Directory(size) => format_size(*size),
|
||||||
DirSize::NotDirectory => String::new(),
|
DirSize::NotDirectory => String::new(),
|
||||||
DirSize::Error(err) => err.clone(),
|
DirSize::Error(err) => err.clone(),
|
||||||
};
|
};
|
||||||
details = details.push(widget::text(fl!("item-size", size = size)));
|
details = details.push(widget::text::body(fl!("item-size", size = size)));
|
||||||
} else {
|
} else {
|
||||||
details = details.push(widget::text(fl!(
|
details = details.push(widget::text::body(fl!(
|
||||||
"item-size",
|
"item-size",
|
||||||
size = format_size(metadata.len())
|
size = format_size(metadata.len())
|
||||||
)));
|
)));
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Ok(time) = metadata.created() {
|
if let Ok(time) = metadata.created() {
|
||||||
details = details.push(widget::text(fl!(
|
details = details.push(widget::text::body(fl!(
|
||||||
"item-created",
|
"item-created",
|
||||||
created = format_time(time).to_string()
|
created = format_time(time).to_string()
|
||||||
)));
|
)));
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Ok(time) = metadata.modified() {
|
if let Ok(time) = metadata.modified() {
|
||||||
details = details.push(widget::text(fl!(
|
details = details.push(widget::text::body(fl!(
|
||||||
"item-modified",
|
"item-modified",
|
||||||
modified = format_time(time).to_string()
|
modified = format_time(time).to_string()
|
||||||
)));
|
)));
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Ok(time) = metadata.accessed() {
|
if let Ok(time) = metadata.accessed() {
|
||||||
details = details.push(widget::text(fl!(
|
details = details.push(widget::text::body(fl!(
|
||||||
"item-accessed",
|
"item-accessed",
|
||||||
accessed = format_time(time).to_string()
|
accessed = format_time(time).to_string()
|
||||||
)));
|
)));
|
||||||
|
|
@ -1464,7 +1467,7 @@ impl Item {
|
||||||
PermissionOwner::Owner,
|
PermissionOwner::Owner,
|
||||||
))
|
))
|
||||||
.description(fl!("owner"))
|
.description(fl!("owner"))
|
||||||
.control(widget::text(format_permissions(
|
.control(widget::text::body(format_permissions(
|
||||||
metadata,
|
metadata,
|
||||||
PermissionOwner::Owner,
|
PermissionOwner::Owner,
|
||||||
))),
|
))),
|
||||||
|
|
@ -1476,14 +1479,14 @@ impl Item {
|
||||||
PermissionOwner::Group,
|
PermissionOwner::Group,
|
||||||
))
|
))
|
||||||
.description(fl!("group"))
|
.description(fl!("group"))
|
||||||
.control(widget::text(format_permissions(
|
.control(widget::text::body(format_permissions(
|
||||||
metadata,
|
metadata,
|
||||||
PermissionOwner::Group,
|
PermissionOwner::Group,
|
||||||
))),
|
))),
|
||||||
);
|
);
|
||||||
|
|
||||||
settings.push(widget::settings::item::builder(fl!("other")).control(
|
settings.push(widget::settings::item::builder(fl!("other")).control(
|
||||||
widget::text(format_permissions(metadata, PermissionOwner::Other)),
|
widget::text::body(format_permissions(metadata, PermissionOwner::Other)),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1497,7 +1500,7 @@ impl Item {
|
||||||
.unwrap_or(&ItemThumbnail::NotImage)
|
.unwrap_or(&ItemThumbnail::NotImage)
|
||||||
{
|
{
|
||||||
ItemThumbnail::Image(_, Some((width, height))) => {
|
ItemThumbnail::Image(_, Some((width, height))) => {
|
||||||
details = details.push(widget::text(format!("{}x{}", width, height)));
|
details = details.push(widget::text::body(format!("{}x{}", width, height)));
|
||||||
}
|
}
|
||||||
_ => {}
|
_ => {}
|
||||||
}
|
}
|
||||||
|
|
@ -1538,15 +1541,15 @@ impl Item {
|
||||||
match &self.metadata {
|
match &self.metadata {
|
||||||
ItemMetadata::Path { metadata, children } => {
|
ItemMetadata::Path { metadata, children } => {
|
||||||
if metadata.is_dir() {
|
if metadata.is_dir() {
|
||||||
column = column.push(widget::text(format!("Items: {}", children)));
|
column = column.push(widget::text::body(format!("Items: {}", children)));
|
||||||
} else {
|
} else {
|
||||||
column = column.push(widget::text(format!(
|
column = column.push(widget::text::body(format!(
|
||||||
"Size: {}",
|
"Size: {}",
|
||||||
format_size(metadata.len())
|
format_size(metadata.len())
|
||||||
)));
|
)));
|
||||||
}
|
}
|
||||||
if let Ok(time) = metadata.modified() {
|
if let Ok(time) = metadata.modified() {
|
||||||
column = column.push(widget::text(format!(
|
column = column.push(widget::text::body(format!(
|
||||||
"Last modified: {}",
|
"Last modified: {}",
|
||||||
format_time(time)
|
format_time(time)
|
||||||
)));
|
)));
|
||||||
|
|
@ -3584,7 +3587,7 @@ impl Tab {
|
||||||
.size(64)
|
.size(64)
|
||||||
.icon()
|
.icon()
|
||||||
.into(),
|
.into(),
|
||||||
widget::text(if has_hidden {
|
widget::text::body(if has_hidden {
|
||||||
fl!("empty-folder-hidden")
|
fl!("empty-folder-hidden")
|
||||||
} else if matches!(self.location, Location::Search(..)) {
|
} else if matches!(self.location, Location::Search(..)) {
|
||||||
fl!("no-results")
|
fl!("no-results")
|
||||||
|
|
@ -3857,17 +3860,19 @@ impl Tab {
|
||||||
false,
|
false,
|
||||||
false,
|
false,
|
||||||
)),
|
)),
|
||||||
widget::button::custom(widget::text(item.display_name.clone()))
|
widget::button::custom(widget::text::body(
|
||||||
.id(item.button_id.clone())
|
item.display_name.clone(),
|
||||||
.on_press(Message::Click(Some(*i)))
|
))
|
||||||
.padding([0, space_xxxs])
|
.id(item.button_id.clone())
|
||||||
.class(button_style(
|
.on_press(Message::Click(Some(*i)))
|
||||||
item.selected,
|
.padding([0, space_xxxs])
|
||||||
item.highlighted,
|
.class(button_style(
|
||||||
true,
|
item.selected,
|
||||||
true,
|
item.highlighted,
|
||||||
false,
|
true,
|
||||||
)),
|
true,
|
||||||
|
false,
|
||||||
|
)),
|
||||||
];
|
];
|
||||||
|
|
||||||
let mut column = widget::column::with_capacity(buttons.len())
|
let mut column = widget::column::with_capacity(buttons.len())
|
||||||
|
|
@ -4016,7 +4021,7 @@ impl Tab {
|
||||||
.size(icon_size)
|
.size(icon_size)
|
||||||
.into(),
|
.into(),
|
||||||
widget::column::with_children(vec![
|
widget::column::with_children(vec![
|
||||||
widget::text(item.display_name.clone()).into(),
|
widget::text::body(item.display_name.clone()).into(),
|
||||||
//TODO: translate?
|
//TODO: translate?
|
||||||
widget::text::caption(format!("{} - {}", modified_text, size_text))
|
widget::text::caption(format!("{} - {}", modified_text, size_text))
|
||||||
.into(),
|
.into(),
|
||||||
|
|
@ -4033,7 +4038,7 @@ impl Tab {
|
||||||
.size(icon_size)
|
.size(icon_size)
|
||||||
.into(),
|
.into(),
|
||||||
widget::column::with_children(vec![
|
widget::column::with_children(vec![
|
||||||
widget::text(item.display_name.clone()).into(),
|
widget::text::body(item.display_name.clone()).into(),
|
||||||
widget::text::caption(match item.path_opt() {
|
widget::text::caption(match item.path_opt() {
|
||||||
Some(path) => path.display().to_string(),
|
Some(path) => path.display().to_string(),
|
||||||
None => String::new(),
|
None => String::new(),
|
||||||
|
|
@ -4042,10 +4047,10 @@ impl Tab {
|
||||||
])
|
])
|
||||||
.width(Length::Fill)
|
.width(Length::Fill)
|
||||||
.into(),
|
.into(),
|
||||||
widget::text(modified_text.clone())
|
widget::text::body(modified_text.clone())
|
||||||
.width(Length::Fixed(modified_width))
|
.width(Length::Fixed(modified_width))
|
||||||
.into(),
|
.into(),
|
||||||
widget::text(size_text.clone())
|
widget::text::body(size_text.clone())
|
||||||
.width(Length::Fixed(size_width))
|
.width(Length::Fixed(size_width))
|
||||||
.into(),
|
.into(),
|
||||||
])
|
])
|
||||||
|
|
@ -4058,13 +4063,13 @@ impl Tab {
|
||||||
.content_fit(ContentFit::Contain)
|
.content_fit(ContentFit::Contain)
|
||||||
.size(icon_size)
|
.size(icon_size)
|
||||||
.into(),
|
.into(),
|
||||||
widget::text(item.display_name.clone())
|
widget::text::body(item.display_name.clone())
|
||||||
.width(Length::Fill)
|
.width(Length::Fill)
|
||||||
.into(),
|
.into(),
|
||||||
widget::text(modified_text.clone())
|
widget::text::body(modified_text.clone())
|
||||||
.width(Length::Fixed(modified_width))
|
.width(Length::Fixed(modified_width))
|
||||||
.into(),
|
.into(),
|
||||||
widget::text(size_text.clone())
|
widget::text::body(size_text.clone())
|
||||||
.width(Length::Fixed(size_width))
|
.width(Length::Fixed(size_width))
|
||||||
.into(),
|
.into(),
|
||||||
])
|
])
|
||||||
|
|
@ -4121,9 +4126,10 @@ impl Tab {
|
||||||
.size(icon_size)
|
.size(icon_size)
|
||||||
.into(),
|
.into(),
|
||||||
widget::column::with_children(vec![
|
widget::column::with_children(vec![
|
||||||
widget::text(item.display_name.clone()).into(),
|
widget::text::body(item.display_name.clone()).into(),
|
||||||
//TODO: translate?
|
//TODO: translate?
|
||||||
widget::text(format!("{} - {}", modified_text, size_text)).into(),
|
widget::text::body(format!("{} - {}", modified_text, size_text))
|
||||||
|
.into(),
|
||||||
])
|
])
|
||||||
.into(),
|
.into(),
|
||||||
])
|
])
|
||||||
|
|
@ -4137,7 +4143,7 @@ impl Tab {
|
||||||
.size(icon_size)
|
.size(icon_size)
|
||||||
.into(),
|
.into(),
|
||||||
widget::column::with_children(vec![
|
widget::column::with_children(vec![
|
||||||
widget::text(item.display_name.clone()).into(),
|
widget::text::body(item.display_name.clone()).into(),
|
||||||
widget::text::caption(match item.path_opt() {
|
widget::text::caption(match item.path_opt() {
|
||||||
Some(path) => path.display().to_string(),
|
Some(path) => path.display().to_string(),
|
||||||
None => String::new(),
|
None => String::new(),
|
||||||
|
|
@ -4146,10 +4152,10 @@ impl Tab {
|
||||||
])
|
])
|
||||||
.width(Length::Fill)
|
.width(Length::Fill)
|
||||||
.into(),
|
.into(),
|
||||||
widget::text(modified_text.clone())
|
widget::text::body(modified_text.clone())
|
||||||
.width(Length::Fixed(modified_width))
|
.width(Length::Fixed(modified_width))
|
||||||
.into(),
|
.into(),
|
||||||
widget::text(size_text.clone())
|
widget::text::body(size_text.clone())
|
||||||
.width(Length::Fixed(size_width))
|
.width(Length::Fixed(size_width))
|
||||||
.into(),
|
.into(),
|
||||||
])
|
])
|
||||||
|
|
@ -4162,13 +4168,13 @@ impl Tab {
|
||||||
.content_fit(ContentFit::Contain)
|
.content_fit(ContentFit::Contain)
|
||||||
.size(icon_size)
|
.size(icon_size)
|
||||||
.into(),
|
.into(),
|
||||||
widget::text(item.display_name.clone())
|
widget::text::body(item.display_name.clone())
|
||||||
.width(Length::Fill)
|
.width(Length::Fill)
|
||||||
.into(),
|
.into(),
|
||||||
widget::text(modified_text)
|
widget::text(modified_text)
|
||||||
.width(Length::Fixed(modified_width))
|
.width(Length::Fixed(modified_width))
|
||||||
.into(),
|
.into(),
|
||||||
widget::text(size_text)
|
widget::text::body(size_text)
|
||||||
.width(Length::Fixed(size_width))
|
.width(Length::Fixed(size_width))
|
||||||
.into(),
|
.into(),
|
||||||
])
|
])
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue