Skip to content

Commit

Permalink
Use spacing variables
Browse files Browse the repository at this point in the history
  • Loading branch information
jackpot51 committed Nov 30, 2023
1 parent 1bc908b commit 7d78174
Showing 1 changed file with 29 additions and 9 deletions.
38 changes: 29 additions & 9 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -591,15 +591,22 @@ impl Application for App {

let nav_model = self.nav_model()?;

let cosmic_theme::Spacing {
space_none,
space_s,
space_xxxs,
..
} = self.core().system_theme().cosmic().spacing;

let mut nav = segmented_button::vertical(nav_model)
.button_height(28)
.button_padding([16, 4, 16, 4])
.button_spacing(4)
.button_height(space_xxxs + 20 /* line height */ + space_xxxs)
.button_padding([space_s, space_xxxs, space_s, space_xxxs])
.button_spacing(space_xxxs)
.on_activate(|entity| message::cosmic(cosmic::app::cosmic::Message::NavBar(entity)))
.spacing(0)
.spacing(space_none)
.style(theme::SegmentedButton::ViewSwitcher)
.apply(widget::container)
.padding([8, 16])
.padding(space_s)
.width(Length::Fill);

if !self.core().is_condensed() {
Expand Down Expand Up @@ -1148,6 +1155,13 @@ impl Application for App {
return None;
}

let cosmic_theme::Spacing {
space_none,
space_s,
space_xxs,
..
} = self.core().system_theme().cosmic().spacing;

Some(match self.context_page {
ContextPage::DocumentStatistics => {
//TODO: calculate in the background
Expand Down Expand Up @@ -1258,8 +1272,8 @@ impl Application for App {
};

widget::column::with_children(items)
.spacing(16)
.padding([8, 0])
.spacing(space_s)
.padding([space_xxs, space_none])
.into()
}
ContextPage::Settings => {
Expand Down Expand Up @@ -1348,7 +1362,13 @@ impl Application for App {
}

fn view(&self) -> Element<Message> {
let mut tab_column = widget::column::with_capacity(3).padding([0, 8]);
let cosmic_theme::Spacing {
space_none,
space_xxs,
..
} = self.core().system_theme().cosmic().spacing;

let mut tab_column = widget::column::with_capacity(3).padding([space_none, space_xxs]);

tab_column = tab_column.push(
row![
Expand All @@ -1360,7 +1380,7 @@ impl Application for App {
.width(Length::Shrink),
button(icon_cache_get("list-add-symbolic", 16))
.on_press(Message::NewFile)
.padding(8)
.padding(space_xxs)
.style(style::Button::Icon)
]
.align_items(Alignment::Center),
Expand Down

0 comments on commit 7d78174

Please sign in to comment.