code cleanup
This commit is contained in:
+7
-19
@@ -12,6 +12,7 @@ use iced::alignment::Vertical::Center;
|
||||
use iced::widget::button::Style;
|
||||
use iced::widget::button::{danger, text};
|
||||
use iced::widget::space::horizontal;
|
||||
use iced::widget::text_input::default;
|
||||
use iced::widget::*;
|
||||
use iced::{Border, Color, Length, Shadow, Task};
|
||||
use rand::random_range;
|
||||
@@ -21,8 +22,6 @@ use std::ops::Add;
|
||||
use std::path::PathBuf;
|
||||
use std::sync::{Arc, Mutex};
|
||||
use std::time::{Duration, Instant};
|
||||
use iced::widget::text_input::default;
|
||||
use DictionaryMessage::Back;
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct DictionaryState {
|
||||
@@ -295,12 +294,10 @@ impl DictionaryState {
|
||||
iced::widget::column![
|
||||
self.groups_panel(),
|
||||
self.words_list(),
|
||||
button("Добавить слово")
|
||||
.style(jl_button)
|
||||
.on_press(NewWord),
|
||||
].spacing(5),
|
||||
button("Добавить слово").style(jl_button).on_press(NewWord),
|
||||
]
|
||||
.spacing(5),
|
||||
self.filters(),
|
||||
|
||||
]
|
||||
.spacing(5)
|
||||
.into(),
|
||||
@@ -340,10 +337,7 @@ impl DictionaryState {
|
||||
|
||||
let mut line = Row::new().width(Length::Fill).align_y(Center);
|
||||
line = line
|
||||
.push(
|
||||
checkbox(self.include_map[i])
|
||||
.on_toggle(move |b| Include(i, b)),
|
||||
)
|
||||
.push(checkbox(self.include_map[i]).on_toggle(move |b| Include(i, b)))
|
||||
.push(space().width(10));
|
||||
|
||||
line = line.push(
|
||||
@@ -396,9 +390,7 @@ impl DictionaryState {
|
||||
});
|
||||
}
|
||||
|
||||
button("")
|
||||
.on_press(WordAction(i))
|
||||
.width(15)
|
||||
button("").on_press(WordAction(i)).width(15)
|
||||
};
|
||||
|
||||
line = line.push(line_button()).push(space().width(10));
|
||||
@@ -524,11 +516,7 @@ impl DictionaryState {
|
||||
|
||||
fn groups_panel(&self) -> iced::Element<'_, DictionaryMessage> {
|
||||
let mut row = Row::new();
|
||||
row = row.push(
|
||||
button("+")
|
||||
.style(text)
|
||||
.on_press(CreateGroup),
|
||||
);
|
||||
row = row.push(button("+").style(text).on_press(CreateGroup));
|
||||
|
||||
let state = &self.state.lock().unwrap();
|
||||
let groups = &state.word_groups;
|
||||
|
||||
Reference in New Issue
Block a user