Include font and style changes
This commit is contained in:
+1
-1
@@ -14,7 +14,7 @@ use iced::Element;
|
|||||||
|
|
||||||
fn main() -> iced::Result {
|
fn main() -> iced::Result {
|
||||||
iced::application(ScreenState::boot, ScreenState::update, ScreenState::view)
|
iced::application(ScreenState::boot, ScreenState::update, ScreenState::view)
|
||||||
.title("Kana learn app").run()
|
.title("Kana learn app").font(include_bytes!("../noto.ttf")).run()
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
|
|||||||
+3
-3
@@ -2,7 +2,7 @@ use crate::lang::KanaSet;
|
|||||||
use crate::Page::PreviousPage;
|
use crate::Page::PreviousPage;
|
||||||
use crate::{NavigatedPage, Page};
|
use crate::{NavigatedPage, Page};
|
||||||
use iced::widget::*;
|
use iced::widget::*;
|
||||||
use iced::{alignment, Element, Fill, Font};
|
use iced::{alignment, Element, Fill};
|
||||||
use rand::seq::SliceRandom;
|
use rand::seq::SliceRandom;
|
||||||
|
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
@@ -97,8 +97,7 @@ impl QuizState {
|
|||||||
iced::widget::column![
|
iced::widget::column![
|
||||||
row![
|
row![
|
||||||
text!("{}", self.kana.to_uppercase())
|
text!("{}", self.kana.to_uppercase())
|
||||||
.size(54)
|
.size(54),
|
||||||
.font(Font::with_name("AppleGothic")),
|
|
||||||
text!(
|
text!(
|
||||||
"{}",
|
"{}",
|
||||||
if self.is_help {
|
if self.is_help {
|
||||||
@@ -129,6 +128,7 @@ impl QuizState {
|
|||||||
.spacing(10)
|
.spacing(10)
|
||||||
.align_x(alignment::Horizontal::Center),
|
.align_x(alignment::Horizontal::Center),
|
||||||
)
|
)
|
||||||
|
.center_y(Fill)
|
||||||
.center_x(Fill)
|
.center_x(Fill)
|
||||||
.into()
|
.into()
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-3
@@ -4,7 +4,7 @@ use crate::writing::WritingState;
|
|||||||
use crate::Page::{Quiz, Writing};
|
use crate::Page::{Quiz, Writing};
|
||||||
use crate::{NavigatedPage, Page, QuizState};
|
use crate::{NavigatedPage, Page, QuizState};
|
||||||
use iced::widget::*;
|
use iced::widget::*;
|
||||||
use iced::{alignment, Element, Font};
|
use iced::{alignment, Element};
|
||||||
|
|
||||||
pub struct SelectorState {
|
pub struct SelectorState {
|
||||||
pub set: KanaSet,
|
pub set: KanaSet,
|
||||||
@@ -87,8 +87,7 @@ impl SelectorState {
|
|||||||
chars_column = chars_column.push(
|
chars_column = chars_column.push(
|
||||||
container(
|
container(
|
||||||
text!("{}", v.0.clone().to_uppercase())
|
text!("{}", v.0.clone().to_uppercase())
|
||||||
.size(36)
|
.size(36),
|
||||||
.font(Font::with_name("AppleGothic")),
|
|
||||||
)
|
)
|
||||||
.padding(20)
|
.padding(20)
|
||||||
.style(container::rounded_box),
|
.style(container::rounded_box),
|
||||||
|
|||||||
+4
-12
@@ -2,7 +2,7 @@ use crate::lang::KanaSet;
|
|||||||
use crate::Page::PreviousPage;
|
use crate::Page::PreviousPage;
|
||||||
use crate::{NavigatedPage, Page};
|
use crate::{NavigatedPage, Page};
|
||||||
use iced::widget::*;
|
use iced::widget::*;
|
||||||
use iced::{alignment, Element, Fill, Font};
|
use iced::{alignment, Element, Fill};
|
||||||
use rand::seq::SliceRandom;
|
use rand::seq::SliceRandom;
|
||||||
|
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
@@ -12,7 +12,6 @@ pub struct WritingState {
|
|||||||
original_set: Vec<(String, String)>,
|
original_set: Vec<(String, String)>,
|
||||||
kana_total: String,
|
kana_total: String,
|
||||||
roman_total: String,
|
roman_total: String,
|
||||||
is_help: bool,
|
|
||||||
next_text: String,
|
next_text: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -36,7 +35,6 @@ impl WritingState {
|
|||||||
original_set: list,
|
original_set: list,
|
||||||
kana_total: "".to_string(),
|
kana_total: "".to_string(),
|
||||||
roman_total: "".to_string(),
|
roman_total: "".to_string(),
|
||||||
is_help: false,
|
|
||||||
next_text: "Дальше".to_string(),
|
next_text: "Дальше".to_string(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -82,13 +80,14 @@ impl WritingState {
|
|||||||
.align_x(alignment::Horizontal::Center),
|
.align_x(alignment::Horizontal::Center),
|
||||||
)
|
)
|
||||||
.center_x(Fill)
|
.center_x(Fill)
|
||||||
|
.center_y(Fill)
|
||||||
|
.padding(10)
|
||||||
.into()
|
.into()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn answers(&self) -> Element<'_, WritingMessage> {
|
fn answers(&self) -> Element<'_, WritingMessage> {
|
||||||
if self.set.is_empty() {
|
if self.set.is_empty() {
|
||||||
text!("{}", self.kana_total)
|
text!("{}", self.kana_total)
|
||||||
.font(Font::with_name("AppleGothic"))
|
|
||||||
.size(36)
|
.size(36)
|
||||||
.into()
|
.into()
|
||||||
} else {
|
} else {
|
||||||
@@ -100,11 +99,4 @@ impl WritingState {
|
|||||||
pub enum WritingMessage {
|
pub enum WritingMessage {
|
||||||
Next,
|
Next,
|
||||||
Back,
|
Back,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Default, Debug, Clone)]
|
|
||||||
pub struct Score {
|
|
||||||
total: i32,
|
|
||||||
correct: i32,
|
|
||||||
fail: i32,
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user