diff --git a/CHANGELOG.md b/CHANGELOG.md index 30719dbc..5c2dcbf3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,10 @@ ## [4.1.0] - (UnRelease) - Feature [#500](https://github.com/SimformSolutionsPvtLtd/flutter_showcaseview/issues/500) - Added `onDismiss` callback in `ShowCaseWidget` which will trigger whenever `onDismiss` method is - called + called. +- Fixed [#503](https://github.com/SimformSolutionsPvtLtd/flutter_showcaseview/issues/503) - Cursor + not changing to click mode when it is hovering over the clickable widgets provided by this + package. ## [4.0.1] - Fixed [#493](https://github.com/SimformSolutionsPvtLtd/flutter_showcaseview/issues/493) - ShowCase.withWidget not showing issue diff --git a/lib/src/showcase.dart b/lib/src/showcase.dart index acce5651..236a51a3 100644 --- a/lib/src/showcase.dart +++ b/lib/src/showcase.dart @@ -807,7 +807,10 @@ class _ShowcaseState extends State { showArrow: widget.showArrow, contentHeight: widget.height, contentWidth: widget.width, - onTooltipTap: _getOnTooltipTap, + onTooltipTap: + widget.disposeOnTap == true || widget.onToolTipClick != null + ? _getOnTooltipTap + : null, tooltipPadding: widget.tooltipPadding, disableMovingAnimation: widget.disableMovingAnimation ?? showCaseWidgetState.disableMovingAnimation, @@ -908,7 +911,10 @@ class _TargetWidget extends StatelessWidget { ? IgnorePointer( child: targetWidgetContent(), ) - : targetWidgetContent(), + : MouseRegion( + cursor: SystemMouseCursors.click, + child: targetWidgetContent(), + ), ); } diff --git a/lib/src/tooltip_action_button_widget.dart b/lib/src/tooltip_action_button_widget.dart index 59bfad68..e0ad93ca 100644 --- a/lib/src/tooltip_action_button_widget.dart +++ b/lib/src/tooltip_action_button_widget.dart @@ -21,35 +21,38 @@ class TooltipActionButtonWidget extends StatelessWidget { final theme = Theme.of(context); return config.button ?? - GestureDetector( - onTap: handleOnTap, - child: Container( - padding: config.padding, - decoration: BoxDecoration( - color: config.backgroundColor ?? theme.primaryColor, - borderRadius: config.borderRadius, - border: config.border, - ), - child: Row( - mainAxisSize: MainAxisSize.min, - children: [ - if (config.leadIcon != null) - Padding( - padding: config.leadIcon?.padding ?? - const EdgeInsets.only(right: 5), - child: config.leadIcon?.icon, - ), - Text( - config.name ?? config.type?.actionName ?? '', - style: config.textStyle, - ), - if (config.tailIcon != null) - Padding( - padding: config.tailIcon?.padding ?? - const EdgeInsets.only(left: 5), - child: config.tailIcon?.icon, + MouseRegion( + cursor: SystemMouseCursors.click, + child: GestureDetector( + onTap: handleOnTap, + child: Container( + padding: config.padding, + decoration: BoxDecoration( + color: config.backgroundColor ?? theme.primaryColor, + borderRadius: config.borderRadius, + border: config.border, + ), + child: Row( + mainAxisSize: MainAxisSize.min, + children: [ + if (config.leadIcon != null) + Padding( + padding: config.leadIcon?.padding ?? + const EdgeInsets.only(right: 5), + child: config.leadIcon?.icon, + ), + Text( + config.name ?? config.type?.actionName ?? '', + style: config.textStyle, ), - ], + if (config.tailIcon != null) + Padding( + padding: config.tailIcon?.padding ?? + const EdgeInsets.only(left: 5), + child: config.tailIcon?.icon, + ), + ], + ), ), ), ); diff --git a/lib/src/tooltip_widget.dart b/lib/src/tooltip_widget.dart index 618a8cb6..05878a24 100644 --- a/lib/src/tooltip_widget.dart +++ b/lib/src/tooltip_widget.dart @@ -546,94 +546,100 @@ class _ToolTipWidgetState extends State child: ClipRRect( borderRadius: widget.tooltipBorderRadius ?? BorderRadius.circular(8.0), - child: GestureDetector( - onTap: widget.onTooltipTap, - child: Container( - width: tooltipWidth, - padding: widget.tooltipPadding?.copyWith( - left: 0, - right: 0, - ), - color: widget.tooltipBackgroundColor, - child: Column( - children: [ - if (widget.title != null) - Align( - alignment: widget.titleAlignment, - child: Padding( - padding: (widget.titlePadding ?? - zeroPadding) - .add( - EdgeInsets.only( - left: widget - .tooltipPadding?.left ?? - 0, - right: widget.tooltipPadding - ?.right ?? - 0, + child: MouseRegion( + cursor: widget.onTooltipTap == null + ? MouseCursor.defer + : SystemMouseCursors.click, + child: GestureDetector( + onTap: widget.onTooltipTap, + child: Container( + width: tooltipWidth, + padding: widget.tooltipPadding?.copyWith( + left: 0, + right: 0, + ), + color: widget.tooltipBackgroundColor, + child: Column( + children: [ + if (widget.title != null) + Align( + alignment: widget.titleAlignment, + child: Padding( + padding: (widget.titlePadding ?? + zeroPadding) + .add( + EdgeInsets.only( + left: widget.tooltipPadding + ?.left ?? + 0, + right: widget.tooltipPadding + ?.right ?? + 0, + ), ), - ), - child: Text( - widget.title!, - textAlign: widget.titleTextAlign, - textDirection: - widget.titleTextDirection, - style: widget.titleTextStyle ?? - Theme.of(context) - .textTheme - .titleLarge! - .merge( - TextStyle( - color: - widget.textColor, + child: Text( + widget.title!, + textAlign: + widget.titleTextAlign, + textDirection: + widget.titleTextDirection, + style: widget.titleTextStyle ?? + Theme.of(context) + .textTheme + .titleLarge! + .merge( + TextStyle( + color: widget + .textColor, + ), ), - ), + ), ), ), - ), - if (widget.description != null) - Align( - alignment: - widget.descriptionAlignment, - child: Padding( - padding: - (widget.descriptionPadding ?? - zeroPadding) - .add( - EdgeInsets.only( - left: widget - .tooltipPadding?.left ?? - 0, - right: widget.tooltipPadding - ?.right ?? - 0, + if (widget.description != null) + Align( + alignment: + widget.descriptionAlignment, + child: Padding( + padding: + (widget.descriptionPadding ?? + zeroPadding) + .add( + EdgeInsets.only( + left: widget.tooltipPadding + ?.left ?? + 0, + right: widget.tooltipPadding + ?.right ?? + 0, + ), ), - ), - child: Text( - widget.description!, - textAlign: - widget.descriptionTextAlign, - textDirection: widget - .descriptionTextDirection, - style: widget.descTextStyle ?? - Theme.of(context) - .textTheme - .titleSmall! - .merge( - TextStyle( - color: - widget.textColor, + child: Text( + widget.description!, + textAlign: + widget.descriptionTextAlign, + textDirection: widget + .descriptionTextDirection, + style: widget.descTextStyle ?? + Theme.of(context) + .textTheme + .titleSmall! + .merge( + TextStyle( + color: widget + .textColor, + ), ), - ), + ), ), ), - ), - if (widget.tooltipActions.isNotEmpty && - widget.tooltipActionConfig.position - .isInside && - _tooltipActionSize != null) - _getActionWidget(insideWidget: true), - ], + if (widget.tooltipActions.isNotEmpty && + widget.tooltipActionConfig.position + .isInside && + _tooltipActionSize != null) + _getActionWidget(insideWidget: true), + ], + ), ), ), ), @@ -686,49 +692,54 @@ class _ToolTipWidgetState extends State ).animate(_movingAnimation), child: Material( color: Colors.transparent, - child: GestureDetector( - onTap: widget.onTooltipTap, - child: Container( - padding: EdgeInsets.only( - top: paddingTop, - bottom: paddingBottom, - ), - color: Colors.transparent, - child: Center( - child: Stack( - children: [ - // This widget is used for calculation of the action - // widget size and it will be removed once the size - // is calculated - // We have kept it in colum because if we put is - // outside in the stack then it will take whole - // screen size and width calculation will fail - if (isSizeRecalculating) _getOffstageActionWidget, - - // This offset is used to make animation smoother - // when there is big action widget which make - // the tool tip to change it's position - Offstage( - offstage: isSizeRecalculating, - child: SizedBox( - width: tooltipWidth, - child: Column( - children: [ - if (widget.tooltipActions.isNotEmpty && - !isArrowUp) - _getActionWidget(), - MeasureSize( - onSizeChange: onSizeChange, - child: widget.container, - ), - if (widget.tooltipActions.isNotEmpty && - isArrowUp) - _getActionWidget(), - ], + child: MouseRegion( + cursor: widget.onTooltipTap == null + ? MouseCursor.defer + : SystemMouseCursors.click, + child: GestureDetector( + onTap: widget.onTooltipTap, + child: Container( + padding: EdgeInsets.only( + top: paddingTop, + bottom: paddingBottom, + ), + color: Colors.transparent, + child: Center( + child: Stack( + children: [ + // This widget is used for calculation of the action + // widget size and it will be removed once the size + // is calculated + // We have kept it in colum because if we put is + // outside in the stack then it will take whole + // screen size and width calculation will fail + if (isSizeRecalculating) _getOffstageActionWidget, + + // This offset is used to make animation smoother + // when there is big action widget which make + // the tool tip to change it's position + Offstage( + offstage: isSizeRecalculating, + child: SizedBox( + width: tooltipWidth, + child: Column( + children: [ + if (widget.tooltipActions.isNotEmpty && + !isArrowUp) + _getActionWidget(), + MeasureSize( + onSizeChange: onSizeChange, + child: widget.container, + ), + if (widget.tooltipActions.isNotEmpty && + isArrowUp) + _getActionWidget(), + ], + ), ), ), - ), - ], + ], + ), ), ), ),