simplify space selection logic.

This commit is contained in:
Faris Armoush
2025-04-13 13:12:48 +03:00
parent 6493f02bcc
commit 79f5ef7871

View File

@ -78,14 +78,9 @@ class _SidebarWidgetState extends State<SidebarWidget> {
}
bool _isSpaceOrChildSelected(SpaceModel space) {
if (_selectedSpaceUuid == space.uuid) return true;
for (var child in space.children) {
if (_isSpaceOrChildSelected(child)) return true;
}
return false;
final isSpaceSelected = _selectedSpaceUuid == space.uuid;
final anySubSpaceIsSelected = space.children.any(_isSpaceOrChildSelected);
return isSpaceSelected || anySubSpaceIsSelected;
}
@override