(widget: &CustomScrollView)
| 70 | |
| 71 | impl CustomScrollViewElement { |
| 72 | pub fn new(widget: &CustomScrollView) -> Self { |
| 73 | // assert!(options.rendering.is_some(), "No Rendering given to Canvas, cannot create a canvas without one."); |
| 74 | |
| 75 | let component = WidgetComponent::get(widget.key.id()); |
| 76 | |
| 77 | // component.onrender.listen(box |_| { |
| 78 | // log::warn!("Got signal to render CustomScrollView"); |
| 79 | // }); |
| 80 | |
| 81 | // canvas = self; |
| 82 | // let scale = widget.scale; |
| 83 | |
| 84 | let mut children = Vec::new(); |
| 85 | |
| 86 | let mut child_nodes = Vec::new(); |
| 87 | let mut children_height = 0.0; |
| 88 | let mut children_height_correct = true; |
| 89 | |
| 90 | for child in widget.slivers.iter() { |
| 91 | let element = child.create_element(); |
| 92 | let child_nodes = &mut child_nodes; |
| 93 | if let Some(child) = element.node() { |
| 94 | // let child_style = LayoutSystem::style(child).unwrap(); |
| 95 | // LayoutSystem::set_style( |
| 96 | // child, |
| 97 | // style::Style { |
| 98 | // align_self: style::AlignSelf::Center, |
| 99 | // ..child_style |
| 100 | // }, |
| 101 | // ) |
| 102 | // .unwrap(); |
| 103 | |
| 104 | // calculate row height |
| 105 | let child_style = LayoutSystem::style(child).unwrap(); |
| 106 | if let style::Dimension::Points(height) = child_style.size.height { |
| 107 | children_height += height; |
| 108 | } else { |
| 109 | #[allow(unused_assignments)] |
| 110 | { |
| 111 | children_height_correct = false; |
| 112 | } |
| 113 | } |
| 114 | |
| 115 | child_nodes.push(child); |
| 116 | } |
| 117 | |
| 118 | children.push(element); |
| 119 | } |
| 120 | |
| 121 | // let height = match widget.main_axis_size { |
| 122 | // MainAxisSize::Min => { |
| 123 | // // should use calculated sum of childs height |
| 124 | // if children_height_correct { |
| 125 | // style::Dimension::Points(children_height) |
| 126 | // } else { |
| 127 | // style::Dimension::Percent(1.0) |
| 128 | // } |
| 129 | // }, |
nothing calls this directly
no test coverage detected