setPanes method
void
setPanes({
- required List<
VoDashboardPane> dockPanes, - required List<
VoDashboardPane> drawerPanes, - required List<
VoDashboardPane> endDrawerPanes, - required String initialPaneKey,
Replaces the pane lists. VoDashboard calls this on every build, so listeners are not notified; the dashboard is rebuilding anyway.
History keeps the panes that still exist. If none remain, it starts at
initialPaneKey, or the first pane when that doesn't exist.
Implementation
void setPanes({
required List<VoDashboardPane> dockPanes,
required List<VoDashboardPane> drawerPanes,
required List<VoDashboardPane> endDrawerPanes,
required String initialPaneKey,
}) {
_dockPanes = List.unmodifiable(dockPanes);
_drawerPanes = List.unmodifiable(drawerPanes);
_endDrawerPanes = List.unmodifiable(endDrawerPanes);
final panes = <String, VoDashboardPane>{};
for (final pane in [...dockPanes, ...drawerPanes, ...endDrawerPanes]) {
if (pane.builder != null && !pane.isChromeOnly) {
panes.putIfAbsent(pane.key, () => pane);
}
}
_panes = Map.unmodifiable(panes);
_history.removeWhere((key) => !_panes.containsKey(key));
if (_history.isEmpty && _panes.isNotEmpty) {
_history.add(
_panes.containsKey(initialPaneKey) ? initialPaneKey : _panes.keys.first,
);
}
}