Skip to content

Commit

Permalink
[geolocator_web]: Bump web from 0.5.1 to 1.0.0 in /geolocator_web (#1547
Browse files Browse the repository at this point in the history
)

* [geolocator_web]: Bump web from 0.5.1 to 1.0.0 in /geolocator_web
chore: Update background color in geolocator examples

'background' is deprecated and shouldn't be used. Use surface instead. This feature was deprecated after v3.18.0-0.1.

* Update to match package `web` change log:
- Require Dart ^3.4.0.
- APIs that return a double value now return double instead of num. This is to avoid users accidentally downcasting num, which has different semantics depending on whether you compile to JS or Wasm. See issue #57[] for more details.
  • Loading branch information
l1qu1d authored Aug 5, 2024
1 parent f32f78c commit c07ac1c
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 19 deletions.
2 changes: 1 addition & 1 deletion geolocator_apple/example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ class _GeolocatorWidgetState extends State<GeolocatorWidget> {
ExamplePage(
Icons.location_on,
(context) => Scaffold(
backgroundColor: Theme.of(context).colorScheme.background,
backgroundColor: Theme.of(context).colorScheme.surface,
body: ListView.builder(
itemCount: _positionItems.length,
itemBuilder: (context, index) {
Expand Down
2 changes: 1 addition & 1 deletion geolocator_linux/example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class _GeolocatorWidgetState extends State<GeolocatorWidget> {
);

return Scaffold(
backgroundColor: Theme.of(context).colorScheme.background,
backgroundColor: Theme.of(context).colorScheme.surface,
body: ListView.builder(
itemCount: _positionItems.length,
itemBuilder: (context, index) {
Expand Down
19 changes: 13 additions & 6 deletions geolocator_web/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,19 @@
## 4.0.1

- Upgrade the package:web dependency to version 1.0.0.
- Upgrade Dart SDK from 3.3.0 to 3.4.0 for geolocator_web

## 4.0.0

**BREAKING CHANGE:**
- Migrates from dart:html to package:web and dart:js_interop
- Migrates to Dart SDK 3.3.0 and Flutter 3.16.0.

- Migrates from dart:html to package:web and dart:js_interop
- Migrates to Dart SDK 3.3.0 and Flutter 3.16.0.

## 3.0.0

**BREAKING CHANGE:**

- `getServiceStatusStream` on web returns a PlatformException i.s.o. UnimplementedError. As the concept of location service doesn't exist on the web platform.

## 2.2.1
Expand All @@ -19,7 +26,7 @@

## 2.1.7

- Mark `geolocator_web` as implementation of `geolocator`
- Mark `geolocator_web` as implementation of `geolocator`

## 2.1.6

Expand All @@ -35,7 +42,7 @@

## 2.1.3

- Updated to the latest version of the `geolocator_platform_interface': `4.0.0`.
- Updated to the latest version of the `geolocator_platform_interface':`4.0.0`.

## 2.1.2

Expand All @@ -47,7 +54,7 @@

## 2.1.0

- Made changes to the implementation of the `getCurrentPosition` and `getPositionStream` method to match new platform interface.
- Made changes to the implementation of the `getCurrentPosition` and `getPositionStream` method to match new platform interface.
- Fixes issues where geolocator doesn't work on Safari due to missing implementation of `query` method in the browser.

## 2.0.6
Expand All @@ -72,7 +79,7 @@

## 2.0.1

- Solve bug causing error when requesting permissions (see issue [#673](https://github.com/Baseflow/flutter-geolocator/issues/673)).
- Solve bug causing error when requesting permissions (see issue [#673](https://github.com/Baseflow/flutter-geolocator/issues/673)).

## 2.0.0

Expand Down
15 changes: 8 additions & 7 deletions geolocator_web/lib/src/utils.dart
Original file line number Diff line number Diff line change
@@ -1,23 +1,24 @@
import 'dart:async';
import 'package:web/web.dart' as web;

import 'package:flutter/services.dart';
import 'package:geolocator_platform_interface/geolocator_platform_interface.dart';
import 'package:web/web.dart' as web;

/// Converts the Geoposition object into a [Position] object.
Position toPosition(web.GeolocationPosition webPosition) {
final coords = webPosition.coords;

return Position(
latitude: coords.latitude as double,
longitude: coords.longitude as double,
latitude: coords.latitude,
longitude: coords.longitude,
timestamp: DateTime.fromMillisecondsSinceEpoch(webPosition.timestamp),
altitude: coords.altitude as double? ?? 0.0,
altitudeAccuracy: coords.altitudeAccuracy as double? ?? 0.0,
altitude: coords.altitude ?? 0.0,
altitudeAccuracy: coords.altitudeAccuracy ?? 0.0,
accuracy: coords.accuracy as double? ?? 0.0,
heading: coords.heading as double? ?? 0.0,
heading: coords.heading ?? 0.0,
headingAccuracy: 0.0,
floor: null,
speed: coords.speed as double? ?? 0.0,
speed: coords.speed ?? 0.0,
speedAccuracy: 0.0,
isMocked: false,
);
Expand Down
5 changes: 2 additions & 3 deletions geolocator_web/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ dependencies:
flutter_web_plugins:
sdk: flutter
geolocator_platform_interface: ^4.2.2
web: ^0.5.1
web: ^1.0.0

dev_dependencies:
build_runner: ^2.4.8
Expand All @@ -27,7 +27,6 @@ dev_dependencies:
flutter_lints: ">=3.0.1 <5.0.0"
mockito: ^5.4.0


environment:
sdk: '>=3.3.0 <4.0.0'
sdk: ">=3.4.0 <4.0.0"
flutter: ">=3.16.0"
2 changes: 1 addition & 1 deletion geolocator_windows/example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ class _GeolocatorWidgetState extends State<GeolocatorWidget> {
ExamplePage(
Icons.location_on,
(context) => Scaffold(
backgroundColor: Theme.of(context).colorScheme.background,
backgroundColor: Theme.of(context).colorScheme.surface,
body: ListView.builder(
itemCount: _positionItems.length,
itemBuilder: (context, index) {
Expand Down

0 comments on commit c07ac1c

Please sign in to comment.