fluttercommunity / fluttercommunity/flutter_webview_plugin
Back button functionality stops working after using stopLoading()
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 1.5k
- Forks
- 936
- PR merge metrics
- No merged PRs in 30d
Description
## System info
Issue occurs on: Android
Plugin version: ^0.3.7
Flutter doctor output:
```
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, v1.7.8+hotfix.4, on Microsoft Windows [Version 10.0.17134.885], locale lt-LT)
[√] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
[√] Android Studio (version 3.4)
[!] VS Code, 64-bit edition (version 1.24.1)
X Flutter extension not installed; install from
https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter
[√] Connected device (1 available)
! Doctor found issues in 1 category.
```
## Steps to Reproduce
I have simple webview app, that listens onStateChanged and tries to prevent url from loading:
```
void initOnStateChangedListener() {
flutterWebviewPlugin.onStateChanged.listen((onData) {
if (shouldStopThisUrlFromLoading(onData.url)) {
flutterWebviewPlugin.stopLoading();
}
});
}
```
After I stop url from loading back button functionality stops working and everytime I press it I get same logout output:
onUrlChanged: RealCaseWebsiteUrl!!
onStateChanged: RealCaseWebsiteUrl!! (WebViewState.finishLoad)
onUrlChanged:RealCaseWebsiteUrl!
onStateChanged: RealCaseWebsiteUrl! (WebViewState.finishLoad)
## Logs
[√] Flutter (Channel stable, v1.7.8+hotfix.4, on Microsoft Windows [Version 10.0.17134.885], locale lt-LT)
• Flutter version 1.7.8+hotfix.4 at C:\flutter
• Framework revision 20e59316b8 (4 weeks ago), 2019-07-18 20:04:33 -0700
• Engine revision fee001c93f
• Dart version 2.4.0
[√] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
• Android SDK at C:\Users\saulius.nevys\AppData\Local\Android\sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-28, build-tools 28.0.3
• Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1343-b01)
• All Android licenses accepted.
[√] Android Studio (version 3.4)
• Android Studio at C:\Program Files\Android\Android Studio
• Flutter plugin version 38.2.1
• Dart plugin version 183.6270
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1343-b01)
[!] VS Code, 64-bit edition (version 1.24.1)
• VS Code at C:\Program Files\Microsoft VS Code
X Flutter extension not installed; install from
https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter
[√] Connected device (1 available)
• EVA L19 • XVV7N16607006554 • android-arm64 • Android 7.0 (API 24)
! Doctor found issues in 1 category.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the Android behavior using the issue's onStateChanged listener and stopLoading() call, then trace the Android implementation of stopLoading and the WebView state callbacks. Verify how navigation history and back-button handling behave after a load is stopped. Done means stopping the selected URL no longer leaves the back button repeatedly reporting the same page.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android, flutter, java
- Domain
- mobile-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 43/100