File tree Expand file tree Collapse file tree 1 file changed +9
-4
lines changed
lib/src/transformers/node_transformers Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -137,12 +137,14 @@ class WebViewPreviewWidget extends StatelessWidget {
137137class RawWebViewWidget extends StatefulWidget {
138138 final WebViewProperties properties;
139139 final WidgetBuildSettings settings;
140- final ValueChanged <WebViewController >? onPageLoaded;
140+ final void Function (WebViewController controller, String url)? onPageStarted;
141+ final void Function (WebViewController controller, String url)? onPageLoaded;
141142
142143 const RawWebViewWidget ({
143144 super .key,
144145 required this .properties,
145146 required this .settings,
147+ this .onPageStarted,
146148 this .onPageLoaded,
147149 });
148150
@@ -205,6 +207,11 @@ class _RawWebViewWidgetState extends State<RawWebViewWidget> {
205207
206208 _controller.setBackgroundColor (
207209 props.backgroundColor? .toFlutterColor () ?? Colors .transparent);
210+
211+ _controller.setNavigationDelegate (NavigationDelegate (
212+ onPageFinished: (url) => widget.onPageLoaded? .call (_controller, url),
213+ onPageStarted: (url) => widget.onPageStarted? .call (_controller, url),
214+ ));
208215 }
209216 }
210217
@@ -250,9 +257,7 @@ class _RawWebViewWidgetState extends State<RawWebViewWidget> {
250257 }
251258 if (! _isDataLoaded) {
252259 _isDataLoaded = true ;
253- _loadData ().then ((value) {
254- widget.onPageLoaded? .call (_controller);
255- });
260+ _loadData ();
256261 }
257262 }
258263
You can’t perform that action at this time.
0 commit comments