mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-08-25 04:22:28 +00:00
Refactor CommunityStructureCanvas to simplify DragTarget logic by replacing SizedBox with SizedBox.shrink() for better performance and readability.
This commit is contained in:
@ -425,18 +425,14 @@ class _CommunityStructureCanvasState extends State<CommunityStructureCanvas>
|
|||||||
height: _cardHeight,
|
height: _cardHeight,
|
||||||
child: DragTarget<SpaceReorderDataModel>(
|
child: DragTarget<SpaceReorderDataModel>(
|
||||||
builder: (context, candidateData, rejectedData) {
|
builder: (context, candidateData, rejectedData) {
|
||||||
if (_draggedData == null) {
|
if (_draggedData == null) return const SizedBox.shrink();
|
||||||
return const SizedBox();
|
|
||||||
}
|
|
||||||
|
|
||||||
final isTargetForDragged = (_draggedData?.parent?.uuid == parent?.uuid &&
|
final isTargetForDragged = (_draggedData?.parent?.uuid == parent?.uuid &&
|
||||||
_draggedData?.community == null) ||
|
_draggedData?.community == null) ||
|
||||||
(_draggedData?.community?.uuid == community?.uuid &&
|
(_draggedData?.community?.uuid == community?.uuid &&
|
||||||
_draggedData?.parent == null);
|
_draggedData?.parent == null);
|
||||||
|
|
||||||
if (!isTargetForDragged) {
|
if (!isTargetForDragged) return const SizedBox.shrink();
|
||||||
return const SizedBox();
|
|
||||||
}
|
|
||||||
|
|
||||||
return Container(
|
return Container(
|
||||||
width: 40,
|
width: 40,
|
||||||
|
Reference in New Issue
Block a user