Files
FlutterUnit/lib/views/widgets/ProxyWidget/TooltipTheme/node1_base.dart

52 lines
1.7 KiB
Dart
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
/// create by 张风捷特烈 on 2020/7/22
/// contact me by email 1981462002@qq.com
/// 说明: 333 TooltipTheme 5 主要用于为后代的Tooltip组件统一设置默认属性,也可以通过该组件获取默认TooltipTheme的属性。
// {
// "widgetId": 333,
// "name": "TooltipTheme基本使用",
// "priority": 1,
// "subtitle": "可指定TooltipThemeData数据属性为【后代】的Tooltip组件设置默认样式如装饰、文字样式、显示时长、边距等。也可以用TooltipTheme.of获取Tooltip的主题属性。",
// }
class TooltipThemeDemo extends StatelessWidget {
@override
Widget build(BuildContext context) {
return TooltipTheme(
child: TempTooltip(),
data: TooltipTheme.of(context).copyWith(
preferBelow: false,
padding: EdgeInsets.all(5),
verticalOffset: 20,
margin: EdgeInsets.all(2),
textStyle: TextStyle(
color: Colors.red,
shadows: [Shadow(color: Colors.white, offset: Offset(1, 1))]),
decoration: BoxDecoration(boxShadow: [
BoxShadow(
color: Colors.orangeAccent,
offset: Offset(1, 1),
blurRadius: 8)
])));
}
}
class TempTooltip extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
Tooltip(
message: "天王盖地虎",
child: Icon(Icons.info_outline)),
Tooltip(
message: "宝塔镇河妖",
child: Icon(Icons.info_outline)),
],
);
}
}