Skip to content
Discussion options

You must be logged in to vote

You cannot use align_items like that. In general, widgets are declarative and the order in which properties are set does not alter the resulting widget tree.

Instead, you can achieve different alignment by wrapping the items of the Column in a Container. For instance:

use iced::alignment;
use iced::{Column, Container, Element, Length, Sandbox, Settings, Text};

pub fn main() -> iced::Result {
    Example::run(Settings::default())
}

#[derive(Default)]
struct Example;

impl Sandbox for Example {
    type Message = ();

    fn new() -> Self {
        Self::default()
    }

    fn title(&self) -> String {
        String::from("Alignment - Iced")
    }

    fn update(&mut self, _message: ()) {}

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@LuckyTurtleDev
Comment options

@hecrj
Comment options

@LuckyTurtleDev
Comment options

Answer selected by hecrj
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants