Generated
-1
@@ -2099,7 +2099,6 @@ dependencies = [
|
|||||||
"dirs",
|
"dirs",
|
||||||
"hex",
|
"hex",
|
||||||
"iced",
|
"iced",
|
||||||
"iced_core",
|
|
||||||
"rand",
|
"rand",
|
||||||
"reqwest",
|
"reqwest",
|
||||||
"rhai",
|
"rhai",
|
||||||
|
|||||||
+1
-2
@@ -4,8 +4,7 @@ version = "0.1.1"
|
|||||||
edition = "2024"
|
edition = "2024"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
iced = { version = "0.14.0", features = ["tokio",]}
|
iced = { version = "0.14.0", features = ["tokio"]}
|
||||||
iced_core = "0.14.0"
|
|
||||||
rand = "0.10.1"
|
rand = "0.10.1"
|
||||||
dirs = "6.0.0"
|
dirs = "6.0.0"
|
||||||
serde = { version = "1.0.228", features = ["derive"] }
|
serde = { version = "1.0.228", features = ["derive"] }
|
||||||
|
|||||||
BIN
Binary file not shown.
+8
-6
@@ -6,7 +6,7 @@ use crate::dictionary_test::DictionaryQuizState;
|
|||||||
use crate::lang::{WordData, WordGroup};
|
use crate::lang::{WordData, WordGroup};
|
||||||
use crate::word::WordState;
|
use crate::word::WordState;
|
||||||
use crate::Page::Word;
|
use crate::Page::Word;
|
||||||
use crate::{jl_text_input, AppState, NavigatedPage, Page, RootMessage, DEFAULT_SPACING};
|
use crate::{AppState, NavigatedPage, Page, RootMessage, DEFAULT_SPACING};
|
||||||
use chrono::{DateTime, TimeDelta, Utc};
|
use chrono::{DateTime, TimeDelta, Utc};
|
||||||
use iced::alignment::Vertical::Center;
|
use iced::alignment::Vertical::Center;
|
||||||
use iced::widget::button::Style;
|
use iced::widget::button::Style;
|
||||||
@@ -308,6 +308,7 @@ impl DictionaryState {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn words_list(&self) -> iced::Element<'_, DictionaryMessage> {
|
fn words_list(&self) -> iced::Element<'_, DictionaryMessage> {
|
||||||
|
let time = Instant::now();
|
||||||
let mut col = Column::new().width(Length::Fill);
|
let mut col = Column::new().width(Length::Fill);
|
||||||
|
|
||||||
let mut range = (0..self.include_map.len()).collect::<Vec<_>>();
|
let mut range = (0..self.include_map.len()).collect::<Vec<_>>();
|
||||||
@@ -345,21 +346,21 @@ impl DictionaryState {
|
|||||||
.push(space().width(10));
|
.push(space().width(10));
|
||||||
|
|
||||||
line = line.push(
|
line = line.push(
|
||||||
jl_text_input("Слово", &word.key)
|
text_input("Слово", &word.key)
|
||||||
.size(20)
|
.size(20)
|
||||||
.width(Length::Fill)
|
.width(Length::Fill)
|
||||||
.on_input(move |string| DictionaryMessage::SetKey(i, string))
|
.on_input(move |string| DictionaryMessage::SetKey(i, string))
|
||||||
.on_submit(DictionaryMessage::SubmitWord(i)),
|
.on_submit(DictionaryMessage::SubmitWord(i)),
|
||||||
);
|
);
|
||||||
line = line.push(
|
line = line.push(
|
||||||
jl_text_input("Перевод", &word.value)
|
text_input("Перевод", &word.value)
|
||||||
.size(20)
|
.size(20)
|
||||||
.width(Length::Fill)
|
.width(Length::Fill)
|
||||||
.on_input(move |string| DictionaryMessage::SetValue(i, string))
|
.on_input(move |string| DictionaryMessage::SetValue(i, string))
|
||||||
.on_submit(DictionaryMessage::SubmitWord(i)),
|
.on_submit(DictionaryMessage::SubmitWord(i)),
|
||||||
);
|
);
|
||||||
line = line.push(
|
line = line.push(
|
||||||
jl_text_input("Тэги", &word.tags)
|
text_input("Тэги", &word.tags)
|
||||||
.size(20)
|
.size(20)
|
||||||
.width(Length::Fill)
|
.width(Length::Fill)
|
||||||
.on_input(move |string| DictionaryMessage::SetTags(i, string))
|
.on_input(move |string| DictionaryMessage::SetTags(i, string))
|
||||||
@@ -389,6 +390,7 @@ impl DictionaryState {
|
|||||||
col = col.push(line);
|
col = col.push(line);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
println!("Words rendering time: {:?}", time.elapsed());
|
||||||
scrollable(col).height(Length::Fill).into()
|
scrollable(col).height(Length::Fill).into()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -396,7 +398,7 @@ impl DictionaryState {
|
|||||||
let dict = &self.state.lock().unwrap().dictionary;
|
let dict = &self.state.lock().unwrap().dictionary;
|
||||||
|
|
||||||
iced::widget::column![
|
iced::widget::column![
|
||||||
jl_text_input("Поиск", &self.search)
|
text_input("Поиск", &self.search)
|
||||||
.on_input(DictionaryMessage::Search)
|
.on_input(DictionaryMessage::Search)
|
||||||
.width(Length::Fill),
|
.width(Length::Fill),
|
||||||
text!("Всего слов: {}", dict.len()),
|
text!("Всего слов: {}", dict.len()),
|
||||||
@@ -531,7 +533,7 @@ impl DictionaryState {
|
|||||||
scrollable(row).width(Length::Fill).horizontal(),
|
scrollable(row).width(Length::Fill).horizontal(),
|
||||||
row![
|
row![
|
||||||
button("⇳").on_press(ChangeDirection),
|
button("⇳").on_press(ChangeDirection),
|
||||||
jl_text_input("Название группы слов", &group.name)
|
text_input("Название группы слов", &group.name)
|
||||||
.on_input(EditGroup)
|
.on_input(EditGroup)
|
||||||
.width(250)
|
.width(250)
|
||||||
.on_submit(SaveGroup),
|
.on_submit(SaveGroup),
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
use crate::dictionary::{split_with_coma};
|
use crate::dictionary::{split_with_coma};
|
||||||
use crate::quiz::Score;
|
use crate::quiz::Score;
|
||||||
use crate::Page::PreviousPage;
|
use crate::Page::PreviousPage;
|
||||||
use crate::{jl_text_input, RootMessage, DEFAULT_SPACING};
|
use crate::{RootMessage, DEFAULT_SPACING};
|
||||||
use crate::{NavigatedPage, Page};
|
use crate::{NavigatedPage, Page};
|
||||||
use iced::border::Radius;
|
use iced::border::Radius;
|
||||||
use iced::widget::container::Style;
|
use iced::widget::container::Style;
|
||||||
use iced::widget::{button, container, row, space, text, Row};
|
use iced::widget::{button, container, row, space, text, text_input, Row};
|
||||||
use iced::Background::Color;
|
use iced::Background::Color;
|
||||||
use iced::{alignment, Border, Element, Fill, Task, Theme};
|
use iced::{alignment, Border, Element, Fill, Task, Theme};
|
||||||
use rand::prelude::SliceRandom;
|
use rand::prelude::SliceRandom;
|
||||||
@@ -88,7 +88,7 @@ impl DictionaryQuizState {
|
|||||||
]
|
]
|
||||||
.align_x(alignment::Horizontal::Center)
|
.align_x(alignment::Horizontal::Center)
|
||||||
.spacing(5),
|
.spacing(5),
|
||||||
jl_text_input("Перевод", &self.answer)
|
text_input("Перевод", &self.answer)
|
||||||
.size(28)
|
.size(28)
|
||||||
.width(250)
|
.width(250)
|
||||||
.on_input(DictionaryQuizMessage::AnswerChanged)
|
.on_input(DictionaryQuizMessage::AnswerChanged)
|
||||||
|
|||||||
+29
-36
@@ -30,7 +30,7 @@ use crate::writing::{WritingMessage, WritingState};
|
|||||||
use crate::Page::{Dictionary, DictionaryQuiz, History, Quiz, Randomizer, Repetition, Repetitions, Selector, Sync, Word, Writing};
|
use crate::Page::{Dictionary, DictionaryQuiz, History, Quiz, Randomizer, Repetition, Repetitions, Selector, Sync, Word, Writing};
|
||||||
use crate::RootMessage::Keyboard;
|
use crate::RootMessage::Keyboard;
|
||||||
use iced::keyboard::Event;
|
use iced::keyboard::Event;
|
||||||
use iced::widget::{text, text_input, TextInput};
|
use iced::widget::text;
|
||||||
use iced::{keyboard, Element, Program, Subscription, Theme};
|
use iced::{keyboard, Element, Program, Subscription, Theme};
|
||||||
use iced::{Font, Task};
|
use iced::{Font, Task};
|
||||||
use rusqlite::Connection;
|
use rusqlite::Connection;
|
||||||
@@ -47,13 +47,13 @@ fn main() -> iced::Result {
|
|||||||
.subscription(subscription)
|
.subscription(subscription)
|
||||||
.title("Kana learn app")
|
.title("Kana learn app")
|
||||||
.settings(iced::Settings{
|
.settings(iced::Settings{
|
||||||
default_text_size: iced::Pixels(20.0),
|
default_text_size: iced::Pixels(16.0),
|
||||||
..iced::Settings::default()
|
..iced::Settings::default()
|
||||||
})
|
})
|
||||||
.font(include_bytes!("../ibmplex.ttf"))
|
.font(include_bytes!("../ibmplex.ttf"))
|
||||||
.font(include_bytes!("../noto.ttf"))
|
.font(include_bytes!("../noto.ttf"))
|
||||||
.default_font(Font::with_name("IBM Plex Sans"))
|
.default_font(USER_FONT)
|
||||||
// .scale_factor(|x| 1.5)
|
.scale_factor(|x| 1.5)
|
||||||
|
|
||||||
.theme(Theme::GruvboxDark)
|
.theme(Theme::GruvboxDark)
|
||||||
.run()
|
.run()
|
||||||
@@ -63,38 +63,6 @@ fn subscription(_state: &ScreenState) -> Subscription<RootMessage> {
|
|||||||
keyboard::listen().map(|e| Keyboard(e))
|
keyboard::listen().map(|e| Keyboard(e))
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn jl_text_input<'a, Message, Theme, Renderer>(placeholder: &str, value: &str) -> TextInput<'a, Message, Theme, Renderer>
|
|
||||||
where
|
|
||||||
Message: Clone,
|
|
||||||
Theme: text_input::Catalog + 'a, Renderer: iced_core::text::Renderer<Font = Font>{
|
|
||||||
text_input(placeholder, value).font(USER_FONT)
|
|
||||||
}
|
|
||||||
|
|
||||||
pub struct AppState {
|
|
||||||
pub dictionary: Vec<WordData>,
|
|
||||||
pub card_sets: Vec<CardSetSettings>,
|
|
||||||
pub word_groups: Vec<WordGroup>,
|
|
||||||
pub connection: Connection,
|
|
||||||
pub sync_data: AppSettings,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl AppState {
|
|
||||||
pub fn new() -> Self {
|
|
||||||
let path = app_data_dir();
|
|
||||||
let db_file = path.join("data.db");
|
|
||||||
let connection = Connection::open(db_file).unwrap();
|
|
||||||
connection.execute("PRAGMA foreign_keys = ON;", []).unwrap();
|
|
||||||
|
|
||||||
Self{
|
|
||||||
dictionary: vec![],
|
|
||||||
card_sets: vec![],
|
|
||||||
word_groups: vec![],
|
|
||||||
connection,
|
|
||||||
sync_data: AppSettings { key: None },
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
pub enum RootMessage {
|
pub enum RootMessage {
|
||||||
Selector(SelectorMessage),
|
Selector(SelectorMessage),
|
||||||
@@ -130,6 +98,31 @@ pub struct ScreenState {
|
|||||||
stack: Vec<Page>,
|
stack: Vec<Page>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub struct AppState {
|
||||||
|
pub dictionary: Vec<WordData>,
|
||||||
|
pub card_sets: Vec<CardSetSettings>,
|
||||||
|
pub word_groups: Vec<WordGroup>,
|
||||||
|
pub connection: Connection,
|
||||||
|
pub sync_data: AppSettings,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl AppState {
|
||||||
|
pub fn new() -> Self {
|
||||||
|
let path = app_data_dir();
|
||||||
|
let db_file = path.join("data.db");
|
||||||
|
let connection = Connection::open(db_file).unwrap();
|
||||||
|
connection.execute("PRAGMA foreign_keys = ON;", []).unwrap();
|
||||||
|
|
||||||
|
Self{
|
||||||
|
dictionary: vec![],
|
||||||
|
card_sets: vec![],
|
||||||
|
word_groups: vec![],
|
||||||
|
connection,
|
||||||
|
sync_data: AppSettings { key: None },
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl Default for ScreenState {
|
impl Default for ScreenState {
|
||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
let mut state = AppState::new();
|
let mut state = AppState::new();
|
||||||
|
|||||||
+2
-2
@@ -1,6 +1,6 @@
|
|||||||
use crate::lang::KanaSet;
|
use crate::lang::KanaSet;
|
||||||
use crate::Page::PreviousPage;
|
use crate::Page::PreviousPage;
|
||||||
use crate::{jl_text_input, NavigatedPage, Page, RootMessage, DEFAULT_SPACING, USER_FONT};
|
use crate::{NavigatedPage, Page, RootMessage, DEFAULT_SPACING, USER_FONT};
|
||||||
use iced::widget::*;
|
use iced::widget::*;
|
||||||
use iced::{alignment, Element, Fill, Task};
|
use iced::{alignment, Element, Fill, Task};
|
||||||
use rand::seq::SliceRandom;
|
use rand::seq::SliceRandom;
|
||||||
@@ -113,7 +113,7 @@ impl QuizState {
|
|||||||
]
|
]
|
||||||
.align_y(alignment::Vertical::Center)
|
.align_y(alignment::Vertical::Center)
|
||||||
.spacing(20),
|
.spacing(20),
|
||||||
jl_text_input("Романдзи", &self.current_roman)
|
text_input("Романдзи", &self.current_roman)
|
||||||
.size(28)
|
.size(28)
|
||||||
.width(150)
|
.width(150)
|
||||||
.on_input(QuizMessage::ContentChanged),
|
.on_input(QuizMessage::ContentChanged),
|
||||||
|
|||||||
+5
-5
@@ -2,7 +2,7 @@ use crate::data_provider::voice::get_voice;
|
|||||||
use crate::lang::{CardSet, CardStatistics, WordData, WordOpenMode};
|
use crate::lang::{CardSet, CardStatistics, WordData, WordOpenMode};
|
||||||
use crate::repetitions::CardSetSettings;
|
use crate::repetitions::CardSetSettings;
|
||||||
use crate::Page::PreviousPage;
|
use crate::Page::PreviousPage;
|
||||||
use crate::{AppState, KeyPressedPage, NavigatedPage, Page, RootMessage, DEFAULT_SPACING, USER_FONT};
|
use crate::{AppState, KeyPressedPage, NavigatedPage, Page, RootMessage, DEFAULT_SPACING};
|
||||||
use iced::alignment::Horizontal::Center;
|
use iced::alignment::Horizontal::Center;
|
||||||
use iced::keyboard::key::Physical::Code;
|
use iced::keyboard::key::Physical::Code;
|
||||||
use iced::widget::{button, column, container, row, rule, space, text, Column};
|
use iced::widget::{button, column, container, row, rule, space, text, Column};
|
||||||
@@ -201,10 +201,10 @@ impl RepetitionState {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn draw_key(&self, word: &WordData) -> Element<'_, RepetitionMessage> {
|
fn draw_key(&self, word: &WordData) -> Element<'_, RepetitionMessage> {
|
||||||
text!("{}", word.key).size(36).font(USER_FONT).into()
|
text!("{}", word.key).size(36).into()
|
||||||
}
|
}
|
||||||
fn draw_value(&self, word: &WordData) -> Element<'_, RepetitionMessage> {
|
fn draw_value(&self, word: &WordData) -> Element<'_, RepetitionMessage> {
|
||||||
text!("{}", word.value).size(24).font(USER_FONT).into()
|
text!("{}", word.value).size(24).into()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn draw_voice(&self) -> Element<'_, RepetitionMessage> {
|
fn draw_voice(&self) -> Element<'_, RepetitionMessage> {
|
||||||
@@ -216,13 +216,13 @@ impl RepetitionState {
|
|||||||
fn draw_reading(&self, word: &WordData) -> Element<'_, RepetitionMessage> {
|
fn draw_reading(&self, word: &WordData) -> Element<'_, RepetitionMessage> {
|
||||||
match word.additional.get("reading") {
|
match word.additional.get("reading") {
|
||||||
None => space().into(),
|
None => space().into(),
|
||||||
Some(reading) => text!("{}", reading).size(24).font(USER_FONT).into(),
|
Some(reading) => text!("{}", reading).size(24).into(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fn draw_context(&self, word: &WordData) -> Element<'_, RepetitionMessage> {
|
fn draw_context(&self, word: &WordData) -> Element<'_, RepetitionMessage> {
|
||||||
match word.additional.get("context") {
|
match word.additional.get("context") {
|
||||||
None => space().into(),
|
None => space().into(),
|
||||||
Some(context) => text!("{}", context).size(24).font(USER_FONT).into(),
|
Some(context) => text!("{}", context).size(24).into(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+7
-7
@@ -3,11 +3,11 @@ use crate::data_provider::card_stats::load_stats_of_set;
|
|||||||
use crate::lang::{SetOrderMode, WordData};
|
use crate::lang::{SetOrderMode, WordData};
|
||||||
use crate::repetition::RepetitionState;
|
use crate::repetition::RepetitionState;
|
||||||
use crate::Page::{History, PreviousPage, Repetition};
|
use crate::Page::{History, PreviousPage, Repetition};
|
||||||
use crate::{jl_text_input, AppState, NavigatedPage, Page, RootMessage, DEFAULT_SPACING, USER_FONT};
|
use crate::{AppState, NavigatedPage, Page, RootMessage, DEFAULT_SPACING};
|
||||||
use iced::widget::button::danger;
|
use iced::widget::button::danger;
|
||||||
pub use iced::widget::button::{Catalog, Style};
|
pub use iced::widget::button::{Catalog, Style};
|
||||||
use iced::widget::container::bordered_box;
|
use iced::widget::container::bordered_box;
|
||||||
use iced::widget::{button, column, container, radio, row, scrollable, space, text, Column};
|
use iced::widget::{button, column, container, radio, row, scrollable, space, text, text_input, Column};
|
||||||
use iced::{Border, Center, Element, Fill, Left, Length, Shadow, Task, Theme};
|
use iced::{Border, Center, Element, Fill, Left, Length, Shadow, Task, Theme};
|
||||||
use rhai::{Engine, Scope};
|
use rhai::{Engine, Scope};
|
||||||
use std::sync::{Arc, Mutex};
|
use std::sync::{Arc, Mutex};
|
||||||
@@ -166,14 +166,14 @@ impl RepetitionsState {
|
|||||||
return column![
|
return column![
|
||||||
scrollable(
|
scrollable(
|
||||||
column![
|
column![
|
||||||
jl_text_input("Название набора", &set.name)
|
text_input("Название набора", &set.name)
|
||||||
.on_input(RepetitionsMessage::SetName),
|
.on_input(RepetitionsMessage::SetName),
|
||||||
jl_text_input("Передняя сторона", &set.forward)
|
text_input("Передняя сторона", &set.forward)
|
||||||
.on_input(RepetitionsMessage::SetForward),
|
.on_input(RepetitionsMessage::SetForward),
|
||||||
jl_text_input("Задняя сторона", &set.backward)
|
text_input("Задняя сторона", &set.backward)
|
||||||
.on_input(RepetitionsMessage::SetBackward),
|
.on_input(RepetitionsMessage::SetBackward),
|
||||||
text!("Фильтр"),
|
text!("Фильтр"),
|
||||||
jl_text_input("", &set.filter).on_input(RepetitionsMessage::SetFilter),
|
text_input("", &set.filter).on_input(RepetitionsMessage::SetFilter),
|
||||||
button("Проверить фильтр").on_press(RepetitionsMessage::TryFilter),
|
button("Проверить фильтр").on_press(RepetitionsMessage::TryFilter),
|
||||||
self.count_view(&set),
|
self.count_view(&set),
|
||||||
radio("Обычный режим", SetOrderMode::Default, Some(set.open_mode), RepetitionsMessage::SetOpenMode),
|
radio("Обычный режим", SetOrderMode::Default, Some(set.open_mode), RepetitionsMessage::SetOpenMode),
|
||||||
@@ -215,7 +215,7 @@ impl RepetitionsState {
|
|||||||
let mut column = Column::new();
|
let mut column = Column::new();
|
||||||
|
|
||||||
for word in set.worst_words_list.clone().unwrap() {
|
for word in set.worst_words_list.clone().unwrap() {
|
||||||
column = column.push(text!("{} | {}", &word.key, &word.value).font(USER_FONT));
|
column = column.push(text!("{} | {}", &word.key, &word.value));
|
||||||
}
|
}
|
||||||
column.into()
|
column.into()
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -6,7 +6,7 @@ use crate::repetitions::RepetitionsState;
|
|||||||
use crate::selector::SelectorMessage::ChangeMode;
|
use crate::selector::SelectorMessage::ChangeMode;
|
||||||
use crate::writing::WritingState;
|
use crate::writing::WritingState;
|
||||||
use crate::Page::{Quiz, Writing};
|
use crate::Page::{Quiz, Writing};
|
||||||
use crate::{AppState, NavigatedPage, Page, QuizState, RootMessage, DEFAULT_SPACING, USER_FONT};
|
use crate::{AppState, NavigatedPage, Page, QuizState, RootMessage, DEFAULT_SPACING};
|
||||||
use iced::widget::*;
|
use iced::widget::*;
|
||||||
use iced::{alignment, Element, Task};
|
use iced::{alignment, Element, Task};
|
||||||
use crate::sync::SyncState;
|
use crate::sync::SyncState;
|
||||||
@@ -113,7 +113,7 @@ impl SelectorState {
|
|||||||
|
|
||||||
for v in &self.set.dictionary[i] {
|
for v in &self.set.dictionary[i] {
|
||||||
chars_column = chars_column.push(
|
chars_column = chars_column.push(
|
||||||
container(text!("{}", v.0.clone().to_uppercase()).size(36).font(USER_FONT))
|
container(text!("{}", v.0.clone().to_uppercase()).size(36))
|
||||||
.padding(20)
|
.padding(20)
|
||||||
.style(container::rounded_box),
|
.style(container::rounded_box),
|
||||||
);
|
);
|
||||||
|
|||||||
+6
-6
@@ -1,9 +1,9 @@
|
|||||||
use crate::data_provider::words::{delete_word, update_word};
|
use crate::data_provider::words::{delete_word, update_word};
|
||||||
use crate::lang::WordData;
|
use crate::lang::WordData;
|
||||||
use crate::Page::PreviousPage;
|
use crate::Page::PreviousPage;
|
||||||
use crate::{jl_text_input, AppState, NavigatedPage, Page, RootMessage, DEFAULT_SPACING};
|
use crate::{AppState, NavigatedPage, Page, RootMessage, DEFAULT_SPACING};
|
||||||
use iced::widget::button::danger;
|
use iced::widget::button::danger;
|
||||||
use iced::widget::{button, column, container, row, rule, scrollable, space, text};
|
use iced::widget::{button, column, container, row, rule, scrollable, space, text, text_input};
|
||||||
use iced::{Element, Fill, Task};
|
use iced::{Element, Fill, Task};
|
||||||
use std::sync::{Arc, Mutex};
|
use std::sync::{Arc, Mutex};
|
||||||
|
|
||||||
@@ -93,11 +93,11 @@ impl WordState {
|
|||||||
let mut col = iced::widget::column![
|
let mut col = iced::widget::column![
|
||||||
button("Назад").on_press(WordMessage::Back),
|
button("Назад").on_press(WordMessage::Back),
|
||||||
text!("Ключ"),
|
text!("Ключ"),
|
||||||
jl_text_input("key", &self.word.key).on_input(WordMessage::SetKey),
|
text_input("key", &self.word.key).on_input(WordMessage::SetKey),
|
||||||
text!("Значение"),
|
text!("Значение"),
|
||||||
jl_text_input("value", &self.word.value).on_input(WordMessage::SetValue),
|
text_input("value", &self.word.value).on_input(WordMessage::SetValue),
|
||||||
text!("Теги"),
|
text!("Теги"),
|
||||||
jl_text_input("tags", &self.word.tags).on_input(WordMessage::SetTags),
|
text_input("tags", &self.word.tags).on_input(WordMessage::SetTags),
|
||||||
rule::horizontal(2),
|
rule::horizontal(2),
|
||||||
scrollable(fast_add),
|
scrollable(fast_add),
|
||||||
];
|
];
|
||||||
@@ -146,7 +146,7 @@ impl WordState {
|
|||||||
fn additional_field(&self, value: (&String, &String), name: String, id: String) -> Element<'_, WordMessage> {
|
fn additional_field(&self, value: (&String, &String), name: String, id: String) -> Element<'_, WordMessage> {
|
||||||
column![
|
column![
|
||||||
text!("{}", name),
|
text!("{}", name),
|
||||||
jl_text_input(id.clone().as_str(), &value.1)
|
text_input(id.clone().as_str(), &value.1)
|
||||||
.on_input(move |string| WordMessage::SetAdditional(id.clone(), string))
|
.on_input(move |string| WordMessage::SetAdditional(id.clone(), string))
|
||||||
]
|
]
|
||||||
.spacing(DEFAULT_SPACING)
|
.spacing(DEFAULT_SPACING)
|
||||||
|
|||||||
+2
-2
@@ -1,6 +1,6 @@
|
|||||||
use crate::lang::KanaSet;
|
use crate::lang::KanaSet;
|
||||||
use crate::Page::PreviousPage;
|
use crate::Page::PreviousPage;
|
||||||
use crate::{NavigatedPage, Page, RootMessage, DEFAULT_SPACING, USER_FONT};
|
use crate::{NavigatedPage, Page, RootMessage, DEFAULT_SPACING};
|
||||||
use iced::widget::*;
|
use iced::widget::*;
|
||||||
use iced::{alignment, Element, Fill, Task};
|
use iced::{alignment, Element, Fill, Task};
|
||||||
use rand::seq::SliceRandom;
|
use rand::seq::SliceRandom;
|
||||||
@@ -90,7 +90,7 @@ impl WritingState {
|
|||||||
.label("Показывать все сразу")
|
.label("Показывать все сразу")
|
||||||
.on_toggle(WritingMessage::SwitchShowMode),
|
.on_toggle(WritingMessage::SwitchShowMode),
|
||||||
text!("{}", self.roman_total).size(34),
|
text!("{}", self.roman_total).size(34),
|
||||||
text!("{}", self.kana).size(48).font(USER_FONT),
|
text!("{}", self.kana).size(48),
|
||||||
self.answers(),
|
self.answers(),
|
||||||
row![
|
row![
|
||||||
button(text!("{}", self.next_text)).on_press(WritingMessage::Next),
|
button(text!("{}", self.next_text)).on_press(WritingMessage::Next),
|
||||||
|
|||||||
Reference in New Issue
Block a user