1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
use iced::{widget::Button, Element};
use crate::style::*;
pub fn active_button<'a, Content, Message>(content: &'a Content) -> Button<'a, Message>
where
Element<'a, Message>: From<&'a Content>,
{
iced::widget::button(content)
.style(|theme: &iced::Theme, _status| iced::widget::button::Style {
background: Some(iced::Background::Color(
theme.extended_palette().primary.base.text,
)),
text_color: theme.extended_palette().primary.base.color,
..Default::default()
})
.width(iced::Length::Fill)
}
pub fn inactive_button<'a, Content: Into<Element<'a, Message>>, Message>(
content: Content,
on_press: Message,
) -> Button<'a, Message> {
iced::widget::button(content)
.on_press(on_press)
.width(iced::Length::Fill)
}
pub fn panel_button<'a, Content: Into<Element<'a, Message>>, Message>(
content: Content,
on_press: Message,
) -> Button<'a, Message> {
iced::widget::button(content)
.on_press(on_press)
.style(|theme: &iced::Theme, _status| iced::widget::button::Style {
background: None,
border: iced::Border {
color: theme.extended_palette().primary.base.text,
radius: iced::border::Radius::new(0),
width: 2.0,
},
..Default::default()
})
.width(iced::Length::Fill)
.padding(iced::Padding::new(SPACING_MD.into()))
}
|