update iris

This commit is contained in:
2025-12-06 20:48:19 -05:00
parent 09be172e36
commit a1928edb66
10 changed files with 467 additions and 308 deletions

View File

@@ -1,3 +1,5 @@
use iris::winit::attr::Selector;
use super::*;
pub fn werror(ui: &mut Ui, msg: &str) -> WidgetId {
@@ -12,3 +14,37 @@ pub fn werror(ui: &mut Ui, msg: &str) -> WidgetId {
pub fn hint(msg: impl Into<String>) -> TextBuilder {
wtext(msg).size(20).color(Color::GRAY)
}
pub fn field_widget(name: &str, hint_text: &str, ui: &mut Ui) -> WidgetId<TextEdit> {
wtext(name)
.editable(true)
.size(20)
.hint(hint(hint_text))
.add(ui)
}
pub fn field_box(field: WidgetId<TextEdit>, ui: &mut Ui) -> WidgetId {
field
.clone()
.pad(10)
.background(rect(Color::BLACK.brighter(0.1)).radius(15))
.attr::<Selector>(field)
.add(ui)
.any()
}
pub fn submit_button(
text: &str,
on_submit: impl Fn(&mut Client, &mut Ui) + 'static,
) -> impl WidgetRet {
let color = Color::GREEN;
rect(color)
.radius(15)
.on(CursorSense::click(), move |ctx| {
ctx.ui[ctx.id].color = color.darker(0.3);
on_submit(ctx.state, ctx.ui);
})
.height(40)
.foreground(wtext(text).size(20).text_align(Align::CENTER))
.to_any()
}