Tooltip
The Tooltip Widget is used to provide information to the user for a specific unit.
This is useful when there is additional information that you wish to convey to the user.
- Tooltip
In Flutter, tooltips can be displayed using Tooltip
.
Specify any text in message
and the widget you wish to target in child
.
Tooltip(message: "I'm tooltip!",child: TextButton(onPressed: () {}, child: const Text("Mouse over this text")),)
- verticalOffset
By adjusting the value of verticalOffset
, the position of the tooltip in the vertical direction can be adjusted.
It is also possible to adjust the left and right directions by adjusting the value of margin
.
Tooltip(verticalOffset: -48,message: "I'm tooltip!",child: TextButton(onPressed: () {}, child: const Text("Top")),),
- BoxDecoration
The decoration
property can be used to change the style of the background color, border, etc.
Various other properties are also available to flexibly change the appearance.
Tooltip(message: "I'm tooltip!",padding: const EdgeInsets.symmetric(vertical: 5, horizontal: 20),decoration: BoxDecoration(color: Colors.purple[300], // background colorborderRadius: BorderRadius.circular(10) // border radius),textStyle: const TextStyle(fontSize: 14, color: Colors.white),child: TextButton(onPressed: () {}, child: const Text("Mouse over this text")),)
For further information, please refer to the official documentation below.