Add basic methods into NavigatedPage

This commit is contained in:
2026-08-13 22:03:47 +03:00
parent d8e7cbbc36
commit 4ca7aa7044
17 changed files with 590 additions and 324 deletions
+14 -13
View File
@@ -28,16 +28,7 @@ impl NavigatedPage<WordMessage> for WordState {
fn navigated(&mut self) {
}
}
impl WordState {
pub(crate) fn new(word: WordData, index: usize, state: Arc<Mutex<AppState>>) -> WordState {
WordState { state, index, word }
}
}
impl WordState {
pub fn update(&mut self, message: WordMessage) -> Task<RootMessage> {
fn update(&mut self, message: WordMessage) -> Task<RootMessage> {
match message {
Back => {}
Save => {
@@ -74,7 +65,7 @@ impl WordState {
Task::none()
}
pub fn view(&self) -> Element<'_, WordMessage> {
fn view(&self) -> Element<'_, WordMessage> {
let mut fast_add = row![];
if !self.word.additional.contains_key("reading") {
fast_add = fast_add.push(
@@ -132,12 +123,22 @@ impl WordState {
]
.spacing(DEFAULT_SPACING)
]
.spacing(DEFAULT_SPACING)
.into(),
.spacing(DEFAULT_SPACING)
.into(),
Back,
)
}
}
impl WordState {
pub(crate) fn new(word: WordData, index: usize, state: Arc<Mutex<AppState>>) -> WordState {
WordState { state, index, word }
}
}
impl WordState {
fn get_view_for_more(&self, value: (&String, &String)) -> Element<'_, WordMessage> {
match value.0.as_str() {
"reading" => self.reading_field(value),