bensonarafat / super_tooltip

SuperTooltip It is super flexible and allows you to display ToolTips in the overlay of the screen.
https://pub.dev/packages/super_tooltip
MIT License
142 stars 96 forks source link

Feature Request: Allow External Control of Tooltip Animation #115 #116

Closed ryannapp-fedex closed 3 months ago

ryannapp-fedex commented 3 months ago

Summary:

This pull request introduces a new boolean property showOnTap to the SuperTooltip widget, allowing developers to control whether the tooltip should be displayed when the child widget it wraps is tapped. This enhancement enables more flexible use cases, particularly when integrating with external state management solutions like BLoC.

New Functionality:

The showOnTap property supports the following three scenarios:

  1. Tooltip shows when the child widget is tapped:

    • If showOnTap is set to true (default behavior), the tooltip will be displayed when the user taps the child widget.
  2. Tooltip shows on both BLoC event triggers and child widget taps:

    • If showOnTap is true, the tooltip can be displayed either by tapping the child widget or by triggering a BLoC event that calls SuperTooltipController.showTooltip().
  3. Tooltip shows only on BLoC event triggers:

    • If showOnTap is set to false, the tooltip will only be displayed when a BLoC event triggers it, and it will ignore any taps on the child widget.

Code Changes:

  1. Added showOnTap Property:

    • The SuperTooltip widget now includes a showOnTap boolean property, which defaults to true to maintain backward compatibility.
  2. Updated GestureDetector Logic:

    • The GestureDetector in the build method was updated to check the showOnTap value before attempting to show the tooltip when the child widget is tapped.

Backward Compatibility:

Testing:

bensonarafat commented 3 months ago

I will send a new release soon @ryannapp-fedex. Thanks