refactor(container): make layer optional and export as container

This commit is contained in:
Ashley Wulber 2023-02-28 11:17:37 -05:00 committed by Jeremy Soller
parent 8d968f931d
commit b35af255b4
2 changed files with 58 additions and 52 deletions

View file

@ -2,11 +2,11 @@ use apply::Apply;
use cosmic::{
cosmic_theme,
iced::widget::{checkbox, pick_list, progress_bar, radio, row, slider, text},
iced::{widget::container, Alignment, Length},
iced::{Alignment, Length},
theme::{self, Button as ButtonTheme, Theme},
widget::{
button, cosmic_container, icon, segmented_button, segmented_selection, settings,
spin_button, toggler, view_switcher,
button, container, icon, segmented_button, segmented_selection, settings, spin_button,
toggler, view_switcher,
},
Element,
};
@ -375,27 +375,21 @@ impl State {
.into()
}
},
cosmic_container(
text("Background container with some text").size(24),
cosmic_theme::Layer::Background,
)
.padding(8)
.width(Length::Fill)
.into(),
cosmic_container(
text("Primary container with some text").size(24),
cosmic_theme::Layer::Primary,
)
.padding(8)
.width(Length::Fill)
.into(),
cosmic_container(
text("Secondary container with some text").size(24),
cosmic_theme::Layer::Secondary,
)
.padding(8)
.width(Length::Fill)
.into(),
container(text("Background container with some text").size(24))
.layer(cosmic_theme::Layer::Background)
.padding(8)
.width(Length::Fill)
.into(),
container(text("Primary container with some text").size(24))
.layer(cosmic_theme::Layer::Primary)
.padding(8)
.width(Length::Fill)
.into(),
container(text("Secondary container with some text").size(24))
.layer(cosmic_theme::Layer::Secondary)
.padding(8)
.width(Length::Fill)
.into(),
])
.into()
}