mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-07-09 22:57:21 +00:00
removed unused method and its use.
This commit is contained in:
@ -36,7 +36,8 @@ class _SidebarWidgetState extends State<SidebarWidget> {
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_selectedId = widget.selectedSpaceUuid; // Initialize with the passed selected space UUID
|
||||
_selectedId =
|
||||
widget.selectedSpaceUuid; // Initialize with the passed selected space UUID
|
||||
}
|
||||
|
||||
@override
|
||||
@ -61,8 +62,8 @@ class _SidebarWidgetState extends State<SidebarWidget> {
|
||||
return widget.communities.where((community) {
|
||||
final containsQueryInCommunity =
|
||||
community.name.toLowerCase().contains(_searchQuery.toLowerCase());
|
||||
final containsQueryInSpaces =
|
||||
community.spaces.any((space) => _containsQuery(space, _searchQuery.toLowerCase()));
|
||||
final containsQueryInSpaces = community.spaces
|
||||
.any((space) => _containsQuery(space, _searchQuery.toLowerCase()));
|
||||
|
||||
return containsQueryInCommunity || containsQueryInSpaces;
|
||||
}).toList();
|
||||
@ -71,8 +72,8 @@ class _SidebarWidgetState extends State<SidebarWidget> {
|
||||
// Helper function to determine if any space or its children match the search query
|
||||
bool _containsQuery(SpaceModel space, String query) {
|
||||
final matchesSpace = space.name.toLowerCase().contains(query);
|
||||
final matchesChildren =
|
||||
space.children.any((child) => _containsQuery(child, query)); // Recursive check for children
|
||||
final matchesChildren = space.children.any(
|
||||
(child) => _containsQuery(child, query)); // Recursive check for children
|
||||
|
||||
// If the space or any of its children match the query, expand this space
|
||||
if (matchesSpace || matchesChildren) {
|
||||
@ -106,7 +107,8 @@ class _SidebarWidgetState extends State<SidebarWidget> {
|
||||
width: 300,
|
||||
decoration: subSectionContainerDecoration,
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min, // Ensures the Column only takes necessary height
|
||||
mainAxisSize:
|
||||
MainAxisSize.min, // Ensures the Column only takes necessary height
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
// Communities title with the add button
|
||||
@ -153,9 +155,9 @@ class _SidebarWidgetState extends State<SidebarWidget> {
|
||||
// Community list
|
||||
Expanded(
|
||||
child: ListView(
|
||||
children: filteredCommunities.map((community) {
|
||||
return _buildCommunityTile(context, community);
|
||||
}).toList(),
|
||||
children: filteredCommunities
|
||||
.map((community) => _buildCommunityTile(context, community))
|
||||
.toList(),
|
||||
),
|
||||
),
|
||||
],
|
||||
@ -192,9 +194,7 @@ class _SidebarWidgetState extends State<SidebarWidget> {
|
||||
SelectCommunityEvent(selectedCommunity: community),
|
||||
);
|
||||
},
|
||||
onExpansionChanged: (String title, bool expanded) {
|
||||
_handleExpansionChange(community.uuid, expanded);
|
||||
},
|
||||
onExpansionChanged: (title, expanded) {},
|
||||
children: hasChildren
|
||||
? community.spaces
|
||||
.where((space) => (space.status != SpaceStatus.deleted ||
|
||||
@ -205,7 +205,8 @@ class _SidebarWidgetState extends State<SidebarWidget> {
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildSpaceTile(SpaceModel space, CommunityModel community, {int depth = 1}) {
|
||||
Widget _buildSpaceTile(SpaceModel space, CommunityModel community,
|
||||
{int depth = 1}) {
|
||||
bool isExpandedSpace = _isSpaceOrChildSelected(space);
|
||||
return Padding(
|
||||
padding: EdgeInsets.only(left: depth * 16.0),
|
||||
@ -214,9 +215,7 @@ class _SidebarWidgetState extends State<SidebarWidget> {
|
||||
key: ValueKey(space.uuid),
|
||||
isSelected: _selectedId == space.uuid,
|
||||
initiallyExpanded: isExpandedSpace,
|
||||
onExpansionChanged: (bool expanded) {
|
||||
_handleExpansionChange(space.uuid ?? '', expanded);
|
||||
},
|
||||
onExpansionChanged: (expanded) {},
|
||||
onItemSelected: () {
|
||||
setState(() {
|
||||
_selectedId = space.uuid;
|
||||
@ -224,14 +223,15 @@ class _SidebarWidgetState extends State<SidebarWidget> {
|
||||
});
|
||||
|
||||
context.read<SpaceManagementBloc>().add(
|
||||
SelectSpaceEvent(selectedCommunity: community, selectedSpace: space),
|
||||
SelectSpaceEvent(
|
||||
selectedCommunity: community, selectedSpace: space),
|
||||
);
|
||||
},
|
||||
children: space.children.isNotEmpty
|
||||
? space.children.map((childSpace) => _buildSpaceTile(childSpace, community)).toList()
|
||||
? space.children
|
||||
.map((childSpace) => _buildSpaceTile(childSpace, community))
|
||||
.toList()
|
||||
: [], // Recursively render child spaces if available
|
||||
));
|
||||
}
|
||||
|
||||
void _handleExpansionChange(String uuid, bool expanded) {}
|
||||
}
|
||||
|
Reference in New Issue
Block a user