From adaea8611c3fbf204e21fb7237558ef67f062491 Mon Sep 17 00:00:00 2001 From: CassieRan Date: Fri, 29 Nov 2024 17:40:25 +0800 Subject: [PATCH] fix: ColorPickerSlider's gesture has conflict with TabBarView issue: #122 --- lib/src/palette.dart | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/lib/src/palette.dart b/lib/src/palette.dart index 7bc9b33..36939fc 100644 --- a/lib/src/palette.dart +++ b/lib/src/palette.dart @@ -1143,11 +1143,25 @@ class ColorPickerSlider extends StatelessWidget { child: LayoutBuilder( builder: (BuildContext context, BoxConstraints box) { RenderBox? getBox = context.findRenderObject() as RenderBox?; - return GestureDetector( - onPanDown: (DragDownDetails details) => - getBox != null ? slideEvent(getBox, box, details.globalPosition) : null, - onPanUpdate: (DragUpdateDetails details) => - getBox != null ? slideEvent(getBox, box, details.globalPosition) : null, + return RawGestureDetector( + gestures: { + _AlwaysWinPanGestureRecognizer: + GestureRecognizerFactoryWithHandlers< + _AlwaysWinPanGestureRecognizer>( + () => _AlwaysWinPanGestureRecognizer(), + (_AlwaysWinPanGestureRecognizer instance) { + instance + ..onDown = ((DragDownDetails details) => getBox != + null + ? slideEvent(getBox, box, details.globalPosition) + : null) + ..onUpdate = ((DragUpdateDetails details) => getBox != + null + ? slideEvent(getBox, box, details.globalPosition) + : null); + }, + ), + }, ); }, ),