From 968450ec4430370740e9042791b6cf195a25eadb Mon Sep 17 00:00:00 2001 From: Sahil-Simform Date: Wed, 6 Mar 2024 17:20:13 +0530 Subject: [PATCH] =?UTF-8?q?fix:=20=F0=9F=90=9B=20Fixed=20target=20hit=20ar?= =?UTF-8?q?ea=20-=20Updated=20`IgnorePointer`=20to=20`AbsorbPointer`=20as?= =?UTF-8?q?=20ignore=20pointer=20is=20not=20blocking=20tap=20to=20descenda?= =?UTF-8?q?nts=20-=20removed=20`FractionalTranslation`=20as=20it=20is=20no?= =?UTF-8?q?t=20shifting=20tappable=20area=20and=20only=20shifting=20paint?= =?UTF-8?q?=20of=20widgets=20-=20Made=20`size`=20and=20`shapeBorder`=20not?= =?UTF-8?q?=20nullable=20as=20we=20are=20assigning=20not=20null=20values?= =?UTF-8?q?=20to=20that=20constructor=20variable=20-=20Updated=20default?= =?UTF-8?q?=20`offset`=20to=20`rectBound.topLeft`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/src/showcase.dart | 43 ++++++++++++++++++++----------------------- 1 file changed, 20 insertions(+), 23 deletions(-) diff --git a/lib/src/showcase.dart b/lib/src/showcase.dart index 50c6a7f1..a515409e 100644 --- a/lib/src/showcase.dart +++ b/lib/src/showcase.dart @@ -575,7 +575,7 @@ class _ShowcaseState extends State { if (_isScrollRunning) Center(child: widget.scrollLoadingWidget), if (!_isScrollRunning) ...[ _TargetWidget( - offset: offset, + offset: rectBound.topLeft, size: size, onTap: _getOnTargetTap, radius: widget.targetBorderRadius, @@ -626,20 +626,20 @@ class _ShowcaseState extends State { class _TargetWidget extends StatelessWidget { final Offset offset; - final Size? size; + final Size size; final VoidCallback? onTap; final VoidCallback? onDoubleTap; final VoidCallback? onLongPress; - final ShapeBorder? shapeBorder; + final ShapeBorder shapeBorder; final BorderRadius? radius; final bool disableDefaultChildGestures; const _TargetWidget({ Key? key, required this.offset, - this.size, + required this.size, + required this.shapeBorder, this.onTap, - this.shapeBorder, this.radius, this.onDoubleTap, this.onLongPress, @@ -649,10 +649,11 @@ class _TargetWidget extends StatelessWidget { @override Widget build(BuildContext context) { return Positioned( + //TODO: Add target padding in major version upgrade top: offset.dy, left: offset.dx, child: disableDefaultChildGestures - ? IgnorePointer( + ? AbsorbPointer( child: targetWidgetContent(), ) : targetWidgetContent(), @@ -660,23 +661,19 @@ class _TargetWidget extends StatelessWidget { } 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)), - ), - ), + return GestureDetector( + onTap: onTap, + onLongPress: onLongPress, + onDoubleTap: onDoubleTap, + child: Container( + //TODO: Add target padding in major version upgrade and + // remove default 16 padding from this widget + height: size.height + 16, + width: size.width + 16, + decoration: ShapeDecoration( + shape: radius != null + ? RoundedRectangleBorder(borderRadius: radius!) + : shapeBorder, ), ), );