This commit is contained in:
2026-02-10 17:30:43 +03:00
parent db2eb22c02
commit 3c76aca1b6
3 changed files with 8 additions and 5 deletions
+3 -3
View File
@@ -181,12 +181,12 @@ impl KanaSet {
pub fn next(&mut self) -> (String, String) { pub fn next(&mut self) -> (String, String) {
let current_set = self.list(); let current_set = self.list();
let mut rand = rand::rng(); let mut rand = rand::rng();
let index: u32 = rand.random(); let index: u32 = rand.random();
current_set[index as usize % current_set.len()].clone() current_set[index as usize % current_set.len()].clone()
} }
pub fn list(&self) -> Vec<(String, String)> { pub fn list(&self) -> Vec<(String, String)> {
let mut current_set: Vec<(String, String)> = Vec::new(); let mut current_set: Vec<(String, String)> = Vec::new();
@@ -197,7 +197,7 @@ impl KanaSet {
}); });
} }
} }
current_set current_set
} }
} }
+1 -1
View File
@@ -6,10 +6,10 @@ mod writing;
use crate::quiz::*; use crate::quiz::*;
use crate::selector::*; use crate::selector::*;
use crate::writing::{WritingMessage, WritingState};
use crate::Page::{Quiz, Selector, Writing}; use crate::Page::{Quiz, Selector, Writing};
use iced::widget::text; use iced::widget::text;
use iced::Element; use iced::Element;
use crate::writing::{WritingMessage, WritingState};
fn main() -> iced::Result { fn main() -> iced::Result {
iced::application("A kana learn app", ScreenState::update, ScreenState::view).run() iced::application("A kana learn app", ScreenState::update, ScreenState::view).run()
+4 -1
View File
@@ -87,7 +87,10 @@ impl WritingState {
fn answers(&self) -> Element<'_, WritingMessage> { fn answers(&self) -> Element<'_, WritingMessage> {
if self.set.is_empty() { if self.set.is_empty() {
text!("{}", self.kana_total).font(Font::with_name("AppleGothic")).size(36).into() text!("{}", self.kana_total)
.font(Font::with_name("AppleGothic"))
.size(36)
.into()
} else { } else {
vertical_space().height(36).into() vertical_space().height(36).into()
} }