//! Implements a view for adding a new task/todo. This is still a bit cumbersome as patterns are //! worked out, but a quick explainer: when the user clicks the "add" button, we dispatch a message //! which flows back through here, and then we grab the value and process it. //! //! Ownership in Rust makes it tricky to do this right, and the TextField widget may undergo more //! changes before version 0.1. This approach is unlikely to break as an example while those //! changes are poked and prodded at, even if it is a bit verbose and confusing. use cacao::layout::{Layout, LayoutConstraint}; use cacao::text::Label; use cacao::view::{View, ViewDelegate}; use cacao::button::Button; use cacao::input::TextField; use crate::storage::{dispatch_ui, Message}; #[derive(Debug, Default)] pub struct AddNewTodoContentView { pub view: Option, pub input: Option, pub button: Option