fluttercommunity / fluttercommunity/flutter_webview_plugin
Add a method to get the title of the current page as soon as it's available
- Langage dominant
- Java
- Étoiles
- 1.5k
- Forks
- 936
- Métriques de merge des PR
- Aucune PR mergée en 30 j
Description
## Use case
I'd like to show the title of the current page in the AppBar. The title should be shown as soon as it's available, not only when the page has finished loading.
I know about the usual workaround to use `evalJavascript('document.title')` that is recommended in other issues like #30 and #192. But that isn't enough for two reasons:
1. `evalJavaScript` doesn't work on Android SDK versions below 19.
2. `evalJavaScript` must be run after the page has finished loading.
## Proposal
Add a method that returns the title from the WebView. You can use [WebView.getTitle()](https://developer.android.com/reference/android/webkit/WebView.html#getTitle()) on Android and [WKWebView.title](https://developer.apple.com/documentation/webkit/wkwebview/1415015-title) on iOS to get it.
To know when the title is available, Android offers [WebChromeClient.onReceivedTitle()](https://developer.android.com/reference/android/webkit/WebChromeClient#onReceivedTitle(android.webkit.WebView,%20java.lang.String)). This should be forwarded to a new event on `FlutterWebviewPlugin`. I don't know if there is something similar for iOS.
Guide de contribution
Aucun guide de contribution indexé pour ce dépôt
Piste de recherche
Commencez par lire l’intégration native de WebView et le flux d’événements de FlutterWebviewPlugin. Sur Android, comparez WebView.getTitle() avec WebChromeClient.onReceivedTitle() ; sur iOS, étudiez WKWebView.title et le mécanisme de mise à jour correspondant. Le travail est considéré comme terminé lorsque le titre actuel peut être récupéré et que la disponibilité du titre est exposée via le plugin sur les deux plateformes.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- android, ios, java
- Domaine
- mobile-dev
- Type d'issue
- Fonctionnalité
- Difficulté
- 4/5
- Temps estimé
- 3-5 jours
- Activité
- À l'abandon
- Clarté
- Plutôt claire
- Accessibilité débutants
- 35/100