chore: re-export iced row and column

This removes the custom row and column implementations and uses the iced ones directly.
This commit is contained in:
Vukašin Vojinović 2026-04-01 23:24:53 +02:00 committed by Michael Murphy
parent a9e0671075
commit fdf3369cea
20 changed files with 103 additions and 227 deletions

View file

@ -132,7 +132,7 @@ impl cosmic::Application for App {
fn view(&self) -> Element<'_, Self::Message> {
let show_about_button = widget::button::text("Show about").on_press(Message::ToggleAbout);
let centered = cosmic::widget::container(
widget::column()
widget::column::with_capacity(1)
.push(show_about_button)
.width(Length::Fill)
.height(Length::Shrink)

View file

@ -54,7 +54,7 @@ impl widget::menu::Action for Action {
/// Runs application with these settings
#[rustfmt::skip]
fn main() -> Result<(), Box<dyn std::error::Error>> {
env_logger::Builder::from_env(env_logger::Env::default().default_filter_or("warn")).init();
@ -190,7 +190,7 @@ impl cosmic::Application for App {
.map_or("No page selected", String::as_str);
let centered = widget::container(
widget::column()
widget::column::with_capacity(5)
.push(widget::text::body(page_content))
.push(
widget::text_input::text_input("", &self.input_1)

View file

@ -85,8 +85,6 @@ impl cosmic::Application for App {
/// Creates a view after each update.
fn view(&self) -> Element<'_, Self::Message> {
let mut content = cosmic::widget::column().spacing(12);
let calendar = cosmic::widget::calendar(
&self.calendar_model,
|date| Message::DateSelected(date),
@ -95,9 +93,7 @@ impl cosmic::Application for App {
Weekday::Sunday,
);
content = content.push(calendar);
let centered = cosmic::widget::container(content)
let centered = cosmic::widget::container(calendar)
.width(iced::Length::Fill)
.height(iced::Length::Shrink)
.align_x(iced::Alignment::Center)

View file

@ -80,7 +80,7 @@ impl cosmic::Application for App {
/// Creates a view after each update.
fn view(&self) -> Element<'_, Self::Message> {
let mut content = cosmic::widget::column().spacing(12);
let mut content = cosmic::widget::column::with_capacity(self.images.len()).spacing(12);
for (id, image) in self.images.iter().enumerate() {
content = content.push(

View file

@ -64,7 +64,7 @@ impl cosmic::Application for App {
/// Creates a view after each update.
fn view(&self) -> Element<'_, Self::Message> {
widget::row().into()
widget::Row::new().into()
}
}

View file

@ -99,7 +99,9 @@ impl cosmic::Application for App {
let inline = cosmic::widget::inline_input("", &self.input).on_input(Message::Input);
let column = cosmic::widget::column().push(editable).push(inline);
let column = cosmic::widget::column::with_capacity(2)
.push(editable)
.push(inline);
let centered = cosmic::widget::container(column.width(200))
.width(iced::Length::Fill)