Flutter 中的定位工具提示

arc*_*rus 4 dart flutter flutter-layout

我使用工具提示小部件,在其中我使用自定义小部件。工具提示出现在小部件下方。如何通过小部件将其放置在右侧?

class MenuItemWithTooltip extends StatelessWidget {
  const MenuItemWithTooltip({
    required this.item,
    required this.title,
    Key? key,
  }) : super(key: key);
  final MenuItem item;
  final String title;

  @override
  Widget build(BuildContext context) {
    return Tooltip(
      decoration: BoxDecoration(
        color: Theme.of(context).backgroundColor,
        borderRadius: const BorderRadius.all(Radius.circular(3)),
      ),
      margin: const EdgeInsets.only(left: 55),
      textStyle: text12W400.copyWith(color: Colors.white),
      child: item,
      message: title,
    );
  }
}
Run Code Online (Sandbox Code Playgroud)

我想看什么

小智 5

修改verticalOffsetmargin值可以做这样的事情。

Tooltip(
      verticalOffset: -13,
      margin:EdgeInsets.only(left: 15),
      message: "xxx",
      child:...)

Run Code Online (Sandbox Code Playgroud)

测试