Make Widget::layout and operate mutable

... and bless `responsive`!
This commit is contained in:
Héctor Ramón Jiménez 2025-08-20 22:42:15 +02:00
parent 9490d735c5
commit 31bc6d48cd
No known key found for this signature in database
GPG key ID: 7CC46565708259A7
54 changed files with 284 additions and 519 deletions

View file

@ -287,12 +287,12 @@ mod toast {
}
fn layout(
&self,
&mut self,
tree: &mut Tree,
renderer: &Renderer,
limits: &layout::Limits,
) -> layout::Node {
self.content.as_widget().layout(
self.content.as_widget_mut().layout(
&mut tree.children[0],
renderer,
limits,
@ -343,14 +343,14 @@ mod toast {
}
fn operate(
&self,
&mut self,
state: &mut Tree,
layout: Layout<'_>,
renderer: &Renderer,
operation: &mut dyn Operation,
) {
operation.container(None, layout.bounds(), &mut |operation| {
self.content.as_widget().operate(
self.content.as_widget_mut().operate(
&mut state.children[0],
layout,
renderer,
@ -582,12 +582,12 @@ mod toast {
) {
operation.container(None, layout.bounds(), &mut |operation| {
self.toasts
.iter()
.iter_mut()
.zip(self.state.iter_mut())
.zip(layout.children())
.for_each(|((child, state), layout)| {
child
.as_widget()
.as_widget_mut()
.operate(state, layout, renderer, operation);
});
});