Skip to content

Commit 175b928

Browse files
authored
Update iced to v0.9 and rename project to iced_aw v0.5 (#110)
* Update iced to v0.9 and rename project to iced_aw v0.5 * cargo fmt
1 parent 49c6f99 commit 175b928

File tree

32 files changed

+386
-270
lines changed

32 files changed

+386
-270
lines changed

Cargo.toml

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "iced_aw"
3-
version = "0.4.1"
3+
version = "0.5.0"
44
authors = ["Kaiden42 <[email protected]>"]
55
edition = "2021"
66
description = "Additional widgets for the Iced GUI library"
@@ -65,17 +65,17 @@ lazy_static = { version = "1.4.0", optional = true }
6565
[target.'cfg(not(target_arch = "wasm32"))'.dependencies.iced_native]
6666
#git = "https://github.com/iced-rs/iced.git"
6767
#rev = "8221794"
68-
version = "0.9.1"
68+
version = "0.10.1"
6969

7070
[target.'cfg(not(target_arch = "wasm32"))'.dependencies.iced_graphics]
7171
#git = "https://github.com/iced-rs/iced.git"
7272
#rev = "8221794"
73-
version = "0.7.0"
73+
version = "0.8.0"
7474

7575
[dependencies.iced_style]
7676
#git = "https://github.com/iced-rs/iced.git"
7777
#rev = "8221794"
78-
version = "0.7.0"
78+
version = "0.8.0"
7979

8080
[profile.dev.package."*"]
8181
opt-level = 2
@@ -106,7 +106,7 @@ members = [
106106
[workspace.dependencies.iced]
107107
#git = "https://github.com/iced-rs/iced.git"
108108
#rev = "8221794"
109-
version = "0.8.0"
109+
version = "0.9.0"
110110

111111
[workspace.dependencies.iced_aw]
112112
path = "./"

README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ Every widget is hidden by a feature gate. This allows you to cherry pick the wid
1313
Include `iced_aw` as a dependency in your `Cargo.toml`:
1414
```toml
1515
[dependencies]
16-
iced = "0.8.0"
17-
iced_aw = { version = "0.4.1", default-features = false, features = [...] }
16+
iced = "0.9.0"
17+
iced_aw = { version = "0.5", default-features = false, features = [...] }
1818
```
1919

2020
## Versioning
@@ -24,7 +24,7 @@ iced_aw = { version = "0.4.1", default-features = false, features = [...] }
2424
| 0.4 | 0.2 |
2525
| 0.7 | 0.3 |
2626
| 0.8 | 0.4 |
27-
27+
| 0.9 | 0.5 |
2828
## Widgets
2929

3030

examples/badge/src/main.rs

+26-21
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1-
use iced::{Alignment, Element, Length, Sandbox, Settings, widget::{Column, Container, Row, Text}};
1+
use iced::{
2+
widget::{Column, Container, Row, Text},
3+
Alignment, Element, Length, Sandbox, Settings,
4+
};
25

3-
use iced_aw::{Badge, style::BadgeStyles};
6+
use iced_aw::{style::BadgeStyles, Badge};
47

58
const BADGE_TEXT_SIZE: u16 = 15;
69

@@ -40,20 +43,21 @@ impl Sandbox for BadgeExample {
4043
.spacing(15)
4144
.max_width(300);
4245

43-
let content_messages = self.messages.iter().enumerate().fold(
44-
content,
45-
|col, (i, (name, count))| {
46-
col.push(
47-
Row::new()
48-
.align_items(Alignment::Center)
49-
.push(Text::new(name).width(Length::Fill))
50-
.push(
51-
Badge::new(Text::new(format!("{count}")).size(BADGE_TEXT_SIZE))
52-
.style(predefined_style(i)),
53-
),
54-
)
55-
},
56-
);
46+
let content_messages =
47+
self.messages
48+
.iter()
49+
.enumerate()
50+
.fold(content, |col, (i, (name, count))| {
51+
col.push(
52+
Row::new()
53+
.align_items(Alignment::Center)
54+
.push(Text::new(name).width(Length::Fill))
55+
.push(
56+
Badge::new(Text::new(format!("{count}")).size(BADGE_TEXT_SIZE))
57+
.style(predefined_style(i)),
58+
),
59+
)
60+
});
5761

5862
let content_all = Column::new()
5963
.spacing(10)
@@ -82,11 +86,12 @@ impl Sandbox for BadgeExample {
8286
.spacing(40)
8387
.push(content_messages)
8488
.push(content_all),
85-
).width(Length::Fill)
86-
.height(Length::Fill)
87-
.center_x()
88-
.center_y()
89-
.into()
89+
)
90+
.width(Length::Fill)
91+
.height(Length::Fill)
92+
.center_x()
93+
.center_y()
94+
.into()
9095
}
9196
}
9297

