flet-geolocator 0.1.0.dev1__py3-none-any.whl → 0.2.0.dev35__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of flet-geolocator might be problematic. Click here for more details.

@@ -0,0 +1,412 @@
1
+ import datetime
2
+ from dataclasses import dataclass, field
3
+ from enum import Enum
4
+ from typing import Optional
5
+
6
+ import flet as ft
7
+
8
+ __all__ = [
9
+ "GeolocatorPositionAccuracy",
10
+ "GeolocatorPermissionStatus",
11
+ "GeolocatorIosActivityType",
12
+ "GeolocatorPosition",
13
+ "GeolocatorConfiguration",
14
+ "GeolocatorWebConfiguration",
15
+ "GeolocatorIosConfiguration",
16
+ "GeolocatorAndroidConfiguration",
17
+ "GeolocatorPositionChangeEvent",
18
+ "ForegroundNotificationConfiguration",
19
+ ]
20
+
21
+
22
+ class GeolocatorPositionAccuracy(Enum):
23
+ """Represent the possible location accuracy values."""
24
+
25
+ LOWEST = "lowest"
26
+ """
27
+ Location is accurate within a distance of 3000m on iOS and 500m on Android.
28
+
29
+ On Android, corresponds to
30
+ [PRIORITY_PASSIVE](https://developers.google.com/android/reference/com/google/android/gms/location/Priority#public-static-final-int-priority_passive).
31
+ """
32
+
33
+ LOW = "low"
34
+ """
35
+ Location is accurate within a distance of 1000m on iOS and 500m on Android.
36
+
37
+ On Android, corresponds to
38
+ [PRIORITY_LOW_POWER](https://developers.google.com/android/reference/com/google/android/gms/location/Priority#public-static-final-int-priority_low_power).
39
+ """
40
+
41
+ MEDIUM = "medium"
42
+ """
43
+ Location is accurate within a distance of 100m on iOS and between 100m and
44
+ 500m on Android.
45
+
46
+ On Android, corresponds to
47
+ [PRIORITY_BALANCED_POWER_ACCURACY](https://developers.google.com/android/reference/com/google/android/gms/location/Priority#public-static-final-int-priority_balanced_power_accuracy).
48
+ """
49
+
50
+ HIGH = "high"
51
+ """
52
+ Location is accurate within a distance of 10m on iOS and between 0m and
53
+ 100m on Android.
54
+
55
+ On Android, corresponds to
56
+ [PRIORITY_HIGH_ACCURACY](https://developers.google.com/android/reference/com/google/android/gms/location/Priority#public-static-final-int-priority_high_accuracy).
57
+ """
58
+
59
+ BEST = "best"
60
+ """
61
+ Location is accurate within a distance of ~0m on iOS and between 0m and
62
+ 100m on Android.
63
+
64
+ On Android, corresponds to
65
+ [PRIORITY_HIGH_ACCURACY](https://developers.google.com/android/reference/com/google/android/gms/location/Priority#public-static-final-int-priority_high_accuracy).
66
+ """
67
+
68
+ BEST_FOR_NAVIGATION = "bestForNavigation"
69
+ """
70
+ Location accuracy is optimized for navigation on iOS and matches the
71
+ `GeolocatorPositionAccuracy.BEST` on Android.
72
+
73
+ On Android, corresponds to
74
+ [PRIORITY_HIGH_ACCURACY](https://developers.google.com/android/reference/com/google/android/gms/location/Priority#public-static-final-int-priority_high_accuracy).
75
+ """
76
+
77
+ REDUCED = "reduced"
78
+ """
79
+ Location accuracy is reduced for iOS 14+ devices. Matches
80
+ `GeolocatorPositionAccuracy.LOWEST` on iOS 13 and below and all other platforms.
81
+
82
+ On Android, corresponds to
83
+ [PRIORITY_PASSIVE](https://developers.google.com/android/reference/com/google/android/gms/location/Priority#public-static-final-int-priority_passive).
84
+ """
85
+
86
+
87
+ class GeolocatorPermissionStatus(Enum):
88
+ """Represent the possible location permissions."""
89
+
90
+ DENIED = "denied"
91
+ """
92
+ Permission to access the device's location is denied.
93
+
94
+ The app should try to request permission using the [`Geolocator.request_permission`][(p).] method.
95
+ """
96
+
97
+ DENIED_FOREVER = "deniedForever"
98
+ """
99
+ Permission to access the device's location is permanently denied.
100
+
101
+ When requesting permissions, the permission dialog will not be shown until the user updates
102
+ the permission in the app settings.
103
+ """
104
+
105
+ WHILE_IN_USE = "whileInUse"
106
+ """
107
+ Permission to access the device's location is allowed only while the app is in use.
108
+ """
109
+
110
+ ALWAYS = "always"
111
+ """
112
+ Permission to access the device's location is allowed even when the app is running in the background.
113
+ """
114
+
115
+ UNABLE_TO_DETERMINE = "unableToDetermine"
116
+ """
117
+ Permission status cannot be determined.
118
+
119
+ This status is only returned by the [`Geolocator.request_permission`][(p).] method on the web platform
120
+ for browsers that did not implement the Permissions API.
121
+ See: https://developer.mozilla.org/en-US/docs/Web/API/Permissions_API
122
+ """
123
+
124
+
125
+ class GeolocatorIosActivityType(Enum):
126
+ """Represents the possible iOS activity types."""
127
+
128
+ AUTOMOTIVE_NAVIGATION = "automotiveNavigation"
129
+ """
130
+ The location manager is being used specifically during vehicular
131
+ navigation to track location changes to the automobile.
132
+ """
133
+
134
+ FITNESS = "fitness"
135
+ """
136
+ The location manager is being used to track fitness activities such as
137
+ walking, running, cycling, and so on.
138
+ """
139
+
140
+ OTHER_NAVIGATION = "otherNavigation"
141
+ """
142
+ The location manager is being used to track movements for other types of
143
+ vehicular navigation that are not automobile related.
144
+ """
145
+
146
+ AIRBORNE = "airborne"
147
+ """
148
+ The location manager is being used specifically during
149
+ airborne activities.
150
+ """
151
+
152
+ OTHER = "other"
153
+ """
154
+ The location manager is being used for an unknown activity.
155
+ """
156
+
157
+
158
+ @dataclass
159
+ class GeolocatorPosition:
160
+ """Detailed location information."""
161
+
162
+ latitude: Optional[ft.Number] = None
163
+ """
164
+ The latitude of this position in degrees normalized to the interval -90.0
165
+ to +90.0 (both inclusive).
166
+ """
167
+
168
+ longitude: Optional[ft.Number] = None
169
+ """
170
+ The longitude of the position in degrees normalized to the interval -180
171
+ (exclusive) to +180 (inclusive).
172
+ """
173
+
174
+ speed: Optional[ft.Number] = None
175
+ """
176
+ The speed at which the device is traveling in meters per second over ground.
177
+
178
+ The speed is not available on all devices.
179
+ In these cases the value is `0.0`.
180
+ """
181
+
182
+ altitude: Optional[ft.Number] = None
183
+ """
184
+ The altitude of the device in meters.
185
+
186
+ The altitude is not available on all devices.
187
+ In these cases the returned value is `0.0`.
188
+ """
189
+
190
+ timestamp: datetime.datetime = None
191
+ """
192
+ The time at which this position was determined.
193
+ """
194
+
195
+ accuracy: Optional[ft.Number] = None
196
+ """
197
+ The estimated horizontal accuracy of the position in meters.
198
+
199
+ The accuracy is not available on all devices.
200
+ In these cases the value is `0.0`.
201
+ """
202
+
203
+ altitude_accuracy: Optional[ft.Number] = None
204
+ """
205
+ The estimated vertical accuracy of the position in meters.
206
+
207
+ The accuracy is not available on all devices.
208
+ In these cases the value is `0.0`.
209
+ """
210
+
211
+ heading: Optional[ft.Number] = None
212
+ """
213
+ The heading in which the device is traveling in degrees.
214
+
215
+ The heading is not available on all devices.
216
+ In these cases the value is `0.0`.
217
+ """
218
+
219
+ heading_accuracy: Optional[ft.Number] = None
220
+ """
221
+ The estimated heading accuracy of the position in degrees.
222
+
223
+ The heading accuracy is not available on all devices.
224
+ In these cases the value is `0.0`.
225
+ """
226
+
227
+ speed_accuracy: Optional[ft.Number] = None
228
+ """
229
+ The estimated speed accuracy of this position, in meters per second.
230
+
231
+ The speed accuracy is not available on all devices.
232
+ In these cases the value is `0.0`.
233
+ """
234
+
235
+ floor: Optional[int] = None
236
+ """
237
+ The floor specifies the floor of the building on which the device is
238
+ located.
239
+
240
+ The floor property is only available on iOS and only when the information is available.
241
+ In all other cases this value will be `None`.
242
+ """
243
+
244
+ mocked: Optional[bool] = None
245
+ """
246
+ Will be `True` on Android (starting from API level 18) when the location came
247
+ from the mocked provider.
248
+
249
+ On iOS this value will always be `False`.
250
+ """
251
+
252
+
253
+ @dataclass
254
+ class GeolocatorConfiguration:
255
+ accuracy: GeolocatorPositionAccuracy = GeolocatorPositionAccuracy.BEST
256
+ """
257
+ Defines the desired accuracy that should be used to determine the location data.
258
+ """
259
+
260
+ distance_filter: int = 0
261
+ """
262
+ The minimum distance (measured in meters) a device must move
263
+ horizontally before an update event is generated.
264
+
265
+ Set to `0` when you want to be notified of all movements.
266
+ """
267
+
268
+ time_limit: ft.DurationValue = None
269
+ """
270
+ Specifies a timeout interval.
271
+
272
+ For no time limit, set to `None`.
273
+ """
274
+
275
+
276
+ @dataclass
277
+ class GeolocatorWebConfiguration(GeolocatorConfiguration):
278
+ """Web specific settings."""
279
+
280
+ maximum_age: ft.DurationValue = field(default_factory=lambda: ft.Duration())
281
+ """
282
+ A value indicating the maximum age of a possible cached
283
+ position that is acceptable to return. If set to 0, it means
284
+ that the device cannot use a cached position and must
285
+ attempt to retrieve the real current position.
286
+ """
287
+
288
+
289
+ @dataclass
290
+ class GeolocatorIosConfiguration(GeolocatorConfiguration):
291
+ """iOS specific settings."""
292
+
293
+ activity_type: GeolocatorIosActivityType = GeolocatorIosActivityType.OTHER
294
+ """
295
+ The location manager uses the information in this property as a cue
296
+ to determine when location updates may be automatically paused.
297
+ """
298
+
299
+ pause_location_updates_automatically: bool = False
300
+ """
301
+ Allows the location manager to pause updates to improve battery life
302
+ on the target device without sacrificing location data.
303
+ When this property is set to `true`, the location manager pauses updates
304
+ (and powers down the appropriate hardware) at times when the
305
+ location data is unlikely to change.
306
+ """
307
+
308
+ show_background_location_indicator: bool = False
309
+ """
310
+ Flag to ask the Apple OS to show the background location indicator (iOS only)
311
+ if app starts up and background and requests the users location.
312
+
313
+ For this setting to work and for the location to be retrieved the user must
314
+ have granted "always" permissions for location retrieval.
315
+ """
316
+
317
+ allow_background_location_updates: bool = True
318
+ """
319
+ Flag to allow the app to receive location updates in the background (iOS only)
320
+
321
+ Note:
322
+ For this setting to work `Info.plist` should contain the following keys:
323
+ - UIBackgroundModes and the value should contain "location"
324
+ - NSLocationAlwaysUsageDescription
325
+ """
326
+
327
+
328
+ @dataclass
329
+ class ForegroundNotificationConfiguration:
330
+ notification_title: str
331
+ """
332
+ The title used for the foreground service notification.
333
+ """
334
+
335
+ notification_text: str
336
+ """
337
+ The body used for the foreground service notification.
338
+ """
339
+
340
+ notification_channel_name: str = "Background Location"
341
+ """
342
+ The user visible name of the notification channel.
343
+
344
+ The notification channel name will be displayed in the system settings.
345
+ The maximum recommended length is 40 characters, the name might be
346
+ truncated if it is to long. Default value: "Background Location".
347
+ """
348
+
349
+ notification_enable_wake_lock: bool = False
350
+ """
351
+ When enabled, a Wakelock is acquired when background execution is started.
352
+
353
+ If this is false then the system can still sleep and all location
354
+ events will be received at once when the system wakes up again.
355
+
356
+ Wake lock permissions should be obtained first by using a permissions library.
357
+ """
358
+
359
+ notification_enable_wifi_lock: bool = False
360
+ """
361
+ When enabled, a WifiLock is acquired when background execution is started.
362
+ This allows the application to keep the Wi-Fi radio awake, even when the
363
+ user has not used the device in a while (e.g. for background network communications).
364
+
365
+ Wifi lock permissions should be obtained first by using a permissions library.
366
+ """
367
+
368
+ notification_set_ongoing: bool = False
369
+ """
370
+ When enabled, the displayed notification is persistent and
371
+ the user cannot dismiss it.
372
+ """
373
+
374
+ # foreground_notification_color: Optional[ft.ColorValue] = None
375
+
376
+
377
+ @dataclass
378
+ class GeolocatorAndroidConfiguration(GeolocatorConfiguration):
379
+ """Android specific settings."""
380
+
381
+ interval_duration: ft.DurationValue = field(
382
+ default_factory=lambda: ft.Duration(milliseconds=5000)
383
+ )
384
+ """
385
+ The desired interval for active location updates.
386
+ """
387
+
388
+ use_msl_altitude: bool = False
389
+ """
390
+ Whether altitude should be calculated as MSL (EGM2008) from NMEA messages
391
+ and reported as the altitude instead of using the geoidal height (WSG84). Setting
392
+ this property true will help to align Android altitude to that of iOS which uses MSL.
393
+
394
+ If the NMEA message is empty then the altitude reported will still be the standard WSG84
395
+ altitude from the GPS receiver.
396
+
397
+ MSL Altitude is only available starting from Android N and not all devices support
398
+ NMEA message returning $GPGGA sequences.
399
+
400
+ This property only works with position stream updates and has no effect when getting the
401
+ current position or last known position.
402
+ """
403
+
404
+ foreground_notification_config: Optional[ForegroundNotificationConfiguration] = None
405
+
406
+
407
+ @dataclass
408
+ class GeolocatorPositionChangeEvent(ft.Event[ft.EventControlType]):
409
+ position: GeolocatorPosition
410
+ """
411
+ The current/new position of the device.
412
+ """
@@ -0,0 +1,72 @@
1
+ Metadata-Version: 2.4
2
+ Name: flet-geolocator
3
+ Version: 0.2.0.dev35
4
+ Summary: Adds geolocation capabilities to your Flet apps.
5
+ Author-email: Flet contributors <hello@flet.dev>
6
+ License-Expression: Apache-2.0
7
+ Project-URL: Homepage, https://flet.dev
8
+ Project-URL: Documentation, https://flet-dev.github.io/flet-audio
9
+ Project-URL: Repository, https://github.com/flet-dev/flet-geolocator
10
+ Project-URL: Issues, https://github.com/flet-dev/flet-geolocator/issues
11
+ Requires-Python: >=3.10
12
+ Description-Content-Type: text/markdown
13
+ License-File: LICENSE
14
+ Requires-Dist: flet>=0.70.0.dev0
15
+ Dynamic: license-file
16
+
17
+ # flet-geolocator
18
+
19
+ [![pypi](https://img.shields.io/pypi/v/flet-geolocator.svg)](https://pypi.python.org/pypi/flet-geolocator)
20
+ [![downloads](https://static.pepy.tech/badge/flet-geolocator/month)](https://pepy.tech/project/flet-geolocator)
21
+ [![license](https://img.shields.io/github/license/flet-dev/flet-geolocator.svg)](https://github.com/flet-dev/flet-geolocator/blob/main/LICENSE)
22
+
23
+ Adds geolocation capabilities to your [Flet](https://flet.dev) apps.
24
+
25
+ Features include:
26
+ - Get the last known location;
27
+ - Get the current location of the device;
28
+ - Get continuous location updates;
29
+ - Check if location services are enabled on the device.
30
+
31
+ It is based on the [geolocator](https://pub.dev/packages/geolocator) Flutter package.
32
+
33
+ ## Documentation
34
+
35
+ Detailed documentation to this package can be found [here](https://flet-dev.github.io/flet-geolocator/).
36
+
37
+ ## Platform Support
38
+
39
+ This package supports the following platforms:
40
+
41
+ | Platform | Supported |
42
+ |----------|:---------:|
43
+ | Windows | ✅ |
44
+ | macOS | ✅ |
45
+ | Linux | ✅ |
46
+ | iOS | ✅ |
47
+ | Android | ✅ |
48
+ | Web | ✅ |
49
+
50
+ ## Installation
51
+
52
+ To install the `flet-geolocator` package and add it to your project dependencies:
53
+
54
+ - Using `uv`:
55
+ ```bash
56
+ uv add flet-geolocator
57
+ ```
58
+
59
+ - Using `pip`:
60
+ ```bash
61
+ pip install flet-geolocator
62
+ ```
63
+ After this, you will have to manually add this package to your `requirements.txt` or `pyproject.toml`.
64
+
65
+ - Using `poetry`:
66
+ ```bash
67
+ poetry add flet-geolocator
68
+ ```
69
+
70
+ ## Examples
71
+
72
+ For examples, see [this](./examples)
@@ -0,0 +1,18 @@
1
+ flet_geolocator/__init__.py,sha256=BIeg3bpvgkQOZXCqUwlhqUKqKaGU_twfOfo8oDrpwZ8,382
2
+ flet_geolocator/geolocator.py,sha256=KXYlPVx5-fsxq3K3O1MsZ2ubJF-tTI7o36q6lfY2oIc,8639
3
+ flet_geolocator/types.py,sha256=zinwlph0hgeDZmXGzUjsu8UFwDpsHiOYdkIWDJcm-fM,12954
4
+ flet_geolocator-0.2.0.dev35.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
5
+ flutter/flet_geolocator/CHANGELOG.md,sha256=66sWepPaeTc9_lzcYIGU55AlxSU5Z1XVtknXpzd_-p8,40
6
+ flutter/flet_geolocator/LICENSE,sha256=QwcOLU5TJoTeUhuIXzhdCEEDDvorGiC6-3YTOl4TecE,11356
7
+ flutter/flet_geolocator/README.md,sha256=sYHQP6tUk1CzbWAaqucJStoRvAsgp36IqjaIVoXCiF4,70
8
+ flutter/flet_geolocator/analysis_options.yaml,sha256=32kjGAc-zF87inWaH5M46yGZWQDTwrwfvNLHeAocfG4,154
9
+ flutter/flet_geolocator/pubspec.lock,sha256=vBzPpJKn1vDxeG37MNuDUfXynE2NRBv3GdPqyNUNNo8,26406
10
+ flutter/flet_geolocator/pubspec.yaml,sha256=1QSrn8EZVinK8RHXNVZOzMgomcfY6fBkbzSl7EDWc8U,529
11
+ flutter/flet_geolocator/lib/flet_geolocator.dart,sha256=f5rUWcdvXkySvVjv50N-m0neLWB3P2okmEWxGg9r9Vk,70
12
+ flutter/flet_geolocator/lib/src/extension.dart,sha256=x8zm0Pt3ZsyTj7q8MImtLTIK_kCAoaqYaJ41NWPug-8,314
13
+ flutter/flet_geolocator/lib/src/geolocator.dart,sha256=R0DznK7TJVU4S6QpSdR3zbOygnmM7l-IKL_NxTKrRnQ,3268
14
+ flutter/flet_geolocator/lib/src/utils/geolocator.dart,sha256=BZxf9l1CIvuNEnZMVONUxAnGVSXl2XY1zihP1gH6qdo,3999
15
+ flet_geolocator-0.2.0.dev35.dist-info/METADATA,sha256=Scmo1xzcZUJwanOZpl-3KJ7tQ8XLrKaaNArTB2QxwKg,2179
16
+ flet_geolocator-0.2.0.dev35.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
17
+ flet_geolocator-0.2.0.dev35.dist-info/top_level.txt,sha256=MuAs94VDBb5Btg9cvN83W2sHm_YslMQ2JOKZhqm88cs,24
18
+ flet_geolocator-0.2.0.dev35.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (75.8.0)
2
+ Generator: setuptools (80.9.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5