Skip to content

Latest commit

 

History

History
31 lines (21 loc) · 882 Bytes

File metadata and controls

31 lines (21 loc) · 882 Bytes

Adding Widgets

Use column! and row! to group multiple widgets such as text and button.

use iced::widget::{button, column, row, text};

fn main() -> iced::Result {
    iced::run("MyApp", MyApp::update, MyApp::view)
}

#[derive(Default)]
struct MyApp;

#[derive(Debug, Clone)]
enum Message {}

impl MyApp {
    fn update(&mut self, _message: Message) {}

    fn view(&self) -> iced::Element<Message> {
        column![text("Yes or no?"), row![button("Yes"), button("No"),],].into()
    }
}

Adding widgets

➡️ Next: Widgets

📘 Back: Table of contents