More styling

This commit is contained in:
2026-08-01 19:36:43 +03:00
parent 9a1d68aac1
commit 42d0488f23
13 changed files with 295 additions and 253 deletions
+10 -9
View File
@@ -7,6 +7,7 @@ use iced::widget::{button, container, row, space, text, text_input, Row};
use iced::Background::Color;
use iced::{alignment, Border, Element, Fill, Task, Theme};
use rand::prelude::SliceRandom;
use crate::dictionary_test::DictionaryQuizMessage::*;
use crate::lang::WordData;
use crate::navigation::{NavigatedPage, Page};
use crate::navigation::Page::PreviousPage;
@@ -36,7 +37,7 @@ pub enum DictionaryQuizMessage {
impl NavigatedPage<DictionaryQuizMessage> for DictionaryQuizState {
fn navigate(&self, message: &DictionaryQuizMessage) -> Option<Page> {
match message {
DictionaryQuizMessage::Back => Some(PreviousPage),
Back => Some(PreviousPage),
_ => None,
}
}
@@ -64,10 +65,10 @@ impl DictionaryQuizState {
pub fn update(&mut self, message: DictionaryQuizMessage) -> Task<RootMessage> {
match message {
DictionaryQuizMessage::Back => {}
DictionaryQuizMessage::AnswerChanged(c) => self.answer = c.clone(),
DictionaryQuizMessage::SubmitAnswer => self.submit(),
DictionaryQuizMessage::Appeal => self.appeal_answer(),
Back => {}
AnswerChanged(c) => self.answer = c.clone(),
SubmitAnswer => self.submit(),
Appeal => self.appeal_answer(),
}
Task::none()
}
@@ -92,8 +93,8 @@ impl DictionaryQuizState {
text_input("Перевод", &self.answer)
.size(28)
.width(250)
.on_input(DictionaryQuizMessage::AnswerChanged)
.on_submit(DictionaryQuizMessage::SubmitAnswer),
.on_input(AnswerChanged)
.on_submit(SubmitAnswer),
row![
text!("{}", self.score.total.to_string()).size(25),
text!("{}", self.score.correct.to_string())
@@ -105,7 +106,7 @@ impl DictionaryQuizState {
]
.spacing(DEFAULT_SPACING),
row![
button("Закончить").style(jl_button).on_press(DictionaryQuizMessage::Back),
button("Закончить").style(jl_button).on_press(Back),
self.appeal_button()
]
.spacing(DEFAULT_SPACING),
@@ -206,7 +207,7 @@ impl DictionaryQuizState {
fn appeal_button(&self) -> Element<'_, DictionaryQuizMessage> {
if self.is_help && self.no_typing == false {
return button("Апелляция").style(jl_button)
.on_press(DictionaryQuizMessage::Appeal)
.on_press(Appeal)
.into();
}
space().into()