Add helper functions for alignment to widget module
This commit is contained in:
parent
75a6f32a5e
commit
f8337b8da7
12 changed files with 208 additions and 64 deletions
|
|
@ -1,6 +1,6 @@
|
|||
use iced::widget::{
|
||||
button, checkbox, column, container, horizontal_space, image, radio, row,
|
||||
scrollable, slider, text, text_input, toggler, vertical_space,
|
||||
button, center_x, center_y, checkbox, column, horizontal_space, image,
|
||||
radio, row, scrollable, slider, text, text_input, toggler, vertical_space,
|
||||
};
|
||||
use iced::widget::{Button, Column, Container, Slider};
|
||||
use iced::{Center, Color, Element, Fill, Font, Pixels};
|
||||
|
|
@ -166,16 +166,13 @@ impl Tour {
|
|||
.padding(20)
|
||||
.into();
|
||||
|
||||
let scrollable = scrollable(
|
||||
container(if self.debug {
|
||||
content.explain(Color::BLACK)
|
||||
} else {
|
||||
content
|
||||
})
|
||||
.center_x(Fill),
|
||||
);
|
||||
let scrollable = scrollable(center_x(if self.debug {
|
||||
content.explain(Color::BLACK)
|
||||
} else {
|
||||
content
|
||||
}));
|
||||
|
||||
container(scrollable).center_y(Fill).into()
|
||||
center_y(scrollable).into()
|
||||
}
|
||||
|
||||
fn can_continue(&self) -> bool {
|
||||
|
|
@ -543,7 +540,7 @@ fn ferris<'a>(
|
|||
width: u16,
|
||||
filter_method: image::FilterMethod,
|
||||
) -> Container<'a, Message> {
|
||||
container(
|
||||
center_x(
|
||||
// This should go away once we unify resource loading on native
|
||||
// platforms
|
||||
if cfg!(target_arch = "wasm32") {
|
||||
|
|
@ -554,7 +551,6 @@ fn ferris<'a>(
|
|||
.filter_method(filter_method)
|
||||
.width(width),
|
||||
)
|
||||
.center_x(Fill)
|
||||
}
|
||||
|
||||
fn padded_button<Message: Clone>(label: &str) -> Button<'_, Message> {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue