Random junk changes

This commit is contained in:
Imbus 2024-06-09 00:51:03 +02:00
parent 6879983f77
commit 9f6a131f11
2 changed files with 6 additions and 5 deletions

View file

@ -26,7 +26,7 @@ pub fn main() -> iced::Result {
width: 800.0, width: 800.0,
height: 600.0, height: 600.0,
}, },
resizable: false, resizable: true,
decorations: true, decorations: true,
..window::Settings::default() ..window::Settings::default()
}, },
@ -70,6 +70,7 @@ impl Sandbox for Counter {
match message { match message {
Message::InputChanged(value) => { Message::InputChanged(value) => {
self.input_val = value.clone(); self.input_val = value.clone();
println!("InputChanged: {}", value);
if let Ok(value) = value.parse::<i32>() { if let Ok(value) = value.parse::<i32>() {
self.value = value; self.value = value;
} }
@ -90,10 +91,9 @@ impl Sandbox for Counter {
} }
] ]
.width(Length::Fill) .width(Length::Fill)
.padding([55, 0]) .padding([0, 0])
.align_items(Alignment::Center) .align_items(Alignment::Center)
.into() .into()
// row![TextInput::new("Search", &self.input_val).on_input(Message::InputChanged)].into()
} }
fn theme(&self) -> Theme { fn theme(&self) -> Theme {

View file

@ -11,6 +11,7 @@ use crate::{message::Message::*, Counter};
pub fn search_bar(state: &Counter) -> Element<Message> { pub fn search_bar(state: &Counter) -> Element<Message> {
row![TextInput::new("Search", &state.input_val) row![TextInput::new("Search", &state.input_val)
.on_input(Message::InputChanged) .on_input(Message::InputChanged)
.padding(Padding::from(15))
.width(300)] .width(300)]
.into() .into()
} }
@ -29,8 +30,8 @@ pub fn tabs(state: &Counter) -> Element<Message> {
menu_tab_button("Settings", Tab::Settings), menu_tab_button("Settings", Tab::Settings),
] ]
.padding(10) .padding(10)
.spacing(20) // .spacing(20)
.width(300) .width(Length::Fixed(200f32))
.height(Length::Shrink) .height(Length::Shrink)
.into() .into()
} }