use iced::{Background, Border, Element, Fill, FillPortion, Theme}; use iced::border::Radius; use iced::widget::{container, column, row, button, text, horizontal_rule, vertical_rule, Themer}; use iced::widget::button::Status; use iced::window::Settings; fn main() -> iced::Result { let mut settings = Settings::default(); settings.size = [640.0, 480.0].into(); settings.min_size = Some([320.0, 200.0].into()); iced::application("Title", update, view) .window(settings) .theme(|s: &State| { Theme::ALL[(s.count as usize) % Theme::ALL.len()].clone() }) .run() } #[derive(Debug, Clone, Default)] struct State { count: u64 } #[derive(Debug, Clone, Copy)] enum Message { Increment, Decrement } fn update(counter: &mut State, message: Message) { match message { Message::Increment => counter.count = counter.count.wrapping_add(1), Message::Decrement => counter.count = counter.count.wrapping_sub(1), } } fn view(counter: &State) -> Element { container(column([ container(row([ button("amogus") .style(button::text) .on_press(Message::Decrement).into() ])) .style(container::bordered_box) .width(Fill) .into(), row([ container("this is where a sane person might choose a profile to play.") .width(FillPortion(3)) .height(Fill).into(), vertical_rule(1).into(), container("the goddamn user interface.") .width(Fill).into() ]).height(Fill).into(), horizontal_rule(1).into(), container(row([ text("yippee!!").height(Fill).width(Fill).into(), container(button(text("Play").height(Fill).width(Fill).center()).style(button::primary).on_press(Message::Increment)).max_width(150.0).into(), text("you're logged in or something").height(Fill).width(Fill).into(), ]) .padding(10) .spacing(10)) .height(75).into(), container(text(format!("Counter: {}", counter.count))).padding(5).width(Fill).style(container::bordered_box).into() ])) .center_x(Fill) .center_y(Fill) .into() }