-
Notifications
You must be signed in to change notification settings - Fork 113
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #198 from iced-rs/beta
Upgrade to latest Iced rev dd249a1d11c68b8fee1828d58bae158946ee2ebd
- Loading branch information
Showing
46 changed files
with
1,567 additions
and
697 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
[package] | ||
name = "slidebar" | ||
version = "0.1.0" | ||
authors = ["Andrew Wheeler <[email protected]>"] | ||
edition = "2021" | ||
|
||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
|
||
[dependencies] | ||
iced_aw.workspace = true | ||
iced.workspace = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
use iced::{ | ||
widget::{Column, Container, Text}, | ||
Element, Length, Sandbox, Settings, | ||
}; | ||
|
||
use iced_aw::SlideBar; | ||
|
||
fn main() -> iced::Result { | ||
SlideBarExample::run(Settings::default()) | ||
} | ||
|
||
#[derive(Debug, Clone)] | ||
enum Message { | ||
SliderBarChange(u32), | ||
} | ||
|
||
struct SlideBarExample { | ||
value: u32, | ||
} | ||
|
||
impl Sandbox for SlideBarExample { | ||
type Message = Message; | ||
|
||
fn new() -> Self { | ||
SlideBarExample { value: 1 } | ||
} | ||
|
||
fn title(&self) -> String { | ||
String::from("Slider Bar example") | ||
} | ||
|
||
fn update(&mut self, message: Message) { | ||
let Message::SliderBarChange(v) = message; | ||
self.value = v; | ||
} | ||
|
||
fn view(&self) -> Element<Message> { | ||
let bar = SlideBar::new(0..=100, self.value, Message::SliderBarChange).width(100.0); | ||
|
||
let content_all = Column::new() | ||
.spacing(10) | ||
.push( | ||
Text::new(format!("Value is {}", self.value)) | ||
.width(Length::Fill) | ||
.vertical_alignment(iced::alignment::Vertical::Center).horizontal_alignment(iced::alignment::Horizontal::Center), | ||
) | ||
.push(bar) | ||
.align_items(iced::Alignment::Center); | ||
|
||
Container::new(content_all) | ||
.width(Length::Fill) | ||
.height(Length::Fill) | ||
.center_x() | ||
.center_y() | ||
.into() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.