@@ -83,6 +83,8 @@ class PassiveWebViewWidget extends StatefulWidget {
8383class _PassiveWebViewWidgetState extends State <PassiveWebViewWidget > {
8484 late WebViewController _controller;
8585
86+ bool _isDataLoaded = false ;
87+
8688 @override
8789 void initState () {
8890 super .initState ();
@@ -134,26 +136,28 @@ class _PassiveWebViewWidgetState extends State<PassiveWebViewWidget> {
134136 _controller.setBackgroundColor (
135137 props.backgroundColor? .toFlutterColor () ?? Colors .transparent);
136138 }
137-
138- _loadData ();
139139 }
140140
141141 void _loadData () {
142142 final props = widget.node.properties;
143143 switch (props.webviewType) {
144144 case WebViewType .webpage:
145145 final properties = props as WebPageWebViewProperties ;
146+ final String input =
147+ PropertyValueDelegate .getVariableValueFromPath <String >(
148+ context, properties.input) ??
149+ properties.input;
146150 switch (properties.pageSourceType) {
147151 case WebViewWebpageSourceType .url:
148- _controller.loadRequest (Uri .parse (properties. input));
152+ _controller.loadRequest (Uri .parse (input));
149153 break ;
150154 case WebViewWebpageSourceType .html:
151- final content = _buildHtmlContent (properties. input);
155+ final content = _buildHtmlContent (input);
152156 _controller.loadRequest (Uri .parse (content));
153157 break ;
154158 case WebViewWebpageSourceType .asset:
155159 // provided from onWebViewCreated callback.
156- _controller.loadFlutterAsset (properties. input);
160+ _controller.loadFlutterAsset (input);
157161 break ;
158162 }
159163 break ;
@@ -169,6 +173,15 @@ class _PassiveWebViewWidgetState extends State<PassiveWebViewWidget> {
169173 }
170174 }
171175
176+ @override
177+ void didChangeDependencies () {
178+ super .didChangeDependencies ();
179+ if (! _isDataLoaded) {
180+ _isDataLoaded = true ;
181+ _loadData ();
182+ }
183+ }
184+
172185 @override
173186 Widget build (BuildContext context) {
174187 final props = widget.node.properties;
@@ -201,8 +214,15 @@ class _PassiveWebViewWidgetState extends State<PassiveWebViewWidget> {
201214 return buildWebView (properties);
202215 }
203216
204- String buildGoogleMapsURL (GoogleMapsWebViewProperties properties) =>
205- _buildHtmlContent (properties.src);
217+ String buildGoogleMapsURL (GoogleMapsWebViewProperties properties) {
218+ final String ? originalSrc = properties.src;
219+ final String ? updatedSrc = originalSrc != null
220+ ? PropertyValueDelegate .getVariableValueFromPath <String >(
221+ context, originalSrc) ??
222+ originalSrc
223+ : null ;
224+ return _buildHtmlContent (updatedSrc);
225+ }
206226
207227 String _buildHtmlContent (String ? src) {
208228 final String html = src? .replaceAll ('\n ' , '' ) ?? 'about:blank' ;
@@ -225,8 +245,15 @@ class _PassiveWebViewWidgetState extends State<PassiveWebViewWidget> {
225245 return buildWebView (properties);
226246 }
227247
228- String buildTwitterURL (TwitterWebViewProperties properties) =>
229- _buildHtmlContent (properties.src);
248+ String buildTwitterURL (TwitterWebViewProperties properties) {
249+ final String ? originalSrc = properties.src;
250+ final String ? updatedSrc = originalSrc != null
251+ ? PropertyValueDelegate .getVariableValueFromPath <String >(
252+ context, originalSrc) ??
253+ originalSrc
254+ : null ;
255+ return _buildHtmlContent (updatedSrc);
256+ }
230257
231258 Widget buildTwitterWebView (
232259 BuildContext context, TwitterWebViewProperties properties) {
0 commit comments