selectMenuPath method
Implementation
void selectMenuPath(String path) {
MenuNode root = MenuNode(
path: '',
label: '',
deep: -1,
children: _state.items,
);
List<MenuNode> result = findNodes(root, Uri.parse(path), 0, '/', []);
if (result.isNotEmpty) {
List<String> expandMenus = [];
if (result.length > 1) {
expandMenus.addAll(
result.sublist(0, result.length - 1).map((e) => e.path).toList());
}
if (_shouldAddHistory) {
_history.add(MenuHistory(
menuLabel: result.last.label,
menuPath: result.last.path,
));
} else {
_shouldAddHistory = true;
}
print("=====selectMenuPath: ${result.last.path}===============");
_state = state.copyWith(
activeMenu: result.last.path, expandMenus: expandMenus);
}
}