summaryrefslogtreecommitdiff
path: root/src/main.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs40
1 files changed, 14 insertions, 26 deletions
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")