mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-07-16 01:56:24 +00:00
expansion only on clicking icon
This commit is contained in:
@ -175,20 +175,34 @@ class _SidebarWidgetState extends State<SidebarWidget> {
|
||||
|
||||
Widget _buildCommunityTile(CommunityModel community) {
|
||||
bool hasChildren = community.spaces.isNotEmpty;
|
||||
bool isSelectedCommunity = _selectedCommunityUuid == community.uuid;
|
||||
bool isSelectedCommunity = _selectedCommunityUuid ==
|
||||
community.uuid; // Check if this community is selected
|
||||
|
||||
debugPrint(
|
||||
'Building CommunityTile for ${community.name}, hasChildren: $hasChildren');
|
||||
debugPrint('Building CommunityTile for ${community.name} with UUID: ${community.uuid}');
|
||||
debugPrint('Currently selected community UUID: $_selectedCommunityUuid');
|
||||
debugPrint('Is selected: $isSelectedCommunity');
|
||||
|
||||
return CommunityTile(
|
||||
title: community.name,
|
||||
initiallyExpanded: isSelectedCommunity,
|
||||
isSelected: isSelectedCommunity,
|
||||
isExpanded: false,
|
||||
onItemSelected: () {
|
||||
setState(() {
|
||||
_selectedSpaceUuid = community.uuid; // Update the selected community
|
||||
debugPrint(
|
||||
'Selected community: ${community.name}, UUID: ${community.uuid}');
|
||||
debugPrint(
|
||||
'Updated selected community UUID: $_selectedCommunityUuid');
|
||||
});
|
||||
|
||||
if (widget.onCommunitySelected != null) {
|
||||
widget.onCommunitySelected!(community); // Pass the entire community
|
||||
}
|
||||
},
|
||||
onExpansionChanged: (String title, bool expanded) {
|
||||
debugPrint(
|
||||
'CommunityTile onExpansionChanged called for $title, expanded: $expanded');
|
||||
_handleExpansionChange(community.uuid, expanded);
|
||||
if (widget.onCommunitySelected != null) {
|
||||
widget.onCommunitySelected!(community); // Pass the entire community
|
||||
}
|
||||
},
|
||||
children: hasChildren
|
||||
? community.spaces.map((space) => _buildSpaceTile(space)).toList()
|
||||
|
Reference in New Issue
Block a user