Adding words by parts
This commit is contained in:
1 parent
8f789facd7
commit
51c8d7be74
23 files changed
+409
-241
No files matched your search
+17
-19
@@ -5,7 +5,7 @@ use crate::quiz::QuizMessage::*;
|
||||
use crate::styling::*;
|
||||
use crate::{RootMessage, USER_FONT};
|
||||
use iced::widget::*;
|
||||
use iced::{alignment, Element, Fill, Task};
|
||||
use iced::{Element, Fill, Task, alignment};
|
||||
use rand::seq::SliceRandom;
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
@@ -28,8 +28,7 @@ impl NavigatedPage<QuizMessage> for QuizState {
|
||||
}
|
||||
}
|
||||
|
||||
fn navigated(&mut self) {
|
||||
}
|
||||
fn navigated(&mut self) {}
|
||||
|
||||
fn update(&mut self, message: QuizMessage) -> Task<RootMessage> {
|
||||
match message {
|
||||
@@ -60,8 +59,6 @@ impl NavigatedPage<QuizMessage> for QuizState {
|
||||
Task::none()
|
||||
}
|
||||
|
||||
|
||||
|
||||
fn view(&self) -> Element<'_, QuizMessage> {
|
||||
container(
|
||||
iced::widget::column![
|
||||
@@ -87,26 +84,27 @@ impl NavigatedPage<QuizMessage> for QuizState {
|
||||
score_display(&self.score),
|
||||
button("Закончить").style(jl_button).on_press(Back),
|
||||
]
|
||||
.spacing(DEFAULT_SPACING)
|
||||
.align_x(alignment::Horizontal::Center),
|
||||
.spacing(DEFAULT_SPACING)
|
||||
.align_x(alignment::Horizontal::Center),
|
||||
)
|
||||
.center_y(Fill)
|
||||
.center_x(Fill)
|
||||
.into()
|
||||
.center_y(Fill)
|
||||
.center_x(Fill)
|
||||
.into()
|
||||
}
|
||||
}
|
||||
|
||||
fn score_display<'a, T: 'a>(score: &Score) -> Element<'a, T> {
|
||||
row![
|
||||
text!("{}", score.total.to_string()).size(25),
|
||||
text!("{}", score.correct.to_string())
|
||||
.size(25)
|
||||
.color(iced::Color::from_rgb8(60, 170, 60)),
|
||||
text!("{}", score.fail.to_string())
|
||||
.color(iced::Color::from_rgb8(255, 79, 0))
|
||||
.size(25),
|
||||
]
|
||||
.spacing(DEFAULT_SPACING).into()
|
||||
text!("{}", score.total.to_string()).size(25),
|
||||
text!("{}", score.correct.to_string())
|
||||
.size(25)
|
||||
.color(iced::Color::from_rgb8(60, 170, 60)),
|
||||
text!("{}", score.fail.to_string())
|
||||
.color(iced::Color::from_rgb8(255, 79, 0))
|
||||
.size(25),
|
||||
]
|
||||
.spacing(DEFAULT_SPACING)
|
||||
.into()
|
||||
}
|
||||
|
||||
impl QuizState {
|
||||
|
||||
Reference in new issue
Block a user