fluttercommunity / fluttercommunity/flutter_webview_plugin

onStateChanged listener listening only once

未关闭
#609 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
Java
星标
1.5k
派生
936
PR 合并指标
30 天内没有已合并 PR

描述

flutter_webview_plugin: ^0.3.8

I open the webview when clicking on a button using:
```
Navigator.push(
context,
MaterialPageRoute(
builder: (BuildContext context) => WebviewScaffold(
url: 'https://google.com',
appBar: AppBar(
title: Text('WebView'),
),
),))
```
In my build method I have
```
flutterWebviewPlugin.onStateChanged.listen(
(WebViewStateChanged viewState) async {
if (viewState.type == WebViewState.finishLoad) {
print('abc');
}
});
```

The onStateChanged works perfectly if I just go from one page to the next but If I hit the back Arrow in the AppBar and again click on the button to open webview, the breakpoint hits 'flutterWebviewPlugin.onStateChanged.listen' line in the build method but it doesn't go inside the onStateChanged.listen function and doesn't print abc.

贡献指南

这个仓库没有索引到贡献指南

调研方向

未指定文件或测试。首先通过 WebviewScaffold 和 flutterWebviewPlugin.onStateChanged 订阅复现该流程:打开 webview,返回,然后重新打开。完成的标准是第二次打开时同样能收到 finishLoad 事件并打印 abc。

由索引模型根据 Issue 内容生成。

评估

技术栈
dart, flutter
领域
mobile-dev
Issue 类型
缺陷
难度
3/5
预计耗时
1-2 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
35/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。