fixed hover issue

This commit is contained in:
hannathkadher
2024-11-23 15:37:37 +04:00
parent 1a967e2ba0
commit 12bf0f0b57

View File

@ -91,7 +91,6 @@ class _CommunityStructureAreaState extends State<CommunityStructureArea> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final visibleSpaces = flattenSpaces(spaces);
Size screenSize = MediaQuery.of(context).size; Size screenSize = MediaQuery.of(context).size;
return Expanded( return Expanded(
child: GestureDetector( child: GestureDetector(
@ -111,7 +110,6 @@ class _CommunityStructureAreaState extends State<CommunityStructureArea> {
Flexible( Flexible(
child: Stack( child: Stack(
children: [ children: [
if (visibleSpaces.isNotEmpty)
InteractiveViewer( InteractiveViewer(
transformationController: _transformationController, transformationController: _transformationController,
boundaryMargin: EdgeInsets.all(500), boundaryMargin: EdgeInsets.all(500),
@ -130,7 +128,8 @@ class _CommunityStructureAreaState extends State<CommunityStructureArea> {
: 0.3, // Adjust opacity : 0.3, // Adjust opacity
child: CustomPaint(painter: CurvedLinePainter([connection])), child: CustomPaint(painter: CurvedLinePainter([connection])),
), ),
for (var entry in visibleSpaces.asMap().entries) for (var entry in spaces.asMap().entries)
if(entry.value.status != SpaceStatus.deleted)
Positioned( Positioned(
left: entry.value.position.dx, left: entry.value.position.dx,
top: entry.value.position.dy, top: entry.value.position.dy,
@ -139,7 +138,7 @@ class _CommunityStructureAreaState extends State<CommunityStructureArea> {
onButtonTap: (int index, Offset newPosition, String direction) { onButtonTap: (int index, Offset newPosition, String direction) {
_showCreateSpaceDialog( _showCreateSpaceDialog(
screenSize, screenSize,
position: visibleSpaces[index].position + newPosition, position: spaces[index].position + newPosition,
parentIndex: index, parentIndex: index,
direction: direction, direction: direction,
); );
@ -153,20 +152,20 @@ class _CommunityStructureAreaState extends State<CommunityStructureArea> {
}, },
buildSpaceContainer: (int index) { buildSpaceContainer: (int index) {
final bool isHighlighted = final bool isHighlighted =
_isHighlightedSpace(visibleSpaces[index]); _isHighlightedSpace(spaces[index]);
return Opacity( return Opacity(
opacity: isHighlighted ? 1.0 : 0.3, opacity: isHighlighted ? 1.0 : 0.3,
child: SpaceContainerWidget( child: SpaceContainerWidget(
index: index, index: index,
onDoubleTap: () { onDoubleTap: () {
_showEditSpaceDialog(visibleSpaces[index]); _showEditSpaceDialog(spaces[index]);
}, },
onTap: () { onTap: () {
_selectSpace(visibleSpaces[index]); _selectSpace(spaces[index]);
}, },
icon: visibleSpaces[index].icon ?? '', icon: spaces[index].icon ?? '',
name: visibleSpaces[index].name, name: spaces[index].name,
)); ));
}, },
), ),
@ -175,7 +174,7 @@ class _CommunityStructureAreaState extends State<CommunityStructureArea> {
), ),
), ),
), ),
if (visibleSpaces.isEmpty) if (spaces.isEmpty)
Center( Center(
child: AddSpaceButton( child: AddSpaceButton(
onTap: () { onTap: () {