Small changes

This commit is contained in:
2026-08-04 14:09:40 +03:00
parent 64fbfb5a32
commit a222233290
9 changed files with 89 additions and 46 deletions
+40 -21
View File
@@ -14,6 +14,7 @@ use iced::widget::{
button, column, container, radio, row, scrollable, space, text, text_input, Column,
};
use iced::{Background, Border, Center, Color, Element, Fill, Length, Shadow, Task, Theme};
use iced_core::Padding;
use rhai::{Engine, Scope};
use std::sync::{Arc, Mutex};
@@ -138,7 +139,6 @@ impl RepetitionsState {
.spacing(DEFAULT_SPACING)
.width(Length::FillPortion(1)),
self.selected_set_view(),
self.launch_button()
]
.align_y(Center)
.spacing(DEFAULT_SPACING)
@@ -153,9 +153,8 @@ impl RepetitionsState {
if let Some(set) = self.selected_set
&& self.state.lock().unwrap().card_sets[set].id != 0
{
return button(text!("").height(Fill).center())
.style(jl_button)
.height(200)
return button(text!("Начать повторение").width(200).center())
.style(cta_button)
.on_press(RepetitionsMessage::GoToRepetition)
.into();
}
@@ -171,18 +170,30 @@ impl RepetitionsState {
return column![
scrollable(
column![
text_input("Название набора", &set.name)
.on_input(RepetitionsMessage::SetName),
text_input("Передняя сторона", &set.forward)
.on_input(RepetitionsMessage::SetForward),
text_input("Задняя сторона", &set.backward)
.on_input(RepetitionsMessage::SetBackward),
text!("Фильтр"),
text_input("", &set.filter).on_input(RepetitionsMessage::SetFilter),
button("Проверить фильтр")
.style(jl_button)
.on_press(RepetitionsMessage::TryFilter),
self.count_view(&set),
column![
text!("Название набора"),
text_input("", &set.name).on_input(RepetitionsMessage::SetName)
]
.spacing(QUARTER_SPACING),
column![
text!("Передняя сторона"),
text_input("", &set.forward).on_input(RepetitionsMessage::SetForward),
]
.spacing(QUARTER_SPACING),
column![
text!("Задняя сторона"),
text_input("", &set.backward).on_input(RepetitionsMessage::SetBackward),
]
.spacing(QUARTER_SPACING),
column![
text!("Фильтр"),
text_input("", &set.filter).on_input(RepetitionsMessage::SetFilter),
button("Проверить фильтр")
.style(jl_button)
.on_press(RepetitionsMessage::TryFilter),
self.count_view(&set),
]
.spacing(QUARTER_SPACING),
radio(
"Обычный режим",
SetOrderMode::Default,
@@ -195,6 +206,12 @@ impl RepetitionsState {
.on_press(RepetitionsMessage::GoToHistory),
]
.spacing(DEFAULT_SPACING)
.padding(Padding {
top: 0.0,
right: DEFAULT_SPACING,
bottom: 0.0,
left: 0.0,
})
)
.height(Fill),
row![
@@ -203,15 +220,17 @@ impl RepetitionsState {
.on_press(RepetitionsMessage::Save),
button("Удалить")
.style(danger)
.on_press(RepetitionsMessage::DeleteSet)
.on_press(RepetitionsMessage::DeleteSet),
space().width(Fill),
self.launch_button()
]
.spacing(DEFAULT_SPACING),
]
.spacing(DEFAULT_SPACING)
.width(Length::FillPortion(2))
.width(Length::FillPortion(3))
.into();
}
space().width(Length::FillPortion(2)).into()
space().width(Length::FillPortion(3)).into()
}
fn words_words_view(&self, set: &CardSetSettings) -> Element<'_, RepetitionsMessage> {
@@ -261,7 +280,7 @@ impl RepetitionsState {
.on_press_with(move || RepetitionsMessage::SelectSet(i.clone()))
.style(move |_x: &Theme, status: Status| Style {
background: if status == Status::Hovered {
Some(Background::Color(Color::WHITE.scale_alpha(0.1)))
Some(Background::Color(Color::WHITE.scale_alpha(0.2)))
} else {
None
},
@@ -273,7 +292,7 @@ impl RepetitionsState {
border: Border {
color: Default::default(),
width: 0.0,
radius: 8.0.into(),
radius: BUTTON_RADIUS.into(),
},
shadow: Shadow::default(),
snap: false,