Open rodolfogoulart opened 2 weeks ago
Hi @rodolfogoulart!
Of course, but just curious, are you using MultiSplitView
inside a StatelessWidget
? Is that why you don't have the reference for the MultiSplitViewController
?
I asked because with the state you already have the reference to the controller:
class MultiSplitViewExampleState extends State<MultiSplitViewExample> {
final MultiSplitViewController _controller = MultiSplitViewController();
@override
void initState() {
super.initState();
_controller.areas = [
Area(builder: (c, a) => const MyStatefulWidget()),
Area(builder: (c, a) => const MyStatefulWidget())
];
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: const Text('Multi Split View Example')),
body: MultiSplitView(
controller: _controller,
onDividerDragUpdate: _onDividerDragUpdate));
}
void _onDividerDragUpdate(int index) {
// _controller.areas
}
}
Obrigado @caduandrade . Com esta nova versão eu estava com problemas para entender as modificações que precisava fazer aqui. Mas fiz as modificações criando o controller do MultiSplitViewController no initState e usando o builder: (BuildContext context, Area area) do MultiSplitView, no começo não tinha entendido aquele builder não kkkkk
mas ficou bacana, bom que a nova versão eliminou um bug que estava sofrendo aqui, na antiga versão.
Outra coisa, nesta nova versão, se puder mesmo disponibilizar o controller no onDragUpdate e nos outros métodos que somente esta passando o index, iria ajudar aqueles que por algum motivo estejam usando o initialAreas, porque quando usado sem o controller, os métodos (onDividerDragUpdate, onDividerDoubleTap, onDividerTap) ficam meio sem sentido, só sabendo o index, sem as funções do controller interno. mas fica mais para sugestão do que para necessidade rs
Can you add to onDividerDragUpdate the controller of the MultiSplitView?
I was using the previous version of the MultiSplitView, and used the onWeightChange to save the weight of the area, so the user when open the app will have the area started on their respective size as he changed before.
to replicate this on this new version its been hard, a lot of workaround to do.
if we can have like that
onDividerDragUpdate
to do that need to change this
this way, i can have acess to the area itself,