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

Method new

src/elements/list_view.rs:70–138  ·  view source on GitHub ↗
(widget: &ListView)

Source from the content-addressed store, hash-verified

68
69impl ListViewElement {
70 pub fn new(widget: &ListView) -> Self {
71 let node = LayoutSystem::new_node(
72 style::Style {
73 flex_direction: style::FlexDirection::Column,
74 align_items: style::AlignItems::Stretch,
75 // align_content: style::AlignContent::FlexStart,
76 // justify_content: style::JustifyContent::Center,
77 size: geometry::Size {
78 width: style::Dimension::Percent(1.0),
79 height: style::Dimension::Percent(1.0),
80 },
81 ..default()
82 },
83 vec![],
84 )
85 .unwrap();
86
87 // assert!(options.rendering.is_some(), "No Rendering given to Canvas, cannot create a canvas without one.");
88
89 let component = WidgetComponent::get(widget.key.id());
90
91 // component.onrender.listen(box |_| {
92 // log::warn!("Got signal to render ListView");
93 // });
94
95 // canvas = self;
96 // let scale = widget.scale;
97
98 let mut children = Vec::new();
99
100 let mut child_nodes = Vec::new();
101 for child in widget.children.iter() {
102 let element = child.create_element();
103 let child_nodes = &mut child_nodes;
104
105 if let Some(child) = element.node() {
106 // let child_style = LayoutSystem::style(child).unwrap();
107 // LayoutSystem::set_style(
108 // child,
109 // style::Style {
110 // align_self: style::AlignSelf::Center,
111 // ..child_style
112 // },
113 // )
114 // .unwrap();
115 child_nodes.push(child);
116 }
117
118 children.push(element);
119 }
120
121 LayoutSystem::set_children(node, child_nodes).unwrap();
122
123 Self {
124 captured: None,
125 children,
126 component,
127 state: Default::default(),

Callers

nothing calls this directly

Calls 4

pushMethod · 0.80
idMethod · 0.45
create_elementMethod · 0.45
nodeMethod · 0.45

Tested by

no test coverage detected