message: ‘This is a tooltip’,
child: OutlinedButton(onPressed: () {}, child: const Text(‘A Button’)),
)
常用选项:
-
height : 指定工具提示的高度
-
padding : 工具提示的填充
-
margin : 工具提示的边距
-
装饰:控制工具提示的形状和背景颜色
-
preferBelow:工具提示是否会显示在孩子的下方
-
showDuration : 工具提示将显示多长时间
-
textStyle : 工具提示消息的样式
-
waitDuration:在消息出现之前指针必须在工具提示上的时间量
-
verticalOffset : 小部件和显示的工具提示之间的垂直间隙
-
enableFeedback:工具提示是否提供声音和/或触觉反馈
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text(‘KindaCode.com’),
),
body: Center(
child: Tooltip(
message: ‘Thi