【问题标题】:How to show AlertDialog over WebviewScaffold in Flutter?如何在 Flutter 中的 WebviewScaffold 上显示 AlertDialog?
【发布时间】:2019-09-16 13:00:42
【问题描述】:

我将在WebviewScaffold 上打开AlertDialog,但它没有显示。当我打开AlertDialog时,它出现在WebviewScaffold下。

下面是我的代码,

child: Container(
  child: WebviewScaffold(
    url: agreementURL,
    withZoom: false,
    withLocalStorage: false,
    hidden: true,
    withJavascript: true,
  ),
),

当互联网不可用时,我会显示AlertDialog,但对话框会出现在WebviewScaffold 下方。

谢谢。

【问题讨论】:

  • webview 没有集成在widget树中,它是flutter view之上的原生view。您将无法使用小吃店、对话框。
  • 好的,感谢您的评论。

标签: dart flutter android-alertdialog webviewscaffold


【解决方案1】:

你可以使用 hide 方法来隐藏 webview,只要你想显示对话框。

代码:

final FlutterWebviewPlugin webviewPlugin = new FlutterWebviewPlugin() ;

//显示对话框时

webviewPlugin. hide() ;

【讨论】:

    猜你喜欢
    • 2019-06-25
    • 2020-07-25
    • 2018-08-28
    • 2022-01-09
    • 2018-09-06
    • 2020-03-11
    • 1970-01-01
    • 1970-01-01
    • 2017-03-02
    相关资源
    最近更新 更多