Skip to content

Commit

Permalink
Allow package web: ^1.0.0 (#135)
Browse files Browse the repository at this point in the history
* Allow web: 0.X and 1.X

* Update examples to latest web changes.

* Update CHANGELOG to reflect the package:web bracket.

* Tighten lower web version to 0.5.1
  • Loading branch information
ditman authored Jul 24, 2024
1 parent 1047f6a commit cd576db
Show file tree
Hide file tree
Showing 9 changed files with 20 additions and 16 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# 8.0.0-dev.3

- allow package:web ^1.0.0

# 8.0.0-dev.2

- some minor changes
Expand Down
2 changes: 1 addition & 1 deletion README-dev.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ There are 2 steps:
2. Generate real code with [js_wrapping_generator](https://pub.dev/packages/js_wrapping_generator)

```
dart --no-sound-null-safety tool/generate_lib.dart
dart tool/generate_lib.dart
dart run build_runner build --delete-conflicting-outputs -v lib
```
2 changes: 1 addition & 1 deletion example/directions-complex/page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ void calcRoute() async {
// function to create markers for each step.
final response = await directionsService.route(request);
document.querySelector('#warnings_panel')!.innerHTML =
'<b>${response.routes[0].warnings}</b>';
'<b>${response.routes[0].warnings}</b>'.toJS;
directionsDisplay.directions = response;
showSteps(response);
}
Expand Down
2 changes: 1 addition & 1 deletion example/directions-waypoints/page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -55,5 +55,5 @@ void calcRoute() async {
..write('${leg.endAddress}<br>')
..write('${leg.distance!.text}<br><br>');
}
summaryPanel!.innerHTML = html.toString();
summaryPanel!.innerHTML = html.toString().toJS;
}
2 changes: 1 addition & 1 deletion example/distance-matrix/page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ void calculateDistances() async {
'${origins[i]} to ${destinations[j]}: ${results[j].distance.text} in ${results[j].duration.text}<br>');
}
}
document.getElementById('outputDiv')!.innerHTML = html.toString();
document.getElementById('outputDiv')!.innerHTML = html.toString().toJS;
}

void addMarker(String location, {required bool isDestination}) async {
Expand Down
6 changes: 3 additions & 3 deletions example/places-autocomplete-hotelsearch/page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -193,9 +193,9 @@ void Function(MapMouseEvent) showInfoWindow(
// Load the place information into the HTML elements used by the info window.
void buildIWContent(PlaceResult place) {
document.getElementById('iw-icon')!.innerHTML =
'<img class="hotelIcon" src="${place.icon}"></img>';
'<img class="hotelIcon" src="${place.icon}"></img>'.toJS;
document.getElementById('iw-url')!.innerHTML =
'<b><a href="${place.url}">${place.name}</a></b>';
'<b><a href="${place.url}">${place.name}</a></b>'.toJS;
document.getElementById('iw-address')!.textContent = place.vicinity;

if (place.formattedPhoneNumber != null) {
Expand All @@ -221,7 +221,7 @@ void buildIWContent(PlaceResult place) {
}
(document.getElementById('iw-rating-row')! as HTMLElement).style.display =
'';
document.getElementById('iw-rating')!.innerHTML = ratingHtml;
document.getElementById('iw-rating')!.innerHTML = ratingHtml.toJS;
}
} else {
(document.getElementById('iw-rating-row')! as HTMLElement).style.display =
Expand Down
2 changes: 1 addition & 1 deletion example/places-queryprediction/page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@ void callback(

for (final prediction in predictions!.toDart) {
results.innerHTML =
'${results.innerHTML}<li>${prediction!.description}</li>';
'${results.innerHTML}<li>${prediction!.description}</li>'.toJS;
}
}
8 changes: 4 additions & 4 deletions example/streetview-event/page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ void main() {
);

panorama.onPanoChanged.listen((_) {
document.getElementById('pano_cell')!.innerHTML = panorama.pano;
document.getElementById('pano_cell')!.innerHTML = panorama.pano.toJS;
});

panorama.addListener(
Expand All @@ -30,15 +30,15 @@ void main() {
final links = panorama.links;
for (var i = 0; i < links.toDart.length; i++) {
linksTable.insertRow()
..insertCell().innerHTML = '<b>Link: $i</b>'
..insertCell().innerHTML = links.toDart[i].description ?? '';
..insertCell().innerHTML = '<b>Link: $i</b>'.toJS
..insertCell().innerHTML = (links.toDart[i].description ?? '').toJS;
}
}.toJS,
);

panorama.onPositionChanged.listen((_) {
document.getElementById('position_cell')!.innerHTML =
'${panorama.position}';
'${panorama.position}'.toJS;
});

panorama.onPovChanged.listen((_) {
Expand Down
8 changes: 4 additions & 4 deletions pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
name: google_maps
version: 8.0.0-dev.2
version: 8.0.0-dev.3
description: >
With that package you will be able to use Google Maps JavaScript API from Dart
scripts.
homepage: https://github.com/a14n/dart-google-maps
environment:
sdk: '>=3.4.0 <4.0.0'
sdk: ^3.4.0
dependencies:
meta: ^1.3.0
web: ^0.5.0
web: ">=0.5.1 <2.0.0"
dev_dependencies:
build_runner: ^2.4.0
build_web_compilers: ^4.0.0
collection:
html: ^0.15.0
http: ^0.13.0
http: ^1.2.2
path: ^1.7.0
petitparser: ^6.0.2

0 comments on commit cd576db

Please sign in to comment.