Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scaffold onUrlChanged & onStateChanged #743

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions lib/src/webview_scaffold.dart
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ class WebviewScaffold extends StatefulWidget {
this.geolocationEnabled,
this.debuggingEnabled = false,
this.ignoreSSLErrors = false,
this.onUrlChanged,
this.onStateChanged,
}) : super(key: key);

final PreferredSizeWidget appBar;
Expand Down Expand Up @@ -74,7 +76,9 @@ class WebviewScaffold extends StatefulWidget {
final bool useWideViewPort;
final bool debuggingEnabled;
final bool ignoreSSLErrors;

final void Function(String url) onUrlChanged;
final void Function(WebViewStateChanged state) onStateChanged;

@override
_WebviewScaffoldState createState() => _WebviewScaffoldState();
}
Expand All @@ -91,7 +95,10 @@ class _WebviewScaffoldState extends State<WebviewScaffold> {
void initState() {
super.initState();
webviewReference.close();


webviewReference.onUrlChanged.listen(widget.onUrlChanged);
webviewReference.onStateChanged.listen(widget.onStateChanged);

_onBack = webviewReference.onBack.listen((_) async {
if (!mounted) {
return;
Expand Down