onItemClick method
Implementation
void onItemClick(int index, Menu obj) {
if(obj.subs.isNotEmpty){ // parent
setState(() {
if (prevExpand != -1) {
menus[prevExpand].expand = false;
}
menus[index] = obj;
prevExpand = obj.expand ? index : -1;
});
} else { // child
if(obj.route == null) return;
Navigator.push(context, MaterialPageRoute(builder: (BuildContext context){
return obj.route!;
})).then((value) {
});
}
}