nimanyatta_v001/nimanyatta_v001/src/default_choice/default_choice_screen.rs

73 lines
2.2 KiB
Rust

use makepad_widgets::widget::WidgetCache;
use makepad_widgets::*;
use std::collections::HashMap;
// use crate::shared::steps::StepsNavSetWidgetExt;
live_design! {
import makepad_draw::shader::std::*;
import makepad_widgets::base::*;
import makepad_widgets::theme_desktop_dark::*;
import crate::shared::styles::*;
import crate::shared::custom_button::CustomButton;
DefaultChoiceScreen = <View> {
width: Fill, height: Fill flow: Down
<View> {
flow: Down,
align: {x: 0.5, y: 0.3}
<View> {
flow: Down,
spacing: (SSPACING_2),
align: {x: 0.5, y: 0.5}
label = <Label> {
margin: {top: 1}
draw_text: {
text_style: <H2_TEXT_BOLD> {},
color: (COLOR_DOWN_6)
}
text: "Step One"
}
getstarted = <CustomButton> {
width: 250
height: Fit
text: "Submit"
draw_bg: {
border_radius: 2.
}
}
getstartedw = <CustomButton> {
width: 250
height: Fit
text: "Submit"
draw_bg: {
border_radius: 2.
}
}
}
}
}
}
#[derive(Live, LiveHook, Widget)]
pub struct DefaultChoiceScreen {
#[deref]
view: View,
}
impl Widget for DefaultChoiceScreen {
fn handle_event(&mut self, cx: &mut Cx, event: &Event, scope: &mut Scope) {
let _uid = self.widget_uid();
let actions = cx.capture_actions(|cx| self.view.handle_event(cx, event, scope));
if self.view.button(id!(getstartedw)).clicked(&actions) {
log!("Option Selected: {}", 0);
}
}
fn draw_walk(&mut self, cx: &mut Cx2d, scope: &mut Scope, walk: Walk) -> DrawStep {
self.view.draw_walk(cx, scope, walk)
}
}