modified: src/main.rs

modified:   src/theme.rs
	modified:   src/widget.rs
This commit is contained in:
Michael Wain 2024-12-14 03:59:06 +03:00
parent 2c671f6228
commit 1598329342
3 changed files with 24 additions and 11 deletions

View File

@ -3,7 +3,7 @@ use iced::widget::button::{Status, Style};
use iced::{Background, Border, Color};
use iced::Length::Fill;
use iced::{widget::container, window, Theme, Element, Settings, Task as Command};
use iced::widget::{button, column, pick_list, radio, text, Column, Container, scrollable};
use iced::widget::{button, column, pick_list, radio, row, scrollable, text, Column, Container};
mod disk_util;
mod ipod_util;
@ -48,7 +48,8 @@ impl App {
}
App::Loaded(state) => {
//return state.tab_panel.view();
return container(widget::basic_btn("Test!")).into();
return container(row![ widget::basic_btn("About iLoader") ]).into();
}
}
}

View File

@ -1,17 +1,20 @@
use iced::theme::Palette;
use iced::widget::button::{Status, Style};
use iced::{Background, Border, Color, Font};
use iced::{Background, Border, Color, Font, Shadow, Vector};
use iced::Length::Fill;
use iced::{widget::container, window, Theme, Element, Settings, Task as Command};
use iced::widget::{button, column, pick_list, radio, text, Column, Container, scrollable};
pub const SF_FONT = Font::External {
pub const SF_FONT: iced::Font = Font {
family: iced::font::Family::Name("SF Pro Text"),
weight: iced::font::Weight::Normal,
stretch: iced::font::Stretch::Normal,
style: iced::font::Style::Normal,
};
pub fn get_default_theme() -> Theme {
Theme::custom("Glossy".to_string(), Palette {
background: Color::from_rgb8(255, 255, 255),
background: Color::from_rgb8(236, 236, 236),
text: Color::from_rgb8(0, 0, 0),
primary: Color::from_rgb8(0, 122, 255),
success: Color::from_rgb8(52, 199, 89),
@ -21,13 +24,18 @@ pub fn get_default_theme() -> Theme {
pub fn basic_button_theme(theme: &Theme, _status: Status) -> Style {
Style {
background: Some(Background::Color(Color::from_rgb8(0, 0, 0))),
text_color: Color::from_rgb8(255, 255, 255), // theme.palette().text
background: Some(Background::Color(Color::from_rgb8(255, 255, 255))),
text_color: Color::from_rgb8(0, 0, 0), // theme.palette().text
border: Border {
color: Color::TRANSPARENT,
width: 0.0,
radius: 5.0.into(),
},
shadow: Shadow {
color: Color::from_rgba8(0, 0, 0, 0.1),
offset: Vector::new(0.0, 1.0),
blur_radius: 0.1,
},
..Default::default()
}
}

View File

@ -1,9 +1,13 @@
use iced::{widget::{button, container, text}, Length::Fill};
use iced::{widget::{button, container, text}, Length::Fill, Padding};
use crate::{theme, Message};
pub fn basic_btn(s: &str) -> button::Button<Message> {
//button(text(str).center().font(theme::SF_FONT).size(13.0).line_height(16.)).width(109).height(22).style(theme::basic_button_theme)
button(text(s).center().font(theme::SF_FONT).size(13.0).line_height(1.6)).width(109).style(theme::basic_button_theme)
button(container(text(s).center().font(theme::SF_FONT).size(13.0).line_height(1.)).padding(Padding {
top: 6.,
right: 8.,
bottom: 6.,
left: 8.,
})).style(theme::basic_button_theme)
}