feat: support DidUpdateChildViews callback

This commit is contained in:
Lucas.Xu 2023-08-13 17:32:52 +08:00
parent d0a343ee36
commit 9863000f4a

View File

@ -30,6 +30,15 @@ class ViewBloc extends Bloc<ViewEvent, ViewState> {
onViewUpdated: (result) {
add(ViewEvent.viewDidUpdate(left(result)));
},
onViewChildViewsUpdated: (result) async {
final view = await ViewBackendService.getView(
result.parentViewId,
);
view.fold(
(view) => add(ViewEvent.viewDidUpdate(left(view))),
(error) => add(ViewEvent.viewDidUpdate(right(error))),
);
},
);
final isExpanded = await _getViewIsExpanded(view);
await _loadViewsWhenExpanded(emit, isExpanded);