chore: update to 0.12
This commit is contained in:
parent
35fea09344
commit
9202383596
34 changed files with 712 additions and 454 deletions
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
use crate::{Element, Renderer};
|
||||
use iced_core::layout::{Limits, Node};
|
||||
use iced_core::widget::Tree;
|
||||
use iced_core::{Padding, Point, Size};
|
||||
|
||||
pub fn resolve<Message>(
|
||||
|
|
@ -12,6 +13,7 @@ pub fn resolve<Message>(
|
|||
padding: Padding,
|
||||
column_spacing: f32,
|
||||
row_spacing: f32,
|
||||
tree: &mut [Tree],
|
||||
) -> Node {
|
||||
let limits = limits.pad(padding);
|
||||
|
||||
|
|
@ -26,9 +28,9 @@ pub fn resolve<Message>(
|
|||
|
||||
let mut row_buffer = Vec::<Node>::with_capacity(8);
|
||||
|
||||
for child in items {
|
||||
for (child, tree) in items.iter().zip(tree.into_iter()) {
|
||||
// Calculate the dimensions of the item.
|
||||
let child_node = child.as_widget().layout(renderer, &limits);
|
||||
let child_node = child.as_widget().layout(tree, renderer, &limits);
|
||||
let size = child_node.size();
|
||||
|
||||
// Calculate the required additional width to fit the item into the current row.
|
||||
|
|
|
|||
|
|
@ -58,7 +58,12 @@ impl<'a, Message: 'static + Clone> Widget<Message, Renderer> for FlexRow<'a, Mes
|
|||
Length::Shrink
|
||||
}
|
||||
|
||||
fn layout(&self, renderer: &Renderer, limits: &layout::Limits) -> layout::Node {
|
||||
fn layout(
|
||||
&self,
|
||||
tree: &mut Tree,
|
||||
renderer: &Renderer,
|
||||
limits: &layout::Limits,
|
||||
) -> layout::Node {
|
||||
let limits = limits
|
||||
.max_width(self.max_width)
|
||||
.width(self.width())
|
||||
|
|
@ -71,6 +76,7 @@ impl<'a, Message: 'static + Clone> Widget<Message, Renderer> for FlexRow<'a, Mes
|
|||
self.padding,
|
||||
f32::from(self.column_spacing),
|
||||
f32::from(self.row_spacing),
|
||||
&mut tree.children,
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue