use iced::Element; use iced::border::Radius; use iced::widget::button::*; use iced::widget::container; use iced_core::Length::Fill; use iced_core::alignment::Horizontal::Left; use iced_core::{Border, Theme}; pub const HALF_SPACING: f32 = DEFAULT_SPACING / 2.0; pub const QUARTER_SPACING: f32 = DEFAULT_SPACING / 4.0; pub const DEFAULT_SPACING: f32 = 16.0; pub const ACCENT_FONT_SIZE: f32 = 22.0; pub const BUTTON_RADIUS: f32 = 8.0; pub const SETTINGS_ICON: &[u8] = include_bytes!("../settings_icon.svg"); pub fn jl_button_style(theme: &Theme, status: Status) -> Style { let mut style = primary(theme, status); style.border = Border { color: Default::default(), width: 0.0, radius: Radius::new(BUTTON_RADIUS), }; style } pub fn cta_button(theme: &Theme, status: Status) -> Style { let mut style = secondary(theme, status); style.border.width = 1.0; style.border.radius = Radius::new(BUTTON_RADIUS); style } #[macro_export] macro_rules! jl_button { ($content:expr) => { iced::widget::button($content).style($crate::styling::jl_button_style) }; } pub fn back_overlay<'a, T: Clone + 'a>(content: Element<'a, T>, back_message: T) -> Element<'a, T> { container( iced::widget::column![ jl_button!("Назад").on_press(back_message), content ] .spacing(DEFAULT_SPACING) .align_x(Left) .width(Fill), ) .center_x(Fill) .padding(10) .into() }