Closed sgehrman closed 2 years ago
Hi @sgehrman!
The childIndex1
and childIndex2
refer to children whose size has been changed. A divider changes the size of two.
You are right about onSizeChange
, it is being called before the model is updated. A workaround would be to use Future
as you said. But I will change that.
I think the ideal will be to change some things. The listener is only notified by dragging the splitter. I think it should be notified in the window resize too. But with that, you will no longer be able to have both indices.
It is also worth remembering that the component does not store the size of each area, but its weights. So in a window resizing, the weights under normal conditions would remain the same and the listener would not be notified. Only when the available space was less than the minimum, then the weight would be forced to change and notify the listener.
Renaming OnSizeChange
to OnWeightChange
to be more coherent.
Done.
Now you can save using the onWeightChange
without Future.delay
workaround.
To restore you can create a new controller or update it. Example: _controller.areas = [Area(weight: .1)];
I got the update. works great now. Thanks!
onSizeChange gives me two indexes. What do I do with those? I need to get the weights of all the areas so I can save them, but the areas aren't updated until after this is called.
The areas get updated after this call, so I guess I could do a Future.delay and then do the save, but it seems this should be simpler. Am I doing it wrong?