Skip to content

Commit 0a62233

Browse files
committed
Whole bunch of improvements to how it looks
1 parent 15ad3be commit 0a62233

3 files changed

Lines changed: 19 additions & 17 deletions

File tree

src/main.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,12 +134,13 @@ impl State {
134134
.id(self.text_id.clone())
135135
.on_input(Message::TextInputChanged)
136136
.on_submit(Message::TextInputSubmitted("test".to_string()))
137+
.padding(8.0)
137138
.style(|theme, status| {
138139
let mut base_style = widget::text_input::default(theme, status);
139140
base_style.border = iced::Border {
140141
color: iced::Color::TRANSPARENT,
141142
width: 0.0,
142-
radius: 0.0.into(),
143+
radius: 10.0.into(),
143144
};
144145
base_style
145146
});
@@ -246,7 +247,7 @@ fn main() -> iced::Result {
246247
.decorations(false)
247248
.antialiasing(true)
248249
.transparent(true)
249-
.window_size((800.0, 300.0))
250+
.window_size((800.0, 320.0))
250251
.theme(State::theme)
251252
// .theme(|s| iced::theme::Theme::CatppuccinMocha)
252253
// .theme(|_s| {

src/widglets/list.rs

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ use iced::widget;
33
use super::PADDING;
44
use super::{HeadingLevel, heading};
55

6+
const ICON_SIZE: f32 = 32.0;
7+
68
// pub struct ResultList<Message> {
79
// selected_index: usize,
810
// rows: Vec<ListRow<Message>>,
@@ -93,18 +95,20 @@ where
9395
.into()
9496
})
9597
.width(iced::Shrink)
96-
.height(iced::Length::Fixed(32.0)); // i dont like this
98+
.height(iced::Length::Fixed(ICON_SIZE)); // i dont like this
9799

98100
row_widget = row_widget.push(icon_widget);
99101
row_widget = row_widget.push(widget::space().width(iced::Length::Fixed(PADDING)));
100102

101-
let text_widget = widget::container(
103+
let mut text_area = widget::column(vec![]);
104+
105+
let main_name = widget::container(
102106
heading(HeadingLevel::H3, value.text, None)
103107
.align_x(iced::Left)
104108
.align_y(iced::Alignment::Center)
105109
.width(iced::Fill),
106110
);
107-
row_widget = row_widget.push(text_widget);
111+
text_area = text_area.push(main_name);
108112

109113
let subtext_widget = widget::container(
110114
heading(
@@ -115,7 +119,9 @@ where
115119
.align_x(iced::Right)
116120
.align_y(iced::Alignment::Center),
117121
);
118-
row_widget = row_widget.push(subtext_widget);
122+
text_area = text_area.push(subtext_widget);
123+
124+
row_widget = row_widget.push(text_area);
119125

120126
widget::container(
121127
widget::button(row_widget)
@@ -130,7 +136,7 @@ where
130136
match status {
131137
widget::button::Status::Hovered => {
132138
button_style =
133-
button_style.with_background(ext_pallet.primary.weak.color);
139+
button_style.with_background(ext_pallet.secondary.weak.color);
134140
}
135141
widget::button::Status::Active | widget::button::Status::Pressed => {
136142
button_style = button_style.with_background(iced::color!(0, 0, 0, 0.0));

src/widglets/mod.rs

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -60,17 +60,12 @@ pub fn heading<'a>(
6060
let mut font = font.unwrap_or(iced::Font::DEFAULT);
6161

6262
let font_mult = match level {
63-
HeadingLevel::H1 => 3.0,
64-
HeadingLevel::H2 => 2.0,
65-
HeadingLevel::H3 => 1.25,
66-
HeadingLevel::Subheading => 1.0,
63+
HeadingLevel::H1 => 2.0,
64+
HeadingLevel::H2 => 1.5,
65+
HeadingLevel::H3 => 1.0,
66+
HeadingLevel::Subheading => 0.7,
6767
};
6868

69-
// let font_color = match level {
70-
// HeadingLevel::Subheading => iced
71-
// _ => None
72-
// }
73-
7469
font.weight = match level {
7570
HeadingLevel::H1 | HeadingLevel::H2 => iced::font::Weight::Bold,
7671
_ => iced::font::Weight::Normal,
@@ -80,7 +75,7 @@ pub fn heading<'a>(
8075
.size(iced::Settings::default().default_text_size * font_mult)
8176
.style(move |theme: &iced::Theme| {
8277
let c = match level {
83-
HeadingLevel::Subheading => Some(theme.extended_palette().background.strong.text),
78+
HeadingLevel::Subheading => Some(iced::color!(140, 140, 150)),
8479
_ => None,
8580
};
8681
widget::text::Style { color: c }

0 commit comments

Comments
 (0)