<aside> ‼️ The notification bar is considered a part of screen height in implementation
</aside>
Tooltips provide text labels and the option to add images using an image picker, which helps explain the function of a button or other user interface action. You can wrap the button in a Tooltip widget, provide a message, and use an image picker to select or capture an image.
boolrequired
A boolean value that determines whether the tooltip is hidden (true) or visible (false).
Stringrequired
A string that identifies the target UI element or button to which the tooltip is associated.
Stringrequired
A string that represents the text to be displayed within the tooltip.
Sizerequired
A double value indicating the font size for the text inside the tooltip.
doublerequired
A double value specifying the padding (space) around the content inside the tooltip.
Colorrequired
A Color object representing the text color for the tooltip content.
Colorrequired
A Color object defining the background color of the tooltip.
doublerequired
A double value representing the corner radius of the tooltip, which affects the appearance of the tooltip's edges.
doublerequired
A double value indicating the width of the tooltip.
doublerequired
A double value specifying the width of the tooltip's arrow.
doublerequired
A double value representing the height of the tooltip's arrow.
TooltipPositionrequired
An instance of the TooltipPosition enum, indicating the position of the tooltip relative to the target element (e.g., top, bottom, left, right).
Uint8ListA Uint8List that can hold an image for the tooltip. If no image is provided, it can be null.
doubleA double value that defines the height of the tooltip (unused in the code).
doubleA double value specifying the aspect ratio of the tooltip (aspect ratio = width / height).
Widgetrequired
The child which will act as the target element can be any widget that you want to associate with the tooltip.
TooltipPropertiesrequired
The tooltipProperty parameter of the MyTooltip widget is responsible for determining the appearance, position, and other properties of the tooltip.
import 'package:plotline_task/src/models/tooltip_model.dart';
import 'package:plotline_task/src/services/tooltip/my_tooltip.dart';
The below code block demonstrates the usage of the MyTooltip widget in Flutter. Here's a breakdown of the code:
Inside the body of the Scaffold, use the MyToolTip widget:
MyToolTip(
tooltipProperty: TooltipProperties(
// Define your tooltip properties here
isHidden: false,
targetElement: 'My Button',
tooltipText: 'This is a button.',
// Customize other properties like colors, size, etc.
),
child: ElevatedButton(
onPressed: () {
// Button action here
},
child: Text('My Button'),
),
),
tooltipProperty with an instance of the TooltipProperties class, where you can define the properties of the tooltip, such as visibility (isHidden), target element (targetElement), tooltip text (tooltipText), and more.child property of MyTooltip is used to specify the widget that will act as the target element for the tooltip. In this example, an ElevatedButton is used as the target element.This code demonstrates a basic usage of the MyTooltip widget, allowing you to add tooltips to your Flutter UI elements and customize their appearance and behavior.

Here is a step-by-step explanation of the code image:
dispose() function is called when the widget is disposed. It removes the overlay when the widget is disposed.initiateOverlay() function is called to show the overlay. It adds a post-frame callback to show the overlay after the frame is rendered.showOverlay() function is called to display the tooltip overlay. It gets the overlay state from the current context, calculates the position and size of the tooltip, and creates an overlay entry to display the tooltip.setRelativePositionToTop(), setRelativePositionToLeft(), setRelativePositionToRight(), and setRelativePositionToBottom() functions are used to set the relative position of the tooltip based on the tooltip position specified in the widget.tooltipProperty.readjust() function is called to readjust the position of the tooltip if it overflows from the screen boundary. It calculates the new position of the tooltip based on the screen dimensions and the tooltip size.readjustTop(), readjustLeft(), readjustRight(), readjustBottom(), and readjustAuto() functions handle different scenarios for readjusting the tooltip position based on its overflow.buildOverlay() function builds the tooltip overlay content. It creates a material container with the specified tooltip text, background color, and text color. It also includes an optional image if provided.removeOverlay() function is called to remove the overlay when it is no longer needed.TooltipBox widget is a stateful widget that handles the readjustment of the tooltip position and renders the tooltip content._TooltipBoxState class manages the state of the TooltipBox widget and triggers the readjustment of the tooltip position after the frame is rendered.This code is responsible for creating and displaying tooltip overlays with customisable positions, styles, and content
https://whimsical.com/HAcTMqaraEf9LabFvRBEFd



