modified: src/theme.rs

modified:   src/widget.rs
This commit is contained in:
Michael Wain 2024-12-19 06:21:11 +03:00
parent b41e31b4be
commit f42ef80bdd
2 changed files with 31 additions and 8 deletions

View File

@ -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),

View File

@ -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<Element<'_, Message>> for SidebarGroup {
fn into(self) -> Element<'static, Message> {
container(row![
text!(),
]).into()
}
}*/
impl From<SidebarGroup> 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<Message>;
fn update(&mut self, message: Message) -> Command<Message>;
@ -76,13 +99,13 @@ pub struct SplitView {
impl SplitView {
pub fn view(&self) -> Element<Message> {
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::<Vec<Element<Message>>>()
),
if self.selected.is_some() { container((&self.selected.as_ref().unwrap().1).view()) } else { container(text!("")) }
].into()
}