【问题标题】:Long hold on back arrow of action bar in flutter shows a "Back" toast, how to remove that?长按动作栏的后退箭头在颤动中显示“返回”吐司,如何删除?
【发布时间】:2020-03-17 11:31:05
【问题描述】:

如何删除操作栏上显示的吐司长按后退箭头。

【问题讨论】:

    标签: flutter flutter-layout scaffold


    【解决方案1】:

    使用IconButton 作为AppBar 之类的前导小部件,

    Scaffold(
      appBar: AppBar(
        leading: IconButton(
          onPressed: () {
            Navigator.of(context).pop();
          },
          icon: Icon(Icons.arrow_back),
          // tooltip: 'Back',  // this cause the overlay 
        ),
      ),
    );
    

    【讨论】:

      【解决方案2】:

      在您的appBar 中,您可以将leading 参数替换为您想要的。

      尝试将其替换为:

      AppBar(
         leading: IconButton(
            icon: Icon(Icons.arrow_back),
            onPressed: () {
               Navigator.of(context).pop();
            },
         ),
      ),
      

      它应该删除tooltip。如果要自定义,见IconButtontooltip参数

      【讨论】:

        猜你喜欢
        • 2019-07-15
        • 1970-01-01
        • 2022-06-21
        • 2017-12-12
        • 1970-01-01
        • 2019-09-06
        • 2018-11-30
        • 2020-10-09
        • 1970-01-01
        相关资源
        最近更新 更多