Skip to content

Commit

Permalink
Fix weather radar map not appearing (#63))
Browse files Browse the repository at this point in the history
  • Loading branch information
SpicyChair committed Aug 19, 2023
1 parent 1b00f82 commit 2453ca2
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions lib/screens/radar_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,22 @@ import 'package:webview_flutter/webview_flutter.dart';
class RadarScreen extends StatelessWidget {
double latitude;
double longitude;
var controller;

RadarScreen(latitude, longitude) {
this.latitude = latitude;
this.longitude = longitude;
this.controller = WebViewController()
..setJavaScriptMode(JavaScriptMode.unrestricted)
..setBackgroundColor(const Color(0x00000000))
..setNavigationDelegate(
NavigationDelegate(
onPageStarted: (String url) {},
onPageFinished: (String url) {},
onWebResourceError: (WebResourceError error) {},
),
)
..loadRequest(Uri.parse('https://openweathermap.org/weathermap?basemap=map&cities=false&layer=radar&lat=$latitude&lon=$longitude&zoom=6'));
}
//'https://openweathermap.org/weathermap?basemap=map&cities=false&layer=radar&lat=$latitude&lon=$longitude&zoom=6',
@override
Expand All @@ -34,9 +46,7 @@ class RadarScreen extends StatelessWidget {
},
),
),
body: WebView(
initialUrl:
'https://openweathermap.org/weathermap?basemap=map&cities=false&layer=radar&lat=$latitude&lon=$longitude&zoom=5'),
body: WebViewWidget(controller: this.controller,)
);
}
}

0 comments on commit 2453ca2

Please sign in to comment.