Use f32 in Length::Units and rename it to Fixed
This commit is contained in:
parent
f75e020257
commit
7b8b01f560
43 changed files with 269 additions and 262 deletions
|
|
@ -301,11 +301,11 @@ impl<C: ColorSpace + Copy> ColorPicker<C> {
|
|||
}
|
||||
|
||||
row![
|
||||
text(C::LABEL).width(Length::Units(50)),
|
||||
text(C::LABEL).width(50),
|
||||
slider(cr1, c1, move |v| C::new(v, c2, c3)),
|
||||
slider(cr2, c2, move |v| C::new(c1, v, c3)),
|
||||
slider(cr3, c3, move |v| C::new(c1, c2, v)),
|
||||
text(color.to_string()).width(Length::Units(185)).size(14),
|
||||
text(color.to_string()).width(185).size(14),
|
||||
]
|
||||
.spacing(10)
|
||||
.align_items(Alignment::Center)
|
||||
|
|
|
|||
|
|
@ -127,7 +127,7 @@ mod numeric_input {
|
|||
.horizontal_alignment(alignment::Horizontal::Center)
|
||||
.vertical_alignment(alignment::Vertical::Center),
|
||||
)
|
||||
.width(Length::Units(50))
|
||||
.width(50)
|
||||
.on_press(on_press)
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -93,7 +93,7 @@ impl Application for Events {
|
|||
.width(Length::Fill)
|
||||
.horizontal_alignment(alignment::Horizontal::Center),
|
||||
)
|
||||
.width(Length::Units(100))
|
||||
.width(100)
|
||||
.padding(10)
|
||||
.on_press(Message::Exit);
|
||||
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ impl Program for Controls {
|
|||
let background_color = self.background_color;
|
||||
|
||||
let sliders = Row::new()
|
||||
.width(Length::Units(500))
|
||||
.width(500)
|
||||
.spacing(20)
|
||||
.push(
|
||||
Slider::new(0.0..=1.0, background_color.r, move |r| {
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ impl Program for Controls {
|
|||
let text = &self.text;
|
||||
|
||||
let sliders = Row::new()
|
||||
.width(Length::Units(500))
|
||||
.width(500)
|
||||
.spacing(20)
|
||||
.push(
|
||||
slider(0.0..=1.0, background_color.r, move |r| {
|
||||
|
|
|
|||
|
|
@ -156,7 +156,7 @@ impl Application for App {
|
|||
]
|
||||
.spacing(20),
|
||||
)
|
||||
.width(Length::Units(300))
|
||||
.width(300)
|
||||
.padding(10)
|
||||
.style(theme::Container::Box);
|
||||
|
||||
|
|
|
|||
|
|
@ -43,10 +43,10 @@ impl Sandbox for Example {
|
|||
.placeholder("Choose a language...");
|
||||
|
||||
let content = column![
|
||||
vertical_space(Length::Units(600)),
|
||||
vertical_space(600),
|
||||
"Which is your favorite language?",
|
||||
pick_list,
|
||||
vertical_space(Length::Units(600)),
|
||||
vertical_space(600),
|
||||
]
|
||||
.width(Length::Fill)
|
||||
.align_items(Alignment::Center)
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ impl Sandbox for QRGenerator {
|
|||
.padding(15);
|
||||
|
||||
let mut content = column![title, input]
|
||||
.width(Length::Units(700))
|
||||
.width(700)
|
||||
.spacing(20)
|
||||
.align_items(Alignment::Center);
|
||||
|
||||
|
|
|
|||
|
|
@ -187,9 +187,9 @@ impl Application for ScrollableDemo {
|
|||
column![
|
||||
scroll_to_end_button(),
|
||||
text("Beginning!"),
|
||||
vertical_space(Length::Units(1200)),
|
||||
vertical_space(1200),
|
||||
text("Middle!"),
|
||||
vertical_space(Length::Units(1200)),
|
||||
vertical_space(1200),
|
||||
text("End!"),
|
||||
scroll_to_beginning_button(),
|
||||
]
|
||||
|
|
@ -211,13 +211,13 @@ impl Application for ScrollableDemo {
|
|||
row![
|
||||
scroll_to_end_button(),
|
||||
text("Beginning!"),
|
||||
horizontal_space(Length::Units(1200)),
|
||||
horizontal_space(1200),
|
||||
text("Middle!"),
|
||||
horizontal_space(Length::Units(1200)),
|
||||
horizontal_space(1200),
|
||||
text("End!"),
|
||||
scroll_to_beginning_button(),
|
||||
]
|
||||
.height(Length::Units(450))
|
||||
.height(450)
|
||||
.align_items(Alignment::Center)
|
||||
.padding([0, 40, 0, 40])
|
||||
.spacing(40),
|
||||
|
|
@ -237,26 +237,26 @@ impl Application for ScrollableDemo {
|
|||
row![
|
||||
column![
|
||||
text("Let's do some scrolling!"),
|
||||
vertical_space(Length::Units(2400))
|
||||
vertical_space(2400)
|
||||
],
|
||||
scroll_to_end_button(),
|
||||
text("Horizontal - Beginning!"),
|
||||
horizontal_space(Length::Units(1200)),
|
||||
horizontal_space(1200),
|
||||
//vertical content
|
||||
column![
|
||||
text("Horizontal - Middle!"),
|
||||
scroll_to_end_button(),
|
||||
text("Vertical - Beginning!"),
|
||||
vertical_space(Length::Units(1200)),
|
||||
vertical_space(1200),
|
||||
text("Vertical - Middle!"),
|
||||
vertical_space(Length::Units(1200)),
|
||||
vertical_space(1200),
|
||||
text("Vertical - End!"),
|
||||
scroll_to_beginning_button(),
|
||||
vertical_space(Length::Units(40)),
|
||||
vertical_space(40),
|
||||
]
|
||||
.align_items(Alignment::Fill)
|
||||
.spacing(40),
|
||||
horizontal_space(Length::Units(1200)),
|
||||
horizontal_space(1200),
|
||||
text("Horizontal - End!"),
|
||||
scroll_to_beginning_button(),
|
||||
]
|
||||
|
|
|
|||
|
|
@ -38,11 +38,11 @@ impl Sandbox for Slider {
|
|||
|
||||
let h_slider =
|
||||
container(slider(0..=100, value, Message::SliderChanged))
|
||||
.width(Length::Units(250));
|
||||
.width(250);
|
||||
|
||||
let v_slider =
|
||||
container(vertical_slider(0..=100, value, Message::SliderChanged))
|
||||
.height(Length::Units(200));
|
||||
.height(200);
|
||||
|
||||
let text = text(format!("{value}"));
|
||||
|
||||
|
|
|
|||
|
|
@ -105,7 +105,7 @@ impl Application for Stopwatch {
|
|||
text(label).horizontal_alignment(alignment::Horizontal::Center),
|
||||
)
|
||||
.padding(10)
|
||||
.width(Length::Units(80))
|
||||
.width(80)
|
||||
};
|
||||
|
||||
let toggle_button = {
|
||||
|
|
|
|||
|
|
@ -108,14 +108,10 @@ impl Sandbox for Styling {
|
|||
let progress_bar = progress_bar(0.0..=100.0, self.slider_value);
|
||||
|
||||
let scrollable = scrollable(
|
||||
column![
|
||||
"Scroll me!",
|
||||
vertical_space(Length::Units(800)),
|
||||
"You did it!"
|
||||
]
|
||||
.width(Length::Fill),
|
||||
column!["Scroll me!", vertical_space(800), "You did it!"]
|
||||
.width(Length::Fill),
|
||||
)
|
||||
.height(Length::Units(100));
|
||||
.height(100);
|
||||
|
||||
let checkbox = checkbox(
|
||||
"Check me!",
|
||||
|
|
@ -143,7 +139,7 @@ impl Sandbox for Styling {
|
|||
column![checkbox, toggler].spacing(20)
|
||||
]
|
||||
.spacing(10)
|
||||
.height(Length::Units(100))
|
||||
.height(100)
|
||||
.align_items(Alignment::Center),
|
||||
]
|
||||
.spacing(20)
|
||||
|
|
|
|||
|
|
@ -460,7 +460,7 @@ fn empty_message(message: &str) -> Element<'_, Message> {
|
|||
.style(Color::from([0.7, 0.7, 0.7])),
|
||||
)
|
||||
.width(Length::Fill)
|
||||
.height(Length::Units(200))
|
||||
.height(200)
|
||||
.center_y()
|
||||
.into()
|
||||
}
|
||||
|
|
@ -474,7 +474,7 @@ const ICONS: Font = Font::External {
|
|||
fn icon(unicode: char) -> Text<'static> {
|
||||
text(unicode.to_string())
|
||||
.font(ICONS)
|
||||
.width(Length::Units(20))
|
||||
.width(20)
|
||||
.horizontal_alignment(alignment::Horizontal::Center)
|
||||
.size(20)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -513,14 +513,14 @@ impl<'a> Step {
|
|||
text("Tip: You can use the scrollbar to scroll down faster!")
|
||||
.size(16),
|
||||
)
|
||||
.push(vertical_space(Length::Units(4096)))
|
||||
.push(vertical_space(4096))
|
||||
.push(
|
||||
text("You are halfway there!")
|
||||
.width(Length::Fill)
|
||||
.size(30)
|
||||
.horizontal_alignment(alignment::Horizontal::Center),
|
||||
)
|
||||
.push(vertical_space(Length::Units(4096)))
|
||||
.push(vertical_space(4096))
|
||||
.push(ferris(300))
|
||||
.push(
|
||||
text("You made it!")
|
||||
|
|
@ -605,7 +605,7 @@ fn ferris<'a>(width: u16) -> Container<'a, StepMessage> {
|
|||
} else {
|
||||
image(format!("{}/images/ferris.png", env!("CARGO_MANIFEST_DIR")))
|
||||
}
|
||||
.width(Length::Units(width)),
|
||||
.width(width),
|
||||
)
|
||||
.width(Length::Fill)
|
||||
.center_x()
|
||||
|
|
@ -616,7 +616,7 @@ fn button<'a, Message: Clone>(label: &str) -> Button<'a, Message> {
|
|||
text(label).horizontal_alignment(alignment::Horizontal::Center),
|
||||
)
|
||||
.padding(12)
|
||||
.width(Length::Units(100))
|
||||
.width(100)
|
||||
}
|
||||
|
||||
fn color_slider<'a>(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue