code cleanup
This commit is contained in:
+13
-17
@@ -1,17 +1,17 @@
|
||||
use crate::dictionary::{split_with_coma};
|
||||
use crate::dictionary::split_with_coma;
|
||||
use crate::dictionary_test::DictionaryQuizMessage::*;
|
||||
use crate::lang::WordData;
|
||||
use crate::navigation::Page::PreviousPage;
|
||||
use crate::navigation::*;
|
||||
use crate::quiz::Score;
|
||||
use crate::{RootMessage};
|
||||
use crate::styling::*;
|
||||
use crate::RootMessage;
|
||||
use iced::border::Radius;
|
||||
use iced::widget::container::Style;
|
||||
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;
|
||||
use crate::styling::*;
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct DictionaryQuizState {
|
||||
@@ -44,11 +44,7 @@ impl NavigatedPage<DictionaryQuizMessage> for DictionaryQuizState {
|
||||
}
|
||||
|
||||
impl DictionaryQuizState {
|
||||
pub fn new(
|
||||
words: Vec<WordData>,
|
||||
reverse: bool,
|
||||
no_typing: bool,
|
||||
) -> DictionaryQuizState {
|
||||
pub fn new(words: Vec<WordData>, reverse: bool, no_typing: bool) -> DictionaryQuizState {
|
||||
DictionaryQuizState {
|
||||
words,
|
||||
current_set: Vec::new(),
|
||||
@@ -86,7 +82,9 @@ impl DictionaryQuizState {
|
||||
} else {
|
||||
String::new()
|
||||
}
|
||||
).size(ACCENT_FONT_SIZE).align_y(alignment::Vertical::Center),
|
||||
)
|
||||
.size(ACCENT_FONT_SIZE)
|
||||
.align_y(alignment::Vertical::Center),
|
||||
]
|
||||
.align_x(alignment::Horizontal::Center)
|
||||
.spacing(5),
|
||||
@@ -136,7 +134,7 @@ impl DictionaryQuizState {
|
||||
self.is_help = false;
|
||||
self.score.total += 1;
|
||||
self.show_next()
|
||||
}else {
|
||||
} else {
|
||||
self.is_help = true;
|
||||
}
|
||||
}
|
||||
@@ -206,9 +204,7 @@ impl DictionaryQuizState {
|
||||
|
||||
fn appeal_button(&self) -> Element<'_, DictionaryQuizMessage> {
|
||||
if self.is_help && self.no_typing == false {
|
||||
return button("Апелляция").style(jl_button)
|
||||
.on_press(Appeal)
|
||||
.into();
|
||||
return button("Апелляция").style(jl_button).on_press(Appeal).into();
|
||||
}
|
||||
space().into()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user