Skip to content

Commit 2453ca2

Browse files
committed
Fix weather radar map not appearing (#63))
1 parent 1b00f82 commit 2453ca2

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

lib/screens/radar_screen.dart

+13-3
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,22 @@ import 'package:webview_flutter/webview_flutter.dart';
66
class RadarScreen extends StatelessWidget {
77
double latitude;
88
double longitude;
9+
var controller;
910

1011
RadarScreen(latitude, longitude) {
1112
this.latitude = latitude;
1213
this.longitude = longitude;
14+
this.controller = WebViewController()
15+
..setJavaScriptMode(JavaScriptMode.unrestricted)
16+
..setBackgroundColor(const Color(0x00000000))
17+
..setNavigationDelegate(
18+
NavigationDelegate(
19+
onPageStarted: (String url) {},
20+
onPageFinished: (String url) {},
21+
onWebResourceError: (WebResourceError error) {},
22+
),
23+
)
24+
..loadRequest(Uri.parse('https://openweathermap.org/weathermap?basemap=map&cities=false&layer=radar&lat=$latitude&lon=$longitude&zoom=6'));
1325
}
1426
//'https://openweathermap.org/weathermap?basemap=map&cities=false&layer=radar&lat=$latitude&lon=$longitude&zoom=6',
1527
@override
@@ -34,9 +46,7 @@ class RadarScreen extends StatelessWidget {
3446
},
3547
),
3648
),
37-
body: WebView(
38-
initialUrl:
39-
'https://openweathermap.org/weathermap?basemap=map&cities=false&layer=radar&lat=$latitude&lon=$longitude&zoom=5'),
49+
body: WebViewWidget(controller: this.controller,)
4050
);
4151
}
4252
}

0 commit comments

Comments
 (0)