MCPcopy Create free account
hub / github.com/angular-rust/ux-components / new

Method new

src/elements/alert_dialog.rs:70–133  ·  view source on GitHub ↗
(widget: &AlertDialog)

Source from the content-addressed store, hash-verified

68
69impl AlertDialogElement {
70 pub fn new(widget: &AlertDialog) -> Self {
71 let node = LayoutSystem::new_node(
72 style::Style {
73 padding: geometry::Rect {
74 start: style::Dimension::Points(5.0),
75 end: style::Dimension::Points(5.0),
76 top: style::Dimension::Points(5.0),
77 bottom: style::Dimension::Points(5.0),
78 },
79 size: geometry::Size {
80 width: style::Dimension::Percent(1.0),
81 height: style::Dimension::Percent(1.0),
82 },
83 ..default()
84 },
85 vec![],
86 )
87 .unwrap();
88
89 // assert!(options.rendering.is_some(), "No Rendering given to Canvas, cannot create a canvas without one.");
90
91 let component = WidgetComponent::get(widget.key.id());
92
93 // component.onrender.listen(box |_| {
94 // log::warn!("Got signal to render AlertDialog");
95 // });
96
97 // canvas = self;
98 // let scale = widget.scale;
99
100 let child = widget.title.create_element();
101
102 if let Some(child) = child.node() {
103 let child_style = LayoutSystem::style(child).unwrap();
104 LayoutSystem::set_style(
105 child,
106 style::Style {
107 size: geometry::Size {
108 width: style::Dimension::Percent(1.0),
109 height: style::Dimension::Percent(1.0),
110 },
111 ..child_style
112 },
113 )
114 .unwrap();
115 LayoutSystem::set_children(node, vec![child]).unwrap()
116 }
117
118 Self {
119 captured: None,
120 child,
121 component,
122 state: Default::default(),
123 focus_invalid: true,
124 focused: None,
125 marked: None,
126 oncapturedchange: Signal::new(),
127 onfocusedchange: Signal::new(),

Callers

nothing calls this directly

Calls 3

idMethod · 0.45
create_elementMethod · 0.45
nodeMethod · 0.45

Tested by

no test coverage detected