applied opacity to connections

This commit is contained in:
hannathkadher
2024-11-21 21:09:49 +04:00
parent 8b7de7c8fd
commit b6998c055a

View File

@ -127,7 +127,12 @@ class _CommunityStructureAreaState extends State<CommunityStructureArea> {
child: Stack(
children: [
for (var connection in connections)
CustomPaint(painter: CurvedLinePainter([connection])),
Opacity(
opacity: _isHighlightedConnection(connection)
? 1.0
: 0.3, // Adjust opacity
child: CustomPaint(painter: CurvedLinePainter([connection])),
),
for (var entry in visibleSpaces.asMap().entries)
Positioned(
left: entry.value.position.dx,
@ -601,4 +606,11 @@ class _CommunityStructureAreaState extends State<CommunityStructureArea> {
}
}
}
bool _isHighlightedConnection(Connection connection) {
if (widget.selectedSpace == null) return true;
return connection.startSpace == widget.selectedSpace ||
connection.endSpace == widget.selectedSpace;
}
}