Refactor alignment types into an alignment module
This commit is contained in:
parent
5fae6e59ff
commit
a0ad399622
54 changed files with 402 additions and 377 deletions
|
|
@ -1,7 +1,6 @@
|
|||
//! This example showcases an interactive `Canvas` for drawing Bézier curves.
|
||||
use iced::{
|
||||
button, Button, Column, CrossAlign, Element, Length, Sandbox, Settings,
|
||||
Text,
|
||||
button, Alignment, Button, Column, Element, Length, Sandbox, Settings, Text,
|
||||
};
|
||||
|
||||
pub fn main() -> iced::Result {
|
||||
|
|
@ -52,7 +51,7 @@ impl Sandbox for Example {
|
|||
Column::new()
|
||||
.padding(20)
|
||||
.spacing(20)
|
||||
.align_items(CrossAlign::Center)
|
||||
.align_items(Alignment::Center)
|
||||
.push(
|
||||
Text::new("Bezier tool example")
|
||||
.width(Length::Shrink)
|
||||
|
|
|
|||
|
|
@ -1,8 +1,7 @@
|
|||
use iced::canvas::{self, Cursor, Frame, Geometry, Path};
|
||||
use iced::{
|
||||
slider, Canvas, Color, Column, CrossAlign, Element, HorizontalAlignment,
|
||||
Length, Point, Rectangle, Row, Sandbox, Settings, Size, Slider, Text,
|
||||
Vector, VerticalAlignment,
|
||||
alignment, slider, Alignment, Canvas, Color, Column, Element, Length,
|
||||
Point, Rectangle, Row, Sandbox, Settings, Size, Slider, Text, Vector,
|
||||
};
|
||||
use palette::{self, Hsl, Limited, Srgb};
|
||||
use std::marker::PhantomData;
|
||||
|
|
@ -163,8 +162,8 @@ impl Theme {
|
|||
});
|
||||
|
||||
let mut text = canvas::Text {
|
||||
horizontal_alignment: HorizontalAlignment::Center,
|
||||
vertical_alignment: VerticalAlignment::Top,
|
||||
horizontal_alignment: alignment::Horizontal::Center,
|
||||
vertical_alignment: alignment::Vertical::Top,
|
||||
size: 15.0,
|
||||
..canvas::Text::default()
|
||||
};
|
||||
|
|
@ -206,7 +205,7 @@ impl Theme {
|
|||
});
|
||||
}
|
||||
|
||||
text.vertical_alignment = VerticalAlignment::Bottom;
|
||||
text.vertical_alignment = alignment::Vertical::Bottom;
|
||||
|
||||
let hsl = Hsl::from(Srgb::from(self.base));
|
||||
for i in 0..self.len() {
|
||||
|
|
@ -298,7 +297,7 @@ impl<C: 'static + ColorSpace + Copy> ColorPicker<C> {
|
|||
|
||||
Row::new()
|
||||
.spacing(10)
|
||||
.align_items(CrossAlign::Center)
|
||||
.align_items(Alignment::Center)
|
||||
.push(Text::new(C::LABEL).width(Length::Units(50)))
|
||||
.push(slider(s1, cr1, c1, move |v| C::new(v, c2, c3)))
|
||||
.push(slider(s2, cr2, c2, move |v| C::new(c1, v, c3)))
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
use iced::{
|
||||
button, Button, Column, CrossAlign, Element, Sandbox, Settings, Text,
|
||||
button, Alignment, Button, Column, Element, Sandbox, Settings, Text,
|
||||
};
|
||||
|
||||
pub fn main() -> iced::Result {
|
||||
|
|
@ -44,7 +44,7 @@ impl Sandbox for Counter {
|
|||
fn view(&mut self) -> Element<Message> {
|
||||
Column::new()
|
||||
.padding(20)
|
||||
.align_items(CrossAlign::Center)
|
||||
.align_items(Alignment::Center)
|
||||
.push(
|
||||
Button::new(&mut self.increment_button, Text::new("Increment"))
|
||||
.on_press(Message::IncrementPressed),
|
||||
|
|
|
|||
|
|
@ -84,7 +84,7 @@ mod circle {
|
|||
|
||||
use circle::Circle;
|
||||
use iced::{
|
||||
slider, Column, Container, CrossAlign, Element, Length, Sandbox, Settings,
|
||||
slider, Alignment, Column, Container, Element, Length, Sandbox, Settings,
|
||||
Slider, Text,
|
||||
};
|
||||
|
||||
|
|
@ -129,7 +129,7 @@ impl Sandbox for Example {
|
|||
.padding(20)
|
||||
.spacing(20)
|
||||
.max_width(500)
|
||||
.align_items(CrossAlign::Center)
|
||||
.align_items(Alignment::Center)
|
||||
.push(Circle::new(self.radius))
|
||||
.push(Text::new(format!("Radius: {:.2}", self.radius)))
|
||||
.push(
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
use iced::{
|
||||
button, executor, Application, Button, Column, Command, Container,
|
||||
CrossAlign, Element, Length, ProgressBar, Settings, Subscription, Text,
|
||||
button, executor, Alignment, Application, Button, Column, Command,
|
||||
Container, Element, Length, ProgressBar, Settings, Subscription, Text,
|
||||
};
|
||||
|
||||
mod download;
|
||||
|
|
@ -83,7 +83,7 @@ impl Application for Example {
|
|||
.on_press(Message::Add)
|
||||
.padding(10),
|
||||
)
|
||||
.align_items(CrossAlign::End);
|
||||
.align_items(Alignment::End);
|
||||
|
||||
Container::new(downloads)
|
||||
.width(Length::Fill)
|
||||
|
|
@ -182,7 +182,7 @@ impl Download {
|
|||
}
|
||||
State::Finished { button } => Column::new()
|
||||
.spacing(10)
|
||||
.align_items(CrossAlign::Center)
|
||||
.align_items(Alignment::Center)
|
||||
.push(Text::new("Download finished!"))
|
||||
.push(
|
||||
Button::new(button, Text::new("Start again"))
|
||||
|
|
@ -195,7 +195,7 @@ impl Download {
|
|||
}
|
||||
State::Errored { button } => Column::new()
|
||||
.spacing(10)
|
||||
.align_items(CrossAlign::Center)
|
||||
.align_items(Alignment::Center)
|
||||
.push(Text::new("Something went wrong :("))
|
||||
.push(
|
||||
Button::new(button, Text::new("Try again"))
|
||||
|
|
@ -207,7 +207,7 @@ impl Download {
|
|||
Column::new()
|
||||
.spacing(10)
|
||||
.padding(10)
|
||||
.align_items(CrossAlign::Center)
|
||||
.align_items(Alignment::Center)
|
||||
.push(progress_bar)
|
||||
.push(control)
|
||||
.into()
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
use iced::{
|
||||
button, executor, Application, Button, Checkbox, Column, Command,
|
||||
Container, CrossAlign, Element, HorizontalAlignment, Length, Settings,
|
||||
Subscription, Text,
|
||||
alignment, button, executor, Alignment, Application, Button, Checkbox,
|
||||
Column, Command, Container, Element, Length, Settings, Subscription, Text,
|
||||
};
|
||||
use iced_native::{window, Event};
|
||||
|
||||
|
|
@ -91,14 +90,14 @@ impl Application for Events {
|
|||
&mut self.exit,
|
||||
Text::new("Exit")
|
||||
.width(Length::Fill)
|
||||
.horizontal_alignment(HorizontalAlignment::Center),
|
||||
.horizontal_alignment(alignment::Horizontal::Center),
|
||||
)
|
||||
.width(Length::Units(100))
|
||||
.padding(10)
|
||||
.on_press(Message::Exit);
|
||||
|
||||
let content = Column::new()
|
||||
.align_items(CrossAlign::Center)
|
||||
.align_items(Alignment::Center)
|
||||
.spacing(20)
|
||||
.push(events)
|
||||
.push(toggle)
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ use iced::slider::{self, Slider};
|
|||
use iced::time;
|
||||
use iced::window;
|
||||
use iced::{
|
||||
Application, Checkbox, Column, Command, Container, CrossAlign, Element,
|
||||
Alignment, Application, Checkbox, Column, Command, Container, Element,
|
||||
Length, Row, Settings, Subscription, Text,
|
||||
};
|
||||
use preset::Preset;
|
||||
|
|
@ -158,10 +158,10 @@ impl Application for GameOfLife {
|
|||
mod grid {
|
||||
use crate::Preset;
|
||||
use iced::{
|
||||
alignment,
|
||||
canvas::event::{self, Event},
|
||||
canvas::{self, Cache, Canvas, Cursor, Frame, Geometry, Path, Text},
|
||||
mouse, Color, Element, HorizontalAlignment, Length, Point, Rectangle,
|
||||
Size, Vector, VerticalAlignment,
|
||||
mouse, Color, Element, Length, Point, Rectangle, Size, Vector,
|
||||
};
|
||||
use rustc_hash::{FxHashMap, FxHashSet};
|
||||
use std::future::Future;
|
||||
|
|
@ -498,8 +498,8 @@ mod grid {
|
|||
color: Color::WHITE,
|
||||
size: 14.0,
|
||||
position: Point::new(frame.width(), frame.height()),
|
||||
horizontal_alignment: HorizontalAlignment::Right,
|
||||
vertical_alignment: VerticalAlignment::Bottom,
|
||||
horizontal_alignment: alignment::Horizontal::Right,
|
||||
vertical_alignment: alignment::Vertical::Bottom,
|
||||
..Text::default()
|
||||
};
|
||||
|
||||
|
|
@ -844,7 +844,7 @@ impl Controls {
|
|||
|
||||
let speed_controls = Row::new()
|
||||
.width(Length::Fill)
|
||||
.align_items(CrossAlign::Center)
|
||||
.align_items(Alignment::Center)
|
||||
.spacing(10)
|
||||
.push(
|
||||
Slider::new(
|
||||
|
|
@ -860,7 +860,7 @@ impl Controls {
|
|||
Row::new()
|
||||
.padding(10)
|
||||
.spacing(20)
|
||||
.align_items(CrossAlign::Center)
|
||||
.align_items(Alignment::Center)
|
||||
.push(playback_controls)
|
||||
.push(speed_controls)
|
||||
.push(
|
||||
|
|
|
|||
|
|
@ -161,7 +161,7 @@ mod rainbow {
|
|||
}
|
||||
|
||||
use iced::{
|
||||
scrollable, Column, Container, CrossAlign, Element, Length, Sandbox,
|
||||
scrollable, Alignment, Column, Container, Element, Length, Sandbox,
|
||||
Scrollable, Settings, Text,
|
||||
};
|
||||
use rainbow::Rainbow;
|
||||
|
|
@ -194,7 +194,7 @@ impl Sandbox for Example {
|
|||
.padding(20)
|
||||
.spacing(20)
|
||||
.max_width(500)
|
||||
.align_items(CrossAlign::Start)
|
||||
.align_items(Alignment::Start)
|
||||
.push(Rainbow::new())
|
||||
.push(Text::new(
|
||||
"In this example we draw a custom widget Rainbow, using \
|
||||
|
|
|
|||
|
|
@ -1,7 +1,8 @@
|
|||
use iced_glow::Renderer;
|
||||
use iced_glutin::slider;
|
||||
use iced_glutin::{
|
||||
slider, Color, Column, Command, CrossAlign, Element, Length, Program, Row,
|
||||
Slider, Text,
|
||||
Alignment, Color, Column, Command, Element, Length, Program, Row, Slider,
|
||||
Text,
|
||||
};
|
||||
|
||||
pub struct Controls {
|
||||
|
|
@ -79,11 +80,11 @@ impl Program for Controls {
|
|||
Row::new()
|
||||
.width(Length::Fill)
|
||||
.height(Length::Fill)
|
||||
.align_items(CrossAlign::End)
|
||||
.align_items(Alignment::End)
|
||||
.push(
|
||||
Column::new()
|
||||
.width(Length::Fill)
|
||||
.align_items(CrossAlign::End)
|
||||
.align_items(Alignment::End)
|
||||
.push(
|
||||
Column::new()
|
||||
.padding(10)
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
use iced_wgpu::Renderer;
|
||||
use iced_winit::{
|
||||
slider, Color, Column, Command, CrossAlign, Element, Length, Program, Row,
|
||||
slider, Alignment, Color, Column, Command, Element, Length, Program, Row,
|
||||
Slider, Text,
|
||||
};
|
||||
|
||||
|
|
@ -79,11 +79,11 @@ impl Program for Controls {
|
|||
Row::new()
|
||||
.width(Length::Fill)
|
||||
.height(Length::Fill)
|
||||
.align_items(CrossAlign::End)
|
||||
.align_items(Alignment::End)
|
||||
.push(
|
||||
Column::new()
|
||||
.width(Length::Fill)
|
||||
.align_items(CrossAlign::End)
|
||||
.align_items(Alignment::End)
|
||||
.push(
|
||||
Column::new()
|
||||
.padding(10)
|
||||
|
|
|
|||
|
|
@ -1,8 +1,7 @@
|
|||
use iced::{
|
||||
button, executor, keyboard, pane_grid, scrollable, Application, Button,
|
||||
Color, Column, Command, Container, CrossAlign, Element,
|
||||
HorizontalAlignment, Length, PaneGrid, Row, Scrollable, Settings,
|
||||
Subscription, Text,
|
||||
alignment, button, executor, keyboard, pane_grid, scrollable, Alignment,
|
||||
Application, Button, Color, Column, Command, Container, Element, Length,
|
||||
PaneGrid, Row, Scrollable, Settings, Subscription, Text,
|
||||
};
|
||||
use iced_native::{event, subscription, Event};
|
||||
|
||||
|
|
@ -293,7 +292,7 @@ impl Content {
|
|||
state,
|
||||
Text::new(label)
|
||||
.width(Length::Fill)
|
||||
.horizontal_alignment(HorizontalAlignment::Center)
|
||||
.horizontal_alignment(alignment::Horizontal::Center)
|
||||
.size(16),
|
||||
)
|
||||
.width(Length::Fill)
|
||||
|
|
@ -330,7 +329,7 @@ impl Content {
|
|||
let content = Scrollable::new(scroll)
|
||||
.width(Length::Fill)
|
||||
.spacing(10)
|
||||
.align_items(CrossAlign::Center)
|
||||
.align_items(Alignment::Center)
|
||||
.push(controls);
|
||||
|
||||
Container::new(content)
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
use iced::{
|
||||
pick_list, scrollable, Container, CrossAlign, Element, Length, PickList,
|
||||
pick_list, scrollable, Alignment, Container, Element, Length, PickList,
|
||||
Sandbox, Scrollable, Settings, Space, Text,
|
||||
};
|
||||
|
||||
|
|
@ -49,7 +49,7 @@ impl Sandbox for Example {
|
|||
|
||||
let mut content = Scrollable::new(&mut self.scroll)
|
||||
.width(Length::Fill)
|
||||
.align_items(CrossAlign::Center)
|
||||
.align_items(Alignment::Center)
|
||||
.spacing(10)
|
||||
.push(Space::with_height(Length::Units(600)))
|
||||
.push(Text::new("Which is your favorite language?"))
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
use iced::{
|
||||
button, futures, image, Application, Button, Column, Command, Container,
|
||||
CrossAlign, Element, Length, Row, Settings, Text,
|
||||
button, futures, image, Alignment, Application, Button, Column, Command,
|
||||
Container, Element, Length, Row, Settings, Text,
|
||||
};
|
||||
|
||||
pub fn main() -> iced::Result {
|
||||
|
|
@ -85,14 +85,14 @@ impl Application for Pokedex {
|
|||
Pokedex::Loaded { pokemon, search } => Column::new()
|
||||
.max_width(500)
|
||||
.spacing(20)
|
||||
.align_items(CrossAlign::End)
|
||||
.align_items(Alignment::End)
|
||||
.push(pokemon.view())
|
||||
.push(
|
||||
button(search, "Keep searching!").on_press(Message::Search),
|
||||
),
|
||||
Pokedex::Errored { try_again, .. } => Column::new()
|
||||
.spacing(20)
|
||||
.align_items(CrossAlign::End)
|
||||
.align_items(Alignment::End)
|
||||
.push(Text::new("Whoops! Something went wrong...").size(40))
|
||||
.push(button(try_again, "Try again").on_press(Message::Search)),
|
||||
};
|
||||
|
|
@ -121,7 +121,7 @@ impl Pokemon {
|
|||
fn view(&mut self) -> Element<Message> {
|
||||
Row::new()
|
||||
.spacing(20)
|
||||
.align_items(CrossAlign::Center)
|
||||
.align_items(Alignment::Center)
|
||||
.push(image::Viewer::new(
|
||||
&mut self.image_viewer,
|
||||
self.image.clone(),
|
||||
|
|
@ -131,7 +131,7 @@ impl Pokemon {
|
|||
.spacing(20)
|
||||
.push(
|
||||
Row::new()
|
||||
.align_items(CrossAlign::Center)
|
||||
.align_items(Alignment::Center)
|
||||
.spacing(20)
|
||||
.push(
|
||||
Text::new(&self.name)
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
use iced::qr_code::{self, QRCode};
|
||||
use iced::text_input::{self, TextInput};
|
||||
use iced::{
|
||||
Column, Container, CrossAlign, Element, Length, Sandbox, Settings, Text,
|
||||
Alignment, Column, Container, Element, Length, Sandbox, Settings, Text,
|
||||
};
|
||||
|
||||
pub fn main() -> iced::Result {
|
||||
|
|
@ -62,7 +62,7 @@ impl Sandbox for QRGenerator {
|
|||
let mut content = Column::new()
|
||||
.width(Length::Units(700))
|
||||
.spacing(20)
|
||||
.align_items(CrossAlign::Center)
|
||||
.align_items(Alignment::Center)
|
||||
.push(title)
|
||||
.push(input);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
use iced::{
|
||||
button, executor, time, Application, Button, Column, Command, Container,
|
||||
CrossAlign, Element, HorizontalAlignment, Length, Row, Settings,
|
||||
Subscription, Text,
|
||||
alignment, button, executor, time, Alignment, Application, Button, Column,
|
||||
Command, Container, Element, Length, Row, Settings, Subscription, Text,
|
||||
};
|
||||
use std::time::{Duration, Instant};
|
||||
|
||||
|
|
@ -104,7 +103,7 @@ impl Application for Stopwatch {
|
|||
Button::new(
|
||||
state,
|
||||
Text::new(label)
|
||||
.horizontal_alignment(HorizontalAlignment::Center),
|
||||
.horizontal_alignment(alignment::Horizontal::Center),
|
||||
)
|
||||
.min_width(80)
|
||||
.padding(10)
|
||||
|
|
@ -130,7 +129,7 @@ impl Application for Stopwatch {
|
|||
.push(reset_button);
|
||||
|
||||
let content = Column::new()
|
||||
.align_items(CrossAlign::Center)
|
||||
.align_items(Alignment::Center)
|
||||
.spacing(20)
|
||||
.push(duration)
|
||||
.push(controls);
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
use iced::{
|
||||
button, scrollable, slider, text_input, Button, Checkbox, Column,
|
||||
Container, CrossAlign, Element, Length, ProgressBar, Radio, Row, Rule,
|
||||
Sandbox, Scrollable, Settings, Slider, Space, Text, TextInput, Toggler,
|
||||
button, scrollable, slider, text_input, Alignment, Button, Checkbox,
|
||||
Column, Container, Element, Length, ProgressBar, Radio, Row, Rule, Sandbox,
|
||||
Scrollable, Settings, Slider, Space, Text, TextInput, Toggler,
|
||||
};
|
||||
|
||||
pub fn main() -> iced::Result {
|
||||
|
|
@ -132,7 +132,7 @@ impl Sandbox for Styling {
|
|||
Row::new()
|
||||
.spacing(10)
|
||||
.height(Length::Units(100))
|
||||
.align_items(CrossAlign::Center)
|
||||
.align_items(Alignment::Center)
|
||||
.push(scrollable)
|
||||
.push(Rule::vertical(38).style(self.theme))
|
||||
.push(
|
||||
|
|
|
|||
|
|
@ -1,7 +1,10 @@
|
|||
use iced::alignment::{self, Alignment};
|
||||
use iced::button::{self, Button};
|
||||
use iced::scrollable::{self, Scrollable};
|
||||
use iced::text_input::{self, TextInput};
|
||||
use iced::{
|
||||
button, scrollable, text_input, Application, Button, Checkbox, Column,
|
||||
Command, Container, CrossAlign, Element, Font, HorizontalAlignment, Length,
|
||||
Row, Scrollable, Settings, Text, TextInput,
|
||||
Application, Checkbox, Column, Command, Container, Element, Font, Length,
|
||||
Row, Settings, Text,
|
||||
};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
|
|
@ -151,7 +154,7 @@ impl Application for Todos {
|
|||
.width(Length::Fill)
|
||||
.size(100)
|
||||
.color([0.5, 0.5, 0.5])
|
||||
.horizontal_alignment(HorizontalAlignment::Center);
|
||||
.horizontal_alignment(alignment::Horizontal::Center);
|
||||
|
||||
let input = TextInput::new(
|
||||
input,
|
||||
|
|
@ -295,7 +298,7 @@ impl Task {
|
|||
|
||||
Row::new()
|
||||
.spacing(20)
|
||||
.align_items(CrossAlign::Center)
|
||||
.align_items(Alignment::Center)
|
||||
.push(checkbox)
|
||||
.push(
|
||||
Button::new(edit_button, edit_icon())
|
||||
|
|
@ -320,7 +323,7 @@ impl Task {
|
|||
|
||||
Row::new()
|
||||
.spacing(20)
|
||||
.align_items(CrossAlign::Center)
|
||||
.align_items(Alignment::Center)
|
||||
.push(text_input)
|
||||
.push(
|
||||
Button::new(
|
||||
|
|
@ -369,7 +372,7 @@ impl Controls {
|
|||
|
||||
Row::new()
|
||||
.spacing(20)
|
||||
.align_items(CrossAlign::Center)
|
||||
.align_items(Alignment::Center)
|
||||
.push(
|
||||
Text::new(&format!(
|
||||
"{} {} left",
|
||||
|
|
@ -431,7 +434,7 @@ impl Filter {
|
|||
fn loading_message<'a>() -> Element<'a, Message> {
|
||||
Container::new(
|
||||
Text::new("Loading...")
|
||||
.horizontal_alignment(HorizontalAlignment::Center)
|
||||
.horizontal_alignment(alignment::Horizontal::Center)
|
||||
.size(50),
|
||||
)
|
||||
.width(Length::Fill)
|
||||
|
|
@ -445,7 +448,7 @@ fn empty_message<'a>(message: &str) -> Element<'a, Message> {
|
|||
Text::new(message)
|
||||
.width(Length::Fill)
|
||||
.size(25)
|
||||
.horizontal_alignment(HorizontalAlignment::Center)
|
||||
.horizontal_alignment(alignment::Horizontal::Center)
|
||||
.color([0.7, 0.7, 0.7]),
|
||||
)
|
||||
.width(Length::Fill)
|
||||
|
|
@ -464,7 +467,7 @@ fn icon(unicode: char) -> Text {
|
|||
Text::new(&unicode.to_string())
|
||||
.font(ICONS)
|
||||
.width(Length::Units(20))
|
||||
.horizontal_alignment(HorizontalAlignment::Center)
|
||||
.horizontal_alignment(alignment::Horizontal::Center)
|
||||
.size(20)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,8 +1,7 @@
|
|||
use iced::tooltip::{self, Tooltip};
|
||||
use iced::{
|
||||
button, Button, Column, Container, CrossAlign, Element,
|
||||
HorizontalAlignment, Length, Row, Sandbox, Settings, Text,
|
||||
VerticalAlignment,
|
||||
alignment, button, Alignment, Button, Column, Container, Element, Length,
|
||||
Row, Sandbox, Settings, Text,
|
||||
};
|
||||
|
||||
pub fn main() {
|
||||
|
|
@ -61,7 +60,7 @@ impl Sandbox for Example {
|
|||
])
|
||||
.width(Length::Fill)
|
||||
.height(Length::Fill)
|
||||
.align_items(CrossAlign::Center)
|
||||
.align_items(Alignment::Center)
|
||||
.spacing(50);
|
||||
|
||||
let follow_cursor = tooltip(
|
||||
|
|
@ -105,8 +104,8 @@ fn tooltip<'a>(
|
|||
.size(40)
|
||||
.width(Length::Fill)
|
||||
.height(Length::Fill)
|
||||
.horizontal_alignment(HorizontalAlignment::Center)
|
||||
.vertical_alignment(VerticalAlignment::Center),
|
||||
.horizontal_alignment(alignment::Horizontal::Center)
|
||||
.vertical_alignment(alignment::Vertical::Center),
|
||||
)
|
||||
.on_press(Message)
|
||||
.width(Length::Fill)
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
use iced::{
|
||||
button, scrollable, slider, text_input, Button, Checkbox, Color, Column,
|
||||
Container, Element, HorizontalAlignment, Image, Length, Radio, Row,
|
||||
Sandbox, Scrollable, Settings, Slider, Space, Text, TextInput, Toggler,
|
||||
alignment, button, scrollable, slider, text_input, Button, Checkbox, Color,
|
||||
Column, Container, Element, Image, Length, Radio, Row, Sandbox, Scrollable,
|
||||
Settings, Slider, Space, Text, TextInput, Toggler,
|
||||
};
|
||||
|
||||
pub fn main() -> iced::Result {
|
||||
|
|
@ -419,7 +419,7 @@ impl<'a> Step {
|
|||
.push(
|
||||
Text::new(&value.to_string())
|
||||
.width(Length::Fill)
|
||||
.horizontal_alignment(HorizontalAlignment::Center),
|
||||
.horizontal_alignment(alignment::Horizontal::Center),
|
||||
)
|
||||
}
|
||||
|
||||
|
|
@ -466,7 +466,7 @@ impl<'a> Step {
|
|||
.push(
|
||||
Text::new(&format!("{} px", spacing))
|
||||
.width(Length::Fill)
|
||||
.horizontal_alignment(HorizontalAlignment::Center),
|
||||
.horizontal_alignment(alignment::Horizontal::Center),
|
||||
);
|
||||
|
||||
Self::container("Rows and columns")
|
||||
|
|
@ -591,7 +591,7 @@ impl<'a> Step {
|
|||
.push(
|
||||
Text::new(&format!("Width: {} px", width.to_string()))
|
||||
.width(Length::Fill)
|
||||
.horizontal_alignment(HorizontalAlignment::Center),
|
||||
.horizontal_alignment(alignment::Horizontal::Center),
|
||||
)
|
||||
}
|
||||
|
||||
|
|
@ -612,7 +612,7 @@ impl<'a> Step {
|
|||
Text::new("You are halfway there!")
|
||||
.width(Length::Fill)
|
||||
.size(30)
|
||||
.horizontal_alignment(HorizontalAlignment::Center),
|
||||
.horizontal_alignment(alignment::Horizontal::Center),
|
||||
)
|
||||
.push(Column::new().height(Length::Units(4096)))
|
||||
.push(ferris(300))
|
||||
|
|
@ -620,7 +620,7 @@ impl<'a> Step {
|
|||
Text::new("You made it!")
|
||||
.width(Length::Fill)
|
||||
.size(50)
|
||||
.horizontal_alignment(HorizontalAlignment::Center),
|
||||
.horizontal_alignment(alignment::Horizontal::Center),
|
||||
)
|
||||
}
|
||||
|
||||
|
|
@ -662,7 +662,7 @@ impl<'a> Step {
|
|||
value
|
||||
})
|
||||
.width(Length::Fill)
|
||||
.horizontal_alignment(HorizontalAlignment::Center),
|
||||
.horizontal_alignment(alignment::Horizontal::Center),
|
||||
)
|
||||
}
|
||||
|
||||
|
|
@ -680,7 +680,7 @@ impl<'a> Step {
|
|||
Element::new(
|
||||
Text::new("Not available on web yet!")
|
||||
.color([0.7, 0.7, 0.7])
|
||||
.horizontal_alignment(HorizontalAlignment::Center),
|
||||
.horizontal_alignment(alignment::Horizontal::Center),
|
||||
)
|
||||
} else {
|
||||
Element::new(Checkbox::new(
|
||||
|
|
@ -725,7 +725,7 @@ fn button<'a, Message: Clone>(
|
|||
) -> Button<'a, Message> {
|
||||
Button::new(
|
||||
state,
|
||||
Text::new(label).horizontal_alignment(HorizontalAlignment::Center),
|
||||
Text::new(label).horizontal_alignment(alignment::Horizontal::Center),
|
||||
)
|
||||
.padding(12)
|
||||
.min_width(100)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue