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

@ -2,9 +2,9 @@ use iced::border;
use iced::keyboard;
use iced::mouse;
use iced::widget::{
button, canvas, center, checkbox, column, container, horizontal_rule,
horizontal_space, pick_list, pin, row, scrollable, stack, text,
vertical_rule,
button, canvas, center, center_y, checkbox, column, container,
horizontal_rule, horizontal_space, pick_list, pin, row, scrollable, stack,
text, vertical_rule,
};
use iced::{
color, Center, Element, Fill, Font, Length, Point, Rectangle, Renderer,
@ -253,15 +253,14 @@ fn application<'a>() -> Element<'a, Message> {
.border(border::color(palette.background.strong.color).width(1))
});
let sidebar = container(
let sidebar = center_y(
column!["Sidebar!", square(50), square(50)]
.spacing(40)
.padding(10)
.width(200)
.align_x(Center),
)
.style(container::rounded_box)
.center_y(Fill);
.style(container::rounded_box);
let content = container(
scrollable(