use windui::prelude::*;
const BG: u32 = 0xF5F6F7; const FG: u32 = 0x1F2329; const SUB: u32 = 0x9AA0A6; const GREEN: u32 = 0x2AAE67; const GLYPH: u32 = 0x60656B;
fn main() {
let title_bar = Element::row()
.width_match()
.height(36)
.cross(Align::Stretch)
.bg(Color::hex(BG))
.window_drag()
.child(Element::row().weight(1.0)) .child(Element::window_button(WindowButtonKind::Minimize).fg(Color::hex(GLYPH)))
.child(Element::window_button(WindowButtonKind::Close).fg(Color::hex(GLYPH)));
let logo = Element::stack()
.width(96)
.height(96)
.bg(Color::hex(GREEN))
.corner(20.0)
.align(Align::Center);
let agreed = std::rc::Rc::new(std::cell::Cell::new(true));
let agree_row = Element::row()
.spacing(2)
.align(Align::Center)
.child(Element::checkbox("我已阅读并同意", agreed).fg(Color::hex(SUB)).font_size(13.0))
.child(Element::link("《服务协议》").url("https://example.com/tos").font_size(13.0))
.child(Element::label("和").fg(Color::hex(SUB)).font_size(13.0).width(20))
.child(Element::link("《隐私协议》").url("https://example.com/privacy").font_size(13.0));
let body = Element::col()
.fill()
.bg(Color::hex(BG))
.padding(24)
.cross(Align::Center)
.child(Element::col().weight(1.0)) .child(logo)
.child(Element::label("星尘输入法").font_size(26.0).fg(Color::hex(FG)).height(40).align(Align::Center))
.child(
Element::label("适用于 Windows 7 及以上版本")
.font_size(14.0)
.fg(Color::hex(SUB))
.height(24)
.align(Align::Center),
)
.child(Element::col().height(24)) .child(
Element::button("安装")
.bg(Color::hex(GREEN))
.fg(Color::WHITE)
.corner(8.0)
.width(300)
.height(48)
.font_size(17.0)
.on_click(|_| println!("开始安装")),
)
.child(Element::col().height(16)) .child(agree_row)
.child(Element::col().weight(1.0));
let ui = Element::col().fill().bg(Color::hex(BG)).child(title_bar).child(body.weight(1.0));
App::new("星尘输入法", 600, 460)
.frameless()
.screenshot_from_args()
.content(ui)
.run();
}