mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-07-10 15:17:31 +00:00
pass selected space
This commit is contained in:
@ -15,9 +15,11 @@ import 'package:syncrow_web/utils/style.dart';
|
||||
|
||||
class SidebarWidget extends StatefulWidget {
|
||||
final Function(CommunityModel)? onCommunitySelected;
|
||||
final Function(SpaceModel)? onSpaceSelected;
|
||||
final List<CommunityModel> communities;
|
||||
|
||||
const SidebarWidget({super.key, this.onCommunitySelected, required this.communities});
|
||||
const SidebarWidget(
|
||||
{super.key, this.onCommunitySelected, this.onSpaceSelected, required this.communities});
|
||||
|
||||
@override
|
||||
_SidebarWidgetState createState() => _SidebarWidgetState();
|
||||
@ -204,11 +206,14 @@ class _SidebarWidgetState extends State<SidebarWidget> {
|
||||
onExpansionChanged: (bool expanded) {
|
||||
_handleExpansionChange(space.uuid ?? '', expanded);
|
||||
},
|
||||
onItemSelected: () => {
|
||||
if (widget.onCommunitySelected != null)
|
||||
{
|
||||
widget.onCommunitySelected!(community) // Pass the entire community
|
||||
}
|
||||
onItemSelected: () {
|
||||
if (widget.onCommunitySelected != null || widget.onSpaceSelected != null) {
|
||||
widget.onCommunitySelected!(community); // Pass the entire community
|
||||
}
|
||||
|
||||
if (widget.onSpaceSelected != null) {
|
||||
widget.onSpaceSelected!(space); // Pass the entire community
|
||||
}
|
||||
},
|
||||
children: space.children.isNotEmpty
|
||||
? space.children.map((childSpace) => _buildSpaceTile(childSpace, community)).toList()
|
||||
|
Reference in New Issue
Block a user