Introduce Program API

This commit is contained in:
Héctor Ramón Jiménez 2024-03-16 05:33:47 +01:00
parent 0524e9b457
commit c22269bff3
No known key found for this signature in database
GPG key ID: 7CC46565708259A7
43 changed files with 1141 additions and 831 deletions

View file

@ -3,10 +3,13 @@ use iced::widget::{
progress_bar, row, scrollable, slider, text, text_input, toggler,
vertical_rule, vertical_space,
};
use iced::{Alignment, Element, Length, Sandbox, Settings, Theme};
use iced::{Alignment, Element, Length, Theme};
pub fn main() -> iced::Result {
Styling::run(Settings::default())
iced::sandbox(Styling::update, Styling::view)
.theme(Styling::theme)
.title("Styling - Iced")
.run()
}
#[derive(Default)]
@ -28,17 +31,7 @@ enum Message {
TogglerToggled(bool),
}
impl Sandbox for Styling {
type Message = Message;
fn new() -> Self {
Styling::default()
}
fn title(&self) -> String {
String::from("Styling - Iced")
}
impl Styling {
fn update(&mut self, message: Message) {
match message {
Message::ThemeChanged(theme) => {