How do you give a row both top padding and left padding

Hey, I am new to iced.rs, and I was working the example code in the repo. When I run this code, the left padding disappears. If I remove the top padding, the left padding comes back. Is it possible to give both left and top padding in iced.rs?

use iced::widget::{button, column, text, Column, container, row};
use iced::Padding;
use iced::padding::{top, right, left, bottom}; 
#[derive(Debug, Clone, Copy)]
pub enum Message {
    Increment,
    Decrement,
}
#[derive(Default)]
struct App {
    value: i32,
    items: Vec<String>,
}
impl App {
    pub fn view(&self) -> Column<Message> {
        // We use a column: a simple vertical layout
        let mut col = column!(
            // The increment button. We tell it to produce an
            // `Increment` message when pressed
            button("+").on_press(Message::Increment),

            // We show the value of the counter here
            text(self.value).size(50),

            // The decrement button. We tell it to produce a
            // `Decrement` message when pressed
            button("-").on_press(Message::Decrement),
        ); 
        for item in &self.items {
            let row = row![
                text(item), 
            ]
            .padding(left(20))
            .padding(right(10));
            col = col.push(row);
        }
        col 
    }
    pub fn update(&mut self, message: Message) {
        match message {
            Message::Increment => {
                self.value += 1;
            }
            Message::Decrement => {
                self.value -= 1;
            }
        }
        self.items.push(self.value.to_string()); 
    }
}

fn main() -> iced::Result {
    iced::run("A cool counter", App::update, App::view)
}

The left/right/top/bottom funcions of he padding module generate the Padding struct. It contains the padding on all four sides. Left generates it with 0 padding besides on the left for example.
If your apply the padding method on a widget twice, the first padding is overwritten.
If you want to have padding on the top and left, you would have to crate the Padding struct by your self with the appropriate values.

1 Like

Thank you for the help