summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPolesznyák Márk <contact@pml68.dev>2026-03-27 11:08:29 +0100
committerPolesznyák Márk <contact@pml68.dev>2026-03-27 11:08:29 +0100
commit6935709c150bf166e25ef24ee570b4a8a5b6e1b5 (patch)
tree490d99640582853bcef68065cfe87fc32ec1b9db /src
parentci: update zig and cargo-zigbuild versions (diff)
downloadiced-builder-6935709c150bf166e25ef24ee570b4a8a5b6e1b5.tar.gz
chore: necessary updates for iced-rs/iced@6690731
Diffstat (limited to 'src')
-rw-r--r--src/icon.rs2
-rw-r--r--src/main.rs40
-rw-r--r--src/panes/designer_view.rs4
-rwxr-xr-xsrc/types/rendered_element.rs22
4 files changed, 24 insertions, 44 deletions
diff --git a/src/icon.rs b/src/icon.rs
index e51ab90..2bcafcb 100644
--- a/src/icon.rs
+++ b/src/icon.rs
@@ -28,5 +28,5 @@ where
Theme: text::Catalog + 'a,
Renderer: TextRenderer<Font = Font>
{
- text(codepoint).font(Font::with_name("icons"))
+ text(codepoint).font(Font::new("icons"))
}
diff --git a/src/main.rs b/src/main.rs
index 427104a..9e2e72b 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -25,15 +25,14 @@ use iced::system::theme_changes;
use iced::theme::{self, Base};
use iced::time::Duration;
use iced::widget::{
- checkbox, column, container, pane_grid, pick_list, row, text, text_editor,
+ checkbox, column, container, pane_grid, pick_list, row, text_editor,
};
use iced::{
- Alignment, Length, Subscription, Task, border, clipboard, keyboard, window,
+ Alignment, Length, Subscription, Task, clipboard, keyboard, window,
};
use iced_anim::transition::Easing;
use iced_anim::{Animated, Animation};
use iced_material::Theme;
-use iced_material::utils::{disabled_container, disabled_text};
use panes::{code_view, designer_view, element_list};
use types::{
Action, ConfigChangeType, DesignerPane, Element, Message, Panes, Project,
@@ -244,7 +243,7 @@ impl IcedBuilder {
});
}
Message::CopyCode => {
- return clipboard::write(self.editor_content.text());
+ return clipboard::write(self.editor_content.text()).discard();
}
Message::SwitchPane(pane) => self.designer_page = pane,
Message::EditorAction(action) => {
@@ -546,31 +545,20 @@ impl IcedBuilder {
fn view(&self) -> Element<'_, Message> {
let header = row![
if self.use_system_theme {
- Element::from(
- container(text(self.config.selected_theme().to_string()))
- .padding([5, 10])
- .width(Length::Fill)
- .style(|theme: &Theme| {
- let color = theme.colors().surface.text;
- container::Style {
- background: Some(
- disabled_container(color).into(),
- ),
- text_color: Some(disabled_text(color)),
- border: border::rounded(4),
- ..Default::default()
- }
- }),
+ pick_list(
+ Some(self.theme.target()),
+ self.config.themes(),
+ Theme::to_string,
)
+ .width(Length::Fill)
} else {
- Element::from(
- pick_list(
- self.config.themes(),
- Some(self.theme.target()),
- |theme| Message::SwitchTheme(theme.into()),
- )
- .width(Length::Fill),
+ pick_list(
+ Some(self.theme.target()),
+ self.config.themes(),
+ Theme::to_string,
)
+ .on_select(|theme| Message::SwitchTheme(theme.into()))
+ .width(Length::Fill)
},
checkbox(self.use_system_theme)
.label("Use system theme")
diff --git a/src/panes/designer_view.rs b/src/panes/designer_view.rs
index 8bed248..7106024 100644
--- a/src/panes/designer_view.rs
+++ b/src/panes/designer_view.rs
@@ -14,9 +14,7 @@ pub fn view<'a>(
let el_tree: iced::Element<'a, Message> = match element_tree {
Some(tree) => center(
container(tree.clone())
- .style(|theme| {
- container::background(theme.palette().background)
- })
+ .style(|theme| container::background(theme.seed().background))
.clip(true)
.width(Shrink)
.height(Shrink),
diff --git a/src/types/rendered_element.rs b/src/types/rendered_element.rs
index 7edb3df..2784705 100755
--- a/src/types/rendered_element.rs
+++ b/src/types/rendered_element.rs
@@ -336,13 +336,13 @@ impl<'a> From<RenderedElement> for Element<'a, Message> {
})
.style(|theme: &iced::Theme| widget::container::Style {
border: iced::Border {
- color: theme.palette().primary.scale_alpha(0.6),
+ color: theme.seed().primary.scale_alpha(0.6),
width: 2.0,
radius: 4.into(),
},
background: Some(
- theme.palette().primary.scale_alpha(0.25).into(),
+ theme.seed().primary.scale_alpha(0.25).into(),
),
..Default::default()
})
@@ -361,14 +361,12 @@ impl<'a> From<RenderedElement> for Element<'a, Message> {
.padding(20)
.style(|theme: &iced::Theme| widget::container::Style {
border: iced::Border {
- color: theme.palette().danger.scale_alpha(0.6),
+ color: theme.seed().danger.scale_alpha(0.6),
width: 2.0,
radius: 4.into(),
},
- background: Some(
- theme.palette().danger.scale_alpha(0.25).into(),
- ),
+ background: Some(theme.seed().danger.scale_alpha(0.25).into()),
..Default::default()
})
.into(),
@@ -383,14 +381,12 @@ impl<'a> From<RenderedElement> for Element<'a, Message> {
.padding(20)
.style(|theme: &iced::Theme| widget::container::Style {
border: iced::Border {
- color: theme.palette().success.scale_alpha(0.6),
+ color: theme.seed().success.scale_alpha(0.6),
width: 2.0,
radius: 4.into(),
},
- background: Some(
- theme.palette().success.scale_alpha(0.25).into(),
- ),
+ background: Some(theme.seed().success.scale_alpha(0.25).into()),
..Default::default()
})
.into(),
@@ -409,14 +405,12 @@ impl<'a> From<RenderedElement> for Element<'a, Message> {
.padding(20)
.style(|theme: &iced::Theme| widget::container::Style {
border: iced::Border {
- color: theme.palette().warning.scale_alpha(0.6),
+ color: theme.seed().warning.scale_alpha(0.6),
width: 2.0,
radius: 4.into(),
},
- background: Some(
- theme.palette().warning.scale_alpha(0.25).into(),
- ),
+ background: Some(theme.seed().warning.scale_alpha(0.25).into()),
..Default::default()
})
.into(),