Reputation: 2165
I have faced the flutter tooltip
problem
Here is my code:
import 'package:flutter/material.dart';
import 'dart:async';
void main() {
runApp(MaterialApp(
home: MyApp(),
));
}
class MyApp extends StatefulWidget {
@override
_State createState() => _State();
}
class _State extends State<MyApp> {
String _value = 'Hello again';
void _onClicked() => setState(() => _value = new DateTime.now().toString());
@override
Widget build(BuildContext context) {
return Scaffold(
// key: _scaffoldstate,
appBar: AppBar(
title: Text('Name here'),
),
body: Container(
padding: EdgeInsets.all(32.0),
child: Center(
child: Column(
children: <Widget>[
Text(_value),
IconButton(
icon: Icon(Icons.timer),
onPressed: _onClicked,
tooltip: "Hi I'm tooltip", // way one
),
Tooltip(
// way two
message: 'I am a Tooltip',
child: Text('Hover over the text to show a tooltip.'),
)
],
),
),
),
);
}
}
I have tried two way but doesn't work in any way, I don't know where is a problem.
Is it a problem with my column widget?
flutter version: 2.0.3
any suggestion, please.
Upvotes: 0
Views: 1692
Reputation: 5736
ToolTips gets visible when you hover on those Widgets. In a mobile phone, it's not possible to hover on widgets without a mouse so try long pressing on those widgets to view tooltips.
ToolTips are visible when hovering on those widgets on the web. Check this DartPad
Upvotes: 2