入口文件
import 'package:flutter/material.dart';
import 'tool_tips_demo.dart';
main(){
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
primarySwatch: Colors.blue
),
home: ToolTipDemo()
);
}
}
方法文件
import 'package:flutter/material.dart';
class ToolTipDemo extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: Text('輕量級提示'),),
body: Center(
child: Tooltip(
// 長按顯示的內(nèi)容
message: '點雞',
child: Image.network('https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1557744149&di=f68af941c41b28a7fd7484165f9c77c4&imgtype=jpg&er=1&src=http%3A%2F%2Fb-ssl.duitang.com%2Fuploads%2Fitem%2F201512%2F12%2F20151212193107_ujGZV.jpeg'),
),
),
);
}
}
最后編輯于 :
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者