Add basic methods into NavigatedPage
This commit is contained in:
+14
-13
@@ -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),
|
||||
|
||||
Reference in New Issue
Block a user