Skip to content

Commit

Permalink
updated some examples that dont use theme styles, Also updated select…
Browse files Browse the repository at this point in the history
…ion list to new Iced Theme Requirements
  • Loading branch information
genusistimelord committed May 22, 2024
1 parent e2da929 commit 64deedb
Show file tree
Hide file tree
Showing 35 changed files with 541 additions and 709 deletions.
41 changes: 41 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 10 additions & 11 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,16 +42,16 @@ default = [
"number_input",
"date_picker",
"color_picker",
#"grid",
"grid",
#"tab_bar",
#"tabs",
#"time_picker",
#"slide_bar",
#"wrap",
#"selection_list",
"slide_bar",
"wrap",
"selection_list",
#"quad",
#"context_menu",
#"spinner",
"spinner",
#"drop_down",
#"menu",
]
Expand Down Expand Up @@ -82,16 +82,15 @@ members = [
"examples/number_input",
"examples/date_picker",
"examples/color_picker",
#"examples/font_loading",
#"examples/grid",
"examples/grid",
#"examples/tab_bar",
#"examples/tabs",
#"examples/time_picker",
#"examples/sliderbar",
#"examples/wrap",
#"examples/selection_list",
"examples/sliderbar",
"examples/wrap",
"examples/selection_list",
#"examples/context_menu",
#"examples/spinner",
"examples/spinner",
#"examples/WidgetIDReturn",
#"examples/drop_down",
#"examples/menu",
Expand Down
12 changes: 0 additions & 12 deletions examples/font_loading/Cargo.toml

This file was deleted.

70 changes: 0 additions & 70 deletions examples/font_loading/src/main.rs

This file was deleted.

48 changes: 23 additions & 25 deletions examples/grid/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use iced::widget::{checkbox, container, pick_list, row, slider};
use iced::Padding;
use iced::{
alignment::{Horizontal, Vertical},
Color, Element, Length, Sandbox, Settings,
Color, Element, Length,
};
use iced_aw::{grid, grid_row};

Expand All @@ -17,22 +17,8 @@ struct App {
debug_layout: bool,
}

#[derive(Debug, Clone)]
enum Message {
HorizontalAlignment(Horizontal),
VerticalAlignment(Vertical),
ColumnSpacing(f32),
RowSpacing(f32),
FillWidth(bool),
FillHeight(bool),
Padding(f32),
DebugToggled(bool),
}

impl Sandbox for App {
type Message = Message;

fn new() -> Self {
impl Default for App {
fn default() -> Self {
Self {
horizontal_alignment: Horizontal::Left,
vertical_alignment: Vertical::Center,
Expand All @@ -44,12 +30,22 @@ impl Sandbox for App {
debug_layout: false,
}
}
}

fn title(&self) -> String {
"Iced Grid widget example".into()
}
#[derive(Debug, Clone)]
enum Message {
HorizontalAlignment(Horizontal),
VerticalAlignment(Vertical),
ColumnSpacing(f32),
RowSpacing(f32),
FillWidth(bool),
FillHeight(bool),
Padding(f32),
DebugToggled(bool),
}

fn update(&mut self, message: Self::Message) {
impl App {
fn update(&mut self, message: Message) {
match message {
Message::HorizontalAlignment(align) => self.horizontal_alignment = align,
Message::VerticalAlignment(align) => self.vertical_alignment = align,
Expand All @@ -62,7 +58,7 @@ impl Sandbox for App {
}
}

fn view(&self) -> iced::Element<'_, Self::Message> {
fn view(&self) -> iced::Element<'_, Message> {
let horizontal_align_pick = pick_list(
HORIZONTAL_ALIGNMENTS
.iter()
Expand Down Expand Up @@ -126,8 +122,8 @@ impl Sandbox for App {
container(contents)
.width(Length::Fill)
.height(Length::Fill)
.center_x()
.center_y()
.center_x(Length::Fill)
.center_y(Length::Fill)
.into()
}
}
Expand Down Expand Up @@ -174,5 +170,7 @@ fn string_to_vertical_align(input: &str) -> Vertical {
}

fn main() -> iced::Result {
App::run(Settings::default())
iced::program("Grid example", App::update, App::view)
.font(iced_aw::BOOTSTRAP_FONT_BYTES)
.run()
}
Loading

0 comments on commit 64deedb

Please sign in to comment.