mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
chore: disable children receive events under fake drag target
This commit is contained in:
parent
aec5c3e807
commit
d941db29a1
@ -277,6 +277,31 @@ class IgnorePointerWidget extends StatelessWidget {
|
||||
}
|
||||
}
|
||||
|
||||
class AbsorbPointerWidget extends StatelessWidget {
|
||||
final Widget? child;
|
||||
final bool useIntrinsicSize;
|
||||
const AbsorbPointerWidget({
|
||||
required this.child,
|
||||
this.useIntrinsicSize = false,
|
||||
Key? key,
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final sizedChild = useIntrinsicSize
|
||||
? child
|
||||
: SizedBox(width: 0.0, height: 0.0, child: child);
|
||||
|
||||
final opacity = useIntrinsicSize ? 0.3 : 0.0;
|
||||
return AbsorbPointer(
|
||||
child: Opacity(
|
||||
opacity: opacity,
|
||||
child: sizedChild,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class PhantomWidget extends StatelessWidget {
|
||||
final Widget? child;
|
||||
final double opacity;
|
||||
@ -442,7 +467,7 @@ class _FakeDragTargetState<T extends DragTargetData>
|
||||
return SizeTransitionWithIntrinsicSize(
|
||||
sizeFactor: widget.deleteAnimationController,
|
||||
axis: Axis.vertical,
|
||||
child: IgnorePointerWidget(
|
||||
child: AbsorbPointerWidget(
|
||||
child: widget.child,
|
||||
),
|
||||
);
|
||||
@ -450,7 +475,7 @@ class _FakeDragTargetState<T extends DragTargetData>
|
||||
return SizeTransitionWithIntrinsicSize(
|
||||
sizeFactor: widget.insertAnimationController,
|
||||
axis: Axis.vertical,
|
||||
child: IgnorePointerWidget(
|
||||
child: AbsorbPointerWidget(
|
||||
useIntrinsicSize: true,
|
||||
child: widget.child,
|
||||
),
|
||||
|
@ -204,16 +204,16 @@ class BoardPhantomController extends OverlapDragTargetDelegate
|
||||
|
||||
@override
|
||||
int canMoveTo(String dragTargetId) {
|
||||
// if (columnsState.isDragging(dragTargetId)) {
|
||||
// return -1;
|
||||
// }
|
||||
if (columnsState.isDragging(dragTargetId)) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
// final controller = delegate.controller(dragTargetId);
|
||||
// if (controller != null) {
|
||||
// return controller.columnData.items.length;
|
||||
// } else {
|
||||
// return 0;
|
||||
// }
|
||||
final controller = delegate.controller(dragTargetId);
|
||||
if (controller != null) {
|
||||
return controller.columnData.items.length;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (delegate.controller(dragTargetId)?.columnData.items.isEmpty ?? false) {
|
||||
return 0;
|
||||
|
Loading…
Reference in New Issue
Block a user