From 45e8225e1b33c85d775d863c2af639a1fd64ee09 Mon Sep 17 00:00:00 2001 From: Vatsal Tanna Date: Fri, 10 Mar 2023 15:57:02 +0530 Subject: [PATCH] fix: :bug: #346 Don't respond to any clicks in target & (#351) #348 showcaseview after upgrade to flutter 3.7.1 not disable target click --- CHANGELOG.md | 1 + lib/src/showcase.dart | 45 ++++++++++++++++++++++++------------------- 2 files changed, 26 insertions(+), 20 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d9b24d5b..7d22b68d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ ## [2.0.2] - Fixed [#335](https://github.com/SimformSolutionsPvtLtd/flutter_showcaseview/issues/335) - Fixed flutter inspector makes screen grey +- Fixed [#346](https://github.com/SimformSolutionsPvtLtd/flutter_showcaseview/issues/346) - Dont respond to any clicks in target. ## [2.0.1] - Feature [#306](https://github.com/SimformSolutionsPvtLtd/flutter_showcaseview/pull/306) - Added support of manual vertical tooltip position. diff --git a/lib/src/showcase.dart b/lib/src/showcase.dart index c7df3e05..657f147a 100644 --- a/lib/src/showcase.dart +++ b/lib/src/showcase.dart @@ -586,26 +586,31 @@ class _TargetWidget extends StatelessWidget { return Positioned( top: offset.dy, left: offset.dx, - child: IgnorePointer( - ignoring: disableDefaultChildGestures, - child: FractionalTranslation( - translation: const Offset(-0.5, -0.5), - child: GestureDetector( - onTap: onTap, - onLongPress: onLongPress, - onDoubleTap: onDoubleTap, - child: Container( - height: size!.height + 16, - width: size!.width + 16, - decoration: ShapeDecoration( - shape: radius != null - ? RoundedRectangleBorder(borderRadius: radius!) - : shapeBorder ?? - const RoundedRectangleBorder( - borderRadius: BorderRadius.all(Radius.circular(8)), - ), - ), - ), + child: disableDefaultChildGestures + ? IgnorePointer( + child: targetWidgetContent(), + ) + : targetWidgetContent(), + ); + } + + Widget targetWidgetContent() { + return FractionalTranslation( + translation: const Offset(-0.5, -0.5), + child: GestureDetector( + onTap: onTap, + onLongPress: onLongPress, + onDoubleTap: onDoubleTap, + child: Container( + height: size!.height + 16, + width: size!.width + 16, + decoration: ShapeDecoration( + shape: radius != null + ? RoundedRectangleBorder(borderRadius: radius!) + : shapeBorder ?? + const RoundedRectangleBorder( + borderRadius: BorderRadius.all(Radius.circular(8)), + ), ), ), ),