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