Skip to content

Commit

Permalink
Merge pull request #64 from genusistimelord/main
Browse files Browse the repository at this point in the history
Update to Iced Master
  • Loading branch information
Kaiden42 committed Nov 12, 2022
2 parents a829763 + 5bb7727 commit 81b4dd1
Show file tree
Hide file tree
Showing 164 changed files with 3,232 additions and 17,832 deletions.
60 changes: 22 additions & 38 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,16 @@ categories = ["gui"]

[features]
badge = []
button = []
card = []
colors = []
date_picker = ["chrono", "lazy_static", "icon_text"]
color_picker = ["icon_text", "iced_graphics/canvas"]
floating_button = ["button"]
floating_element = ["button", "floating_button"]
floating_element = []
grid = []
glow = [] # TODO
icon_text = ["icons"]
icons = []
modal = []
pure = ["iced_pure"]
tab_bar = []
tabs = ["tab_bar"]
time_picker = ["chrono", "icon_text", "iced_graphics/canvas"]
Expand All @@ -38,16 +35,16 @@ default = [
"badge",
"card",
"colors",
"date_picker",
"color_picker",
"floating_button",
"number_input",
#"date_picker",
#"color_picker",
"floating_element",
"icon_text",
"grid",
"modal",
"pure",
"tab_bar",
"tabs",
"time_picker",
#"time_picker",
"wrap",
"selection_list",
"split",
Expand All @@ -62,24 +59,18 @@ lazy_static = { version = "1.4.0", optional = true }

[target.'cfg(not(target_arch = "wasm32"))'.dependencies.iced_native]
#git = "https://github.com/iced-rs/iced.git"
#rev = "ba33e92818ec181508b4957d1eae5b2beb9ea221"
version = "0.5.1"
#rev = "8221794"
version = "0.6.1"

[target.'cfg(not(target_arch = "wasm32"))'.dependencies.iced_graphics]
#git = "https://github.com/iced-rs/iced.git"
#rev = "ba33e92818ec181508b4957d1eae5b2beb9ea221"
version = "0.3.0"

[target.'cfg(not(target_arch = "wasm32"))'.dependencies.iced_pure]
#git = "https://github.com/iced-rs/iced.git"
#rev = "ba33e92818ec181508b4957d1eae5b2beb9ea221"
version = "0.2.2"
optional = true
#rev = "8221794"
version = "0.4.0"

[dependencies.iced_style]
#git = "https://github.com/iced-rs/iced.git"
#rev = "ba33e92818ec181508b4957d1eae5b2beb9ea221"
version = "0.4.0"
#rev = "8221794"
version = "0.5.0"

[profile.dev.package."*"]
opt-level = 2
Expand All @@ -90,30 +81,23 @@ members = [
"examples/card",
"examples/color_picker",
"examples/date_picker",
"examples/floating_button",
"examples/floating_element",
"examples/grid",
"examples/modal",
"examples/pure/badge",
"examples/pure/card",
"examples/pure/color_picker",
"examples/pure/date_picker",
"examples/pure/floating_element",
"examples/pure/modal",
"examples/pure/grid",
"examples/pure/split",
"examples/pure/tab_bar",
"examples/pure/tabs",
"examples/pure/time_picker",
"examples/tab_bar",
"examples/tabs",
#"examples/tabs_min",
"examples/time_picker",
"examples/wrap",
"examples/pure/wrap",
"examples/web",
"examples/number_input",
"examples/pure/number_input",
"examples/selection_list",
"examples/pure/selection_list",
"examples/split",
]

[workspace.dependencies.iced]
#git = "https://github.com/iced-rs/iced.git"
#rev = "8221794"
version = "0.5.0"

[workspace.dependencies.iced_aw]
path = "./"
default-features = false
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,13 @@ Enable this widget with the feature `date_picker`.

<center>

![Floating Button showcase](./images/showcase/floating_button.png)
![Floating Element showcase](./images/showcase/floating_button.png)

</center>

Please take a look into our examples on how to use floating buttons.
Please take a look into our examples on how to use floating elements.

Enable this widget with the feature `floating_button`.
Enable this widget with the feature `floating_element`.
To enable predefined styles for buttons, enable the feature `colors`.

### Modal
Expand Down
8 changes: 2 additions & 6 deletions examples/badge/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,8 @@ edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
iced_aw = { path = "../..", default-features = false, features = [
iced_aw = { workspace = true, features = [
"badge",
"colors",
] }

[dependencies.iced]
#git = "https://github.com/iced-rs/iced.git"
#rev = "ba33e92818ec181508b4957d1eae5b2beb9ea221"
version = "0.4.2"
iced.workspace = true
75 changes: 28 additions & 47 deletions examples/badge/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
use iced::{Alignment, Column, Container, Element, Length, Row, Sandbox, Settings, Text};

use iced_aw::{
style::{self, badge::StyleSheet},
Badge,
use iced::{
widget::{Column, Container, Row, Text},
Alignment, Element, Length, Sandbox, Settings,
};

use iced_aw::{style::BadgeStyles, Badge};

const BADGE_TEXT_SIZE: u16 = 15;

fn main() -> iced::Result {
Expand Down Expand Up @@ -37,7 +37,7 @@ impl Sandbox for BadgeExample {

fn update(&mut self, _message: Message) {}

fn view(&mut self) -> Element<Message> {
fn view(&self) -> Element<Message> {
let content = Column::new()
.push(Text::new("Messages").size(32))
.spacing(15)
Expand All @@ -53,12 +53,8 @@ impl Sandbox for BadgeExample {
.align_items(Alignment::Center)
.push(Text::new(name).width(Length::Fill))
.push(
Badge::new(
Text::new(format!("{}", count))
.color(style::colors::SNOW)
.size(BADGE_TEXT_SIZE),
)
.style(predefined_style(i)),
Badge::new(Text::new(format!("{}", count)).size(BADGE_TEXT_SIZE))
.style(predefined_style(i)),
),
)
});
Expand All @@ -69,35 +65,20 @@ impl Sandbox for BadgeExample {
.push(
Row::new()
.spacing(10)
.push(Badge::new(Text::new("Default")).style(style::badge::Default))
.push(
Badge::new(Text::new("Primary").color(style::colors::LIGHT))
.style(style::badge::Primary),
)
.push(
Badge::new(Text::new("Secondary").color(style::colors::LIGHT))
.style(style::badge::Secondary),
)
.push(
Badge::new(Text::new("Success").color(style::colors::LIGHT))
.style(style::badge::Success),
)
.push(
Badge::new(Text::new("Danger").color(style::colors::LIGHT))
.style(style::badge::Danger),
),
.push(Badge::new(Text::new("Default")))
.push(Badge::new(Text::new("Primary")).style(BadgeStyles::Primary))
.push(Badge::new(Text::new("Secondary")).style(BadgeStyles::Secondary))
.push(Badge::new(Text::new("Success")).style(BadgeStyles::Success))
.push(Badge::new(Text::new("Danger")).style(BadgeStyles::Danger)),
)
.push(
Row::new()
.spacing(10)
.push(Badge::new(Text::new("Warning")).style(style::badge::Warning))
.push(Badge::new(Text::new("Info")).style(style::badge::Info))
.push(Badge::new(Text::new("Light")).style(style::badge::Light))
.push(
Badge::new(Text::new("Dark").color(style::colors::LIGHT))
.style(style::badge::Dark),
)
.push(Badge::new(Text::new("White")).style(style::badge::White)),
.push(Badge::new(Text::new("Warning")).style(BadgeStyles::Warning))
.push(Badge::new(Text::new("Info")).style(BadgeStyles::Info))
.push(Badge::new(Text::new("Light")).style(BadgeStyles::Light))
.push(Badge::new(Text::new("Dark")).style(BadgeStyles::Dark))
.push(Badge::new(Text::new("White")).style(BadgeStyles::White)),
);

Container::new(
Expand All @@ -114,16 +95,16 @@ impl Sandbox for BadgeExample {
}
}

fn predefined_style(index: usize) -> Box<dyn StyleSheet> {
fn predefined_style(index: usize) -> BadgeStyles {
match index {
0 => style::badge::Primary.into(),
1 => style::badge::Secondary.into(),
2 => style::badge::Success.into(),
3 => style::badge::Danger.into(),
4 => style::badge::Warning.into(),
5 => style::badge::Info.into(),
6 => style::badge::Light.into(),
7 => style::badge::Dark.into(),
_ => style::badge::Default.into(),
0 => BadgeStyles::Primary,
1 => BadgeStyles::Secondary,
2 => BadgeStyles::Success,
3 => BadgeStyles::Danger,
4 => BadgeStyles::Warning,
5 => BadgeStyles::Info,
6 => BadgeStyles::Light,
7 => BadgeStyles::Dark,
_ => BadgeStyles::Default,
}
}
8 changes: 2 additions & 6 deletions examples/card/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,8 @@ edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
iced_aw = { path = "../..", default-features = false, features = [
iced_aw = { workspace = true, features = [
"card",
"colors",
] }

[dependencies.iced]
#git = "https://github.com/iced-rs/iced.git"
#rev = "ba33e92818ec181508b4957d1eae5b2beb9ea221"
version = "0.4.2"
iced.workspace = true
27 changes: 9 additions & 18 deletions examples/card/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
use iced::{
button, scrollable, Button, Column, Container, Element, Length, Sandbox, Scrollable, Settings,
Text,
widget::{Button, Column, Container, Scrollable, Text},
Element, Length, Sandbox, Settings,
};

use iced_aw::{style, Card};
use iced_aw::{style::CardStyles, Card};

fn main() -> iced::Result {
CardExample::run(Settings::default())
Expand All @@ -17,19 +16,13 @@ enum Message {

struct CardExample {
card_open: bool,
button_state: button::State,
scrollable_state: scrollable::State,
}

impl Sandbox for CardExample {
type Message = Message;

fn new() -> Self {
CardExample {
card_open: true,
button_state: button::State::new(),
scrollable_state: scrollable::State::new(),
}
CardExample { card_open: true }
}

fn title(&self) -> String {
Expand All @@ -44,7 +37,7 @@ impl Sandbox for CardExample {
}
}

fn view(&mut self) -> Element<'_, self::Message> {
fn view(&self) -> Element<'_, self::Message> {
let element: Element<'_, Message> = if self.card_open {
Card::new(
Text::new("Head"),
Expand All @@ -53,20 +46,18 @@ impl Sandbox for CardExample {
.push(Text::new("Zombie ipsum reversus ab viral inferno, nam rick grimes malum cerebro. De carne lumbering animata corpora quaeritis. Summus brains sit, morbo vel maleficia? De apocalypsi gorger omero undead survivor dictum mauris. Hi mindless mortuis soulless creaturas, imo evil stalking monstra adventus resi dentevil vultus comedat cerebella viventium. Qui animated corpse, cricket bat max brucks terribilem incessu zomby. The voodoo sacerdos flesh eater, suscitat mortuos comedere carnem virus. Zonbi tattered for solum oculi eorum defunctis go lum cerebro. Nescio brains an Undead zombies. Sicut malus putrid voodoo horror. Nigh tofth eliv ingdead."))
)
.foot(Text::new("Foot"))
.style(style::card::Primary)
.style(CardStyles::Primary)
.on_close(Message::CloseCard)
.into()
} else {
Button::new(&mut self.button_state, Text::new("Open card"))
Button::new(Text::new("Open card"))
.on_press(Message::OpenCard)
.into()
};

let content = Scrollable::new(&mut self.scrollable_state)
.max_width(600)
.push(element);
let content = Scrollable::new(element);

Container::new(content)
Container::new(Column::new().push(content).max_width(600))
.width(Length::Fill)
.height(Length::Fill)
.padding(10)
Expand Down
8 changes: 2 additions & 6 deletions examples/color_picker/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,8 @@ edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
iced_aw = { path = "../..", default-features = false, features = [
iced_aw = { workspace = true, features = [
"color_picker",
"colors",
] }

[dependencies.iced]
#git = "https://github.com/iced-rs/iced.git"
#rev = "ba33e92818ec181508b4957d1eae5b2beb9ea221"
version = "0.4.2"
iced.workspace = true
Loading

0 comments on commit 81b4dd1

Please sign in to comment.