кнопки всегда тапабельны + тройной канал доставки для drag-to-select

This commit is contained in:
klockky
2026-05-23 06:44:18 +00:00
parent b108778084
commit e3e5e3ec75
2 changed files with 27 additions and 32 deletions
+7 -6
View File
@@ -1705,7 +1705,6 @@ class _LongPressBubble extends StatefulWidget {
class _LongPressBubbleState extends State<_LongPressBubble> {
final GlobalKey _boundaryKey = GlobalKey();
MessageActionsController? _controller;
int? _lastPointerId;
@override
void dispose() {
@@ -1715,9 +1714,6 @@ class _LongPressBubbleState extends State<_LongPressBubble> {
}
void _onLongPressStart(LongPressStartDetails details) {
final pointerId = _lastPointerId;
if (pointerId == null) return;
final ctx = _boundaryKey.currentContext;
if (ctx == null) return;
final renderObject = ctx.findRenderObject();
@@ -1738,7 +1734,7 @@ class _LongPressBubbleState extends State<_LongPressBubble> {
Haptics.medium();
final controller = MessageActionsController();
controller.attach(details.globalPosition, pointerId: pointerId);
controller.attach(details.globalPosition);
_controller = controller;
Navigator.of(ctx)
@@ -1764,10 +1760,15 @@ class _LongPressBubbleState extends State<_LongPressBubble> {
Widget build(BuildContext context) {
return Listener(
behavior: HitTestBehavior.deferToChild,
onPointerDown: (event) => _lastPointerId = event.pointer,
onPointerMove: (event) => _controller?.updatePointer(event.position),
onPointerUp: (event) => _controller?.commit(),
onPointerCancel: (event) => _controller?.commit(),
child: GestureDetector(
behavior: HitTestBehavior.deferToChild,
onLongPressStart: _onLongPressStart,
onLongPressMoveUpdate: (d) =>
_controller?.updatePointer(d.globalPosition),
onLongPressEnd: (_) => _controller?.commit(),
child: RepaintBoundary(
key: _boundaryKey,
child: widget.child,