以编程方式显示工具提示

时间:2018-03-02 11:41:53

标签: dart flutter

enter image description here

如果按下浮动动作按钮,我想制作工具提示。但我不知道如何以编程方式显示它。

有没有办法展示它?

3 个答案:

答案 0 :(得分:2)

目前还没有正式的方法来做到这一点。

但是,有一种解决方法:使用ensureTooltipVisible _TooltipState使用GlobalKey来获取它。

通常,您在实例化Tooltip的窗口小部件中有以下字段: final key = new GlobalKey();

然后,在您的工具提示中,您将分配此密钥:

new Tooltip(
  key: key,
  ...
),

最后在onPressed的{​​{1}}内,您可以这样做:

FloatingButton

答案 1 :(得分:0)

FloatingActionButton已有tooltip属性。

floatingActionButton: new FloatingActionButton(
          tooltip: "ADDED",
          onPressed: (){},
        child: new Icon(Icons.add),),

你要求的不同于此吗?

答案 2 :(得分:0)

/////// 从您的页面调用

app.get('*', (req, res) => {
  res.sendFile(path.join(__dirname, '../client/build/index.html'));
});

相关问题