From f42ef80bdd00be8b8e582da372235d3da7f37a2d Mon Sep 17 00:00:00 2001 From: "alterwain@protonmail.com" Date: Thu, 19 Dec 2024 06:21:11 +0300 Subject: [PATCH] modified: src/theme.rs modified: src/widget.rs --- src/theme.rs | 2 +- src/widget.rs | 37 ++++++++++++++++++++++++++++++------- 2 files changed, 31 insertions(+), 8 deletions(-) diff --git a/src/theme.rs b/src/theme.rs index 2ad02ba..1a6d0d3 100644 --- a/src/theme.rs +++ b/src/theme.rs @@ -14,7 +14,7 @@ pub const SF_FONT: iced::Font = Font { pub fn get_default_theme() -> Theme { Theme::custom("Glossy".to_string(), Palette { - background: Color::from_rgba8(244, 245, 245, 1.0), + background: Color::from_rgba8(255, 255, 255, 1.0), // Color::from_rgba8(244, 245, 245, 1.0) text: Color::from_rgb8(0, 0, 0), primary: Color::from_rgb8(0, 122, 255), success: Color::from_rgb8(52, 199, 89), diff --git a/src/widget.rs b/src/widget.rs index 66a76a4..cd0c0ca 100644 --- a/src/widget.rs +++ b/src/widget.rs @@ -1,4 +1,4 @@ -use iced::{widget::{button, column, container, row, text}, Element, Length::Fill, Padding, Task as Command}; +use iced::{widget::{button, column, container, row, text, Column}, Element, Length::Fill, Padding, Task as Command}; use crate::{theme, Message}; @@ -40,6 +40,29 @@ impl SidebarGroup { } } +/*impl Into> for SidebarGroup { + fn into(self) -> Element<'static, Message> { + container(row![ + text!(), + + ]).into() + } +}*/ + +impl From for Element<'_, Message> { + fn from(value: SidebarGroup) -> Self { + container(row![ + text(value.name), + column( + value.tabs + .iter() + .map(|i| container(text(i.0))) + .collect() + ) + ]).into() + } +} + trait ActionWindow { fn view(&self) -> Element; fn update(&mut self, message: Message) -> Command; @@ -76,13 +99,13 @@ pub struct SplitView { impl SplitView { pub fn view(&self) -> Element { - if self.selected.is_none() { - return container("hey").into(); - } - let a = &self.selected.as_ref().unwrap().1; row![ - column! [container("lol")], - if self.selected.is_some() { container(a.view()) } else { container(text!("None")) } + column( + self.sidebar.iter_mut() + .map(|f| f.into()) + .collect::>>() + ), + if self.selected.is_some() { container((&self.selected.as_ref().unwrap().1).view()) } else { container(text!("")) } ].into() }