Add helper functions for alignment to widget module

This commit is contained in:
Héctor Ramón Jiménez 2025-01-24 15:55:24 +01:00
parent 75a6f32a5e
commit f8337b8da7
No known key found for this signature in database
GPG key ID: 7CC46565708259A7
12 changed files with 208 additions and 64 deletions

View file

@ -152,8 +152,8 @@ mod rainbow {
}
}
use iced::widget::{column, container, scrollable};
use iced::{Element, Length};
use iced::widget::{center_x, center_y, column, scrollable};
use iced::Element;
use rainbow::rainbow;
pub fn main() -> iced::Result {
@ -176,7 +176,7 @@ fn view(_state: &()) -> Element<'_, ()> {
.spacing(20)
.max_width(500);
let scrollable = scrollable(container(content).center_x(Length::Fill));
let scrollable = scrollable(center_x(content));
container(scrollable).center_y(Length::Fill).into()
center_y(scrollable).into()
}