examples/card/src/main.rs

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-
use iced::{Element, Length, Sandbox, Settings,
2-
widget::{Button, Column, Container, Scrollable, Text}};
3-
use iced_aw::{Card, style::CardStyles};
1+
use iced::{
2+
widget::{Button, Column, Container, Scrollable, Text},
3+
Element, Length, Sandbox, Settings,
4+
};
5+
use iced_aw::{style::CardStyles, Card};
46

57
fn main() -> iced::Result {
68
CardExample::run(Settings::default())

examples/color_picker/src/main.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1-
use iced::{Alignment, Color, Element, Length, Sandbox, Settings,
2-
widget::{Button, Container, Row, Text}};
1+
use iced::{
2+
widget::{Button, Container, Row, Text},
3+
Alignment, Color, Element, Length, Sandbox, Settings,
4+
};
35

46
use iced_aw::ColorPicker;
57

examples/cupertino/cupertino_spinner/Cargo.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ edition = "2021"
66
publish = false
77

88
[dependencies]
9-
iced = { version = "0.8.0", features = ["canvas", "debug", "tokio"] }
9+
iced = { workspace = true, features = ["canvas", "debug", "tokio"] }
1010
iced_aw = { path = "../../../", features = ["cupertino"] }
11-
tokio = { version = "1.26.0", features = ["time"] }
11+
tokio = { version = "1.27.0", features = ["time"] }
1212

examples/cupertino/cupertino_spinner/src/main.rs

+42-38
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
1-
use iced::{Application, Command, Element, executor, Length, Settings, Theme};
21
use iced::alignment;
32
use iced::widget::{column, container, text};
3+
use iced::{executor, Application, Command, Element, Length, Settings, Theme};
44
use iced_aw::native::cupertino::cupertino_spinner::CupertinoSpinner;
55

66
pub fn main() -> iced::Result {
7-
Spinner::run(Settings { antialiasing: true, ..Settings::default() })
7+
Spinner::run(Settings {
8+
antialiasing: true,
9+
..Settings::default()
10+
})
811
}
912

1013
#[derive(Debug, Clone)]
@@ -26,66 +29,67 @@ impl State {
2629
async fn load() -> Result<State, ()> {
2730
println!("Doing stuff...");
2831
tokio::time::sleep(tokio::time::Duration::from_secs(3)).await;
29-
return Ok(Self { hello: "Loaded!".to_string() });
32+
return Ok(Self {
33+
hello: "Loaded!".to_string(),
34+
});
3035
}
3136
}
3237

3338
impl Application for Spinner {
3439
type Executor = executor::Default;
35-
type Message = Message;
36-
type Theme = Theme;
37-
type Flags = ();
40+
type Message = Message;
41+
type Theme = Theme;
42+
type Flags = ();
3843

3944
fn new(_flags: ()) -> (Self, Command<Message>) {
40-
(Spinner::Loading, Command::perform(State::load(), Message::Loaded))
45+
(
46+
Spinner::Loading,
47+
Command::perform(State::load(), Message::Loaded),
48+
)
4149
}
4250

43-
fn title(&self) -> String { String::from("CupertinoSpinner - Iced") }
51+
fn title(&self) -> String {
52+
String::from("CupertinoSpinner - Iced")
53+
}
4454

4555
fn update(&mut self, message: Message) -> Command<Message> {
4656
match self {
47-
Spinner::Loading => {
48-
match message {
49-
Message::Loaded(Ok(state)) => {
50-
*self = Spinner::Loaded(State {
51-
hello: state.hello,
52-
});
53-
},
54-
55-
_ => ()
57+
Spinner::Loading => match message {
58+
Message::Loaded(Ok(state)) => {
59+
*self = Spinner::Loaded(State { hello: state.hello });
5660
}
57-
},
5861

59-
_ => ()
62+
_ => (),
63+
},
6064

65+
_ => (),
6166
}
6267

6368
Command::none()
6469
}
6570

6671
fn view(&self) -> Element<Message> {
6772
match self {
68-
Spinner::Loading => {
69-
container(
70-
CupertinoSpinner::new().width(Length::Fill).height(Length::Fill)
71-
).into()
72-
},
73-
74-
Spinner::Loaded(state) => {
75-
container(column![text(&state.hello)
76-
.width(Length::Fill)
77-
.size(25)
78-
.horizontal_alignment(alignment::Horizontal::Center)
79-
.vertical_alignment(alignment::Vertical::Center)
80-
])
73+
Spinner::Loading => container(
74+
CupertinoSpinner::new()
8175
.width(Length::Fill)
82-
.height(Length::Fill)
83-
.center_y()
84-
.into()
85-
},
76+
.height(Length::Fill),
77+
)
78+
.into(),
79+
80+
Spinner::Loaded(state) => container(column![text(&state.hello)
81+
.width(Length::Fill)
82+
.size(25)
83+
.horizontal_alignment(alignment::Horizontal::Center)
84+
.vertical_alignment(alignment::Vertical::Center)])
85+
.width(Length::Fill)
86+
.height(Length::Fill)
87+
.center_y()
88+
.into(),
8689
}
8790
}
8891

89-
fn theme(&self) -> Self::Theme { Theme::Light }
92+
fn theme(&self) -> Self::Theme {
93+
Theme::Light
94+
}
9095
}
91-

examples/date_picker/src/main.rs

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
1-
use iced::{Alignment, Element, Length, Sandbox, Settings, widget::{Button, Container, Row, Text}};
2-
use iced_aw::{DatePicker, date_picker::Date};
1+
use iced::{
2+
widget::{Button, Container, Row, Text},
3+
Alignment, Element, Length, Sandbox, Settings,
4+
};
5+
use iced_aw::{date_picker::Date, DatePicker};
36

47
fn main() -> iced::Result {
58
DatePickerExample::run(Settings::default())

examples/floating_element/src/main.rs

+9-5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
use iced::widget::button;
22
use iced::widget::button::Appearance;
3-
use iced::{theme, Element, Length, Sandbox, Settings, Theme,
4-
widget::{Button, Column, Container, Scrollable, Text}};
3+
use iced::{
4+
theme,
5+
widget::{Button, Column, Container, Scrollable, Text},
6+
Element, Length, Sandbox, Settings, Theme,
7+
};
58

69
use iced_aw::floating_element::{self, FloatingElement};
710
use iced_aw::{Icon, ICON_FONT};
@@ -69,9 +72,10 @@ impl Sandbox for FloatingElementExample {
6972
))))
7073
.into()
7174
},
72-
).anchor(floating_element::Anchor::SouthEast)
73-
.offset(20.0)
74-
.hide(false);
75+
)
76+
.anchor(floating_element::Anchor::SouthEast)
77+
.offset(20.0)
78+
.hide(false);
7579

7680
Container::new(content)
7781
.width(Length::Fill)

examples/floating_element_anchors/src/main.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use iced::widget::{button, container, text};
22
use iced::{Element, Length, Sandbox, Settings};
3-
use iced_aw::{FloatingElement, floating_element::Anchor};
3+
use iced_aw::{floating_element::Anchor, FloatingElement};
44

55
fn main() -> iced::Result {
66
FloatingElementAnchorsExample::run(Settings::default())

examples/grid/src/main.rs

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
1-
use iced::{theme, Alignment, Color, Element, Length, Sandbox, Settings,
2-
widget::{Button, Column, Container, Scrollable, Text}};
1+
use iced::{
2+
theme,
3+
widget::{Button, Column, Container, Scrollable, Text},
4+
Alignment, Color, Element, Length, Sandbox, Settings,
5+
};
36

47
use iced_aw::Grid;
58

0 commit comments

Comments
 (0)