Optimized again dictionary page and working import
This commit is contained in:
+12
-16
@@ -26,8 +26,7 @@ impl NavigatedPage<WordMessage> for WordState {
|
||||
}
|
||||
}
|
||||
|
||||
fn navigated(&mut self) {
|
||||
}
|
||||
fn navigated(&mut self) {}
|
||||
fn update(&mut self, message: WordMessage) -> Task<RootMessage> {
|
||||
match message {
|
||||
Back => {}
|
||||
@@ -123,12 +122,11 @@ impl NavigatedPage<WordMessage> for WordState {
|
||||
]
|
||||
.spacing(DEFAULT_SPACING)
|
||||
]
|
||||
.spacing(DEFAULT_SPACING)
|
||||
.into(),
|
||||
.spacing(DEFAULT_SPACING)
|
||||
.into(),
|
||||
Back,
|
||||
)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
impl WordState {
|
||||
@@ -138,38 +136,36 @@ impl WordState {
|
||||
}
|
||||
|
||||
impl WordState {
|
||||
|
||||
fn get_view_for_more(&self, value: (&String, &String)) -> Element<'_, WordMessage> {
|
||||
match value.0.as_str() {
|
||||
"reading" => self.reading_field(value),
|
||||
"description" => self.description_field(value),
|
||||
"context" => self.context_field(value),
|
||||
_ => space().into(),
|
||||
"reading" => self.reading_field(value.1),
|
||||
"description" => self.description_field(value.1),
|
||||
"context" => self.context_field(value.1),
|
||||
_ => self.additional_field(value.1, value.0.clone(), value.0.clone()),
|
||||
}
|
||||
}
|
||||
|
||||
fn reading_field(&self, value: (&String, &String)) -> Element<'_, WordMessage> {
|
||||
fn reading_field(&self, value: &String) -> Element<'_, WordMessage> {
|
||||
self.additional_field(value, "Чтение слова".to_string(), "reading".to_string())
|
||||
}
|
||||
|
||||
fn description_field(&self, value: (&String, &String)) -> Element<'_, WordMessage> {
|
||||
fn description_field(&self, value: &String) -> Element<'_, WordMessage> {
|
||||
self.additional_field(value, "Описание".to_string(), "description".to_string())
|
||||
}
|
||||
|
||||
fn context_field(&self, value: (&String, &String)) -> Element<'_, WordMessage> {
|
||||
fn context_field(&self, value: &String) -> Element<'_, WordMessage> {
|
||||
self.additional_field(value, "В контексте".to_string(), "context".to_string())
|
||||
}
|
||||
|
||||
fn additional_field(
|
||||
&self,
|
||||
value: (&String, &String),
|
||||
value: &String,
|
||||
name: String,
|
||||
id: String,
|
||||
) -> Element<'_, WordMessage> {
|
||||
column![
|
||||
text!("{}", name),
|
||||
row![
|
||||
text_input(id.clone().as_str(), &value.1)
|
||||
text_input(id.clone().as_str(), value)
|
||||
.on_input({
|
||||
let value = id.clone();
|
||||
move |string| SetAdditional(value.clone(), string)
|
||||
|
||||
Reference in New Issue
Block a user