slint-ui / slint

Slint is a declarative GUI toolkit to build native user interfaces for Rust, C++, or JavaScript apps.
https://slint.dev
Other
16.17k stars 535 forks source link

Add a new ToDo MVC example #5363

Open FloVanGH opened 1 month ago

FloVanGH commented 1 month ago

I'm working right now on a new version of the Todo example with a much nicer design (still usable with all styles) and based on the Model View Controller pattern.

First goal of this in first place is to have a small example with two views to show how work with the MVC pattern on Slint for all supported languages (Rust / C++ / Node / Python). I first will start with the Rust version. And want to add additional languages with following PRs. With the Python support I would need @tronical 's help ;-). But after first PR is finished.

Second goal is to has a good looking example for a lightweight real live application, that works also good on mobile.

Tasks

tronical commented 1 month ago

I suggest to replace pub due_date: i64 with std::time::SystemTime as data type instead. That way you have a data type that chrono supports (implements From<SystemTime> for chrono::DateTime) and you can make it relative to the epoch if necessary. But for example if you end up backing your model with a database, you wouldn't store an i64 in the database, you'd use the database' date time data type anyway.

tronical commented 1 month ago

Another suggestion: replace unwrap() in main with Result.