fixed space select

This commit is contained in:
hannathkadher
2024-11-21 20:40:36 +04:00
parent 082f8b0b27
commit 278d39cca1
4 changed files with 68 additions and 21 deletions

View File

@ -19,8 +19,9 @@ import 'package:syncrow_web/utils/constants/assets.dart';
class CommunityStructureArea extends StatefulWidget {
final CommunityModel? selectedCommunity;
final SpaceModel? selectedSpace;
SpaceModel? selectedSpace;
final List<ProductModel>? products;
final ValueChanged<SpaceModel?>? onSpaceSelected;
final List<SpaceModel> spaces;
final List<Connection> connections;
@ -31,6 +32,7 @@ class CommunityStructureArea extends StatefulWidget {
this.products,
required this.spaces,
required this.connections,
this.onSpaceSelected,
});
@override
@ -150,7 +152,7 @@ class _CommunityStructureAreaState extends State<CommunityStructureArea> {
onDoubleTap: () {
_showEditSpaceDialog(visibleSpaces[index]);
},
onTap: (){
onTap: () {
_selectSpace(visibleSpaces[index]);
},
icon: visibleSpaces[index].icon ?? '',
@ -559,8 +561,13 @@ class _CommunityStructureAreaState extends State<CommunityStructureArea> {
..scale(1.2);
}
void _selectSpace(SpaceModel space){
print(space.name);
}
void _selectSpace(SpaceModel space) {
setState(() {
widget.selectedSpace = space;
});
if (widget.onSpaceSelected != null) {
widget.onSpaceSelected!(space);
}
}
}