2023-12-12 12:44:16 +00:00
|
|
|
use crate::shared::stack_view_action::StackViewAction;
|
|
|
|
use makepad_widgets::widget::WidgetCache;
|
|
|
|
use makepad_widgets::*;
|
|
|
|
|
|
|
|
live_design! {
|
|
|
|
import makepad_draw::shader::std::*;
|
|
|
|
import makepad_widgets::base::*;
|
|
|
|
import makepad_widgets::theme_desktop_dark::*;
|
|
|
|
|
|
|
|
import crate::shared::helpers::*;
|
|
|
|
import crate::shared::helpers::Divider;
|
|
|
|
import crate::shared::styles::*;
|
|
|
|
import crate::shared::clickable_view::ClickableView
|
|
|
|
import crate::shared::search_bar::SearchBar;
|
|
|
|
import crate::shared::custom_button::CustomButton;
|
|
|
|
|
|
|
|
Welcome = {{Welcome}} {
|
2023-12-15 11:51:54 +00:00
|
|
|
// show_bg: true
|
|
|
|
draw_bg: {
|
|
|
|
color: #f00 //Color Red
|
|
|
|
}
|
|
|
|
<View> {
|
|
|
|
align: {x: 0.5, y: 0.5}
|
|
|
|
container = <RoundedView> {
|
|
|
|
width: 360
|
|
|
|
height: 400
|
|
|
|
flow: Down
|
|
|
|
align: {x: 0.5, y: 0.5}
|
|
|
|
spacing: 2.0
|
2023-12-12 12:44:16 +00:00
|
|
|
draw_bg: {
|
2023-12-15 11:51:54 +00:00
|
|
|
color: #ddd,
|
|
|
|
radius: (CARD_CORNER_RADIUS)
|
2023-12-12 12:44:16 +00:00
|
|
|
}
|
|
|
|
<View> {
|
2023-12-15 11:51:54 +00:00
|
|
|
width: Fit, height: Fill
|
|
|
|
flow: Down,
|
|
|
|
align: {x: 0, y: 0.5},
|
|
|
|
padding: {top: 5., left: 10., right: 10.}, spacing: 20.
|
|
|
|
username = <Label> {
|
|
|
|
draw_text:{
|
|
|
|
color: #000,
|
|
|
|
text_style: <TEXT_SUB>{font_size: 20.},
|
2023-12-12 12:44:16 +00:00
|
|
|
}
|
2023-12-15 11:51:54 +00:00
|
|
|
text:"Welcome To Simple Nav"
|
|
|
|
}
|
|
|
|
message_input = <SearchBar> {
|
|
|
|
show_bg: false
|
|
|
|
input = {
|
|
|
|
width: Fill, height: Fit, margin: 0
|
|
|
|
empty_message: "Enter Your Name"
|
|
|
|
draw_bg: {
|
|
|
|
color: #fff
|
|
|
|
border_width: 0.5,
|
|
|
|
border_color: #b4b4b4,
|
2023-12-12 12:44:16 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2023-12-15 11:51:54 +00:00
|
|
|
welcome_frame = <CustomButton> {
|
|
|
|
button = {
|
|
|
|
text: "Welcome"
|
|
|
|
}
|
|
|
|
}
|
2023-12-12 12:44:16 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
WelcomeScreen = <View> {
|
|
|
|
width: Fill, height: Fill
|
|
|
|
<Welcome> {}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-12-15 11:51:54 +00:00
|
|
|
#[derive(Live, LiveHook, Widget)]
|
2023-12-12 12:44:16 +00:00
|
|
|
pub struct Welcome {
|
2023-12-15 11:51:54 +00:00
|
|
|
#[deref] view: View
|
2023-12-12 12:44:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
impl Widget for Welcome {
|
2023-12-15 11:51:54 +00:00
|
|
|
fn handle_event(&mut self, cx: &mut Cx, event: &Event, scope: &mut Scope) {
|
|
|
|
let actions = cx.capture_actions(|cx| self.view.handle_event(cx, event, scope));
|
2023-12-13 00:39:09 +00:00
|
|
|
// if self
|
|
|
|
// .view
|
2023-12-15 11:51:54 +00:00
|
|
|
// .clickable_view(id!(my_profile_frame))
|
2023-12-13 00:39:09 +00:00
|
|
|
// .clicked(&actions)
|
|
|
|
// {
|
2023-12-15 11:51:54 +00:00
|
|
|
// let uid = self.widget_uid();
|
|
|
|
// cx.widget_action(uid, &scope.path, StackViewAction::ShowMyProfile);
|
2023-12-13 00:39:09 +00:00
|
|
|
// }
|
|
|
|
if self.view.button(id!(welcome_frame)).clicked(&actions)
|
2023-12-12 12:44:16 +00:00
|
|
|
{
|
2023-12-15 11:51:54 +00:00
|
|
|
let uid = self.widget_uid();
|
|
|
|
cx.widget_action(uid, &scope.path, StackViewAction::ShowCounterScreen);
|
|
|
|
// dispatch_action(cx, StackViewAction::ShowCounterScreen);
|
2023-12-12 17:45:11 +00:00
|
|
|
let user_prompt1 = self.view.text_input(id!(message_input.input)).text();
|
2023-12-13 00:39:09 +00:00
|
|
|
log!("WELCOME BUTTON CLICKED: {}", user_prompt1);
|
2023-12-12 12:44:16 +00:00
|
|
|
}
|
|
|
|
}
|
2023-12-15 11:51:54 +00:00
|
|
|
|
|
|
|
fn draw_walk(&mut self, cx: &mut Cx2d, scope: &mut Scope, walk: Walk) -> DrawStep {
|
|
|
|
self.view.draw_walk(cx, scope, walk)
|
|
|
|
}
|
2023-12-12 12:44:16 +00:00
|
|
|
}
|