In this article, I'm going to share the example code of how to show Tooltip in Flutter. In Flutter, a tooltip appears when the related widget is long pressed, as shown in the below image.
Here is the example code of how to show tooltip in flutter. All you need to do is, copy this code into main.dart file to try this example.
import 'package:flutter/material.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return
MaterialApp(
title: 'ToolTip App',
home: Scaffold(
appBar: AppBar(title: Text('Tooltip',)),
body: Center(
child: Container(
child: Tooltip(
message: 'FlutterLogo',
child: FlutterLogo(size: 100,)),
),
),
),
);
}
}
Hope this example is useful to you.
Thanks,
Srikanth