(widget: &GridView)
| 68 | |
| 69 | impl GridViewElement { |
| 70 | pub fn new(widget: &GridView) -> Self { |
| 71 | let node = LayoutSystem::new_node( |
| 72 | style::Style { |
| 73 | flex_direction: style::FlexDirection::Row, |
| 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 GridView"); |
| 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 | if let Some(child) = element.node() { |
| 105 | // let child_style = LayoutSystem::style(child).unwrap(); |
| 106 | // LayoutSystem::set_style( |
| 107 | // child, |
| 108 | // style::Style { |
| 109 | // align_self: style::AlignSelf::Center, |
| 110 | // ..child_style |
| 111 | // }, |
| 112 | // ) |
| 113 | // .unwrap(); |
| 114 | child_nodes.push(child); |
| 115 | } |
| 116 | |
| 117 | children.push(element); |
| 118 | } |
| 119 | |
| 120 | LayoutSystem::set_children(node, child_nodes).unwrap(); |
| 121 | |
| 122 | Self { |
| 123 | captured: None, |
| 124 | children, |
| 125 | component, |
| 126 | state: Default::default(), |
| 127 | focus_invalid: true, |
nothing calls this directly
no test coverage detected