flet-map 0.2.0.dev45__tar.gz → 0.70.0.dev6551__tar.gz
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-map might be problematic. Click here for more details.
- {flet_map-0.2.0.dev45/src/flet_map.egg-info → flet_map-0.70.0.dev6551}/PKG-INFO +15 -25
- {flet_map-0.2.0.dev45 → flet_map-0.70.0.dev6551}/README.md +9 -19
- flet_map-0.70.0.dev6551/pyproject.toml +24 -0
- flet_map-0.70.0.dev6551/src/flet_map/__init__.py +87 -0
- {flet_map-0.2.0.dev45 → flet_map-0.70.0.dev6551}/src/flet_map/circle_layer.py +21 -20
- flet_map-0.70.0.dev6551/src/flet_map/map.py +366 -0
- flet_map-0.70.0.dev6551/src/flet_map/marker_layer.py +108 -0
- {flet_map-0.2.0.dev45 → flet_map-0.70.0.dev6551}/src/flet_map/polygon_layer.py +29 -21
- {flet_map-0.2.0.dev45 → flet_map-0.70.0.dev6551}/src/flet_map/polyline_layer.py +27 -18
- {flet_map-0.2.0.dev45 → flet_map-0.70.0.dev6551}/src/flet_map/rich_attribution.py +14 -12
- {flet_map-0.2.0.dev45 → flet_map-0.70.0.dev6551}/src/flet_map/simple_attribution.py +5 -8
- {flet_map-0.2.0.dev45 → flet_map-0.70.0.dev6551}/src/flet_map/source_attribution.py +20 -18
- {flet_map-0.2.0.dev45 → flet_map-0.70.0.dev6551}/src/flet_map/tile_layer.py +89 -78
- {flet_map-0.2.0.dev45 → flet_map-0.70.0.dev6551}/src/flet_map/types.py +258 -177
- {flet_map-0.2.0.dev45 → flet_map-0.70.0.dev6551/src/flet_map.egg-info}/PKG-INFO +15 -25
- {flet_map-0.2.0.dev45 → flet_map-0.70.0.dev6551}/src/flet_map.egg-info/SOURCES.txt +0 -3
- flet_map-0.70.0.dev6551/src/flet_map.egg-info/requires.txt +1 -0
- {flet_map-0.2.0.dev45 → flet_map-0.70.0.dev6551}/src/flutter/flet_map/lib/src/tile_layer.dart +1 -2
- {flet_map-0.2.0.dev45 → flet_map-0.70.0.dev6551}/src/flutter/flet_map/lib/src/utils/map.dart +4 -2
- {flet_map-0.2.0.dev45 → flet_map-0.70.0.dev6551}/src/flutter/flet_map/pubspec.lock +115 -109
- flet_map-0.70.0.dev6551/src/flutter/flet_map/pubspec.yaml +25 -0
- flet_map-0.2.0.dev45/pyproject.toml +0 -71
- flet_map-0.2.0.dev45/src/flet_map/__init__.py +0 -41
- flet_map-0.2.0.dev45/src/flet_map/map.py +0 -532
- flet_map-0.2.0.dev45/src/flet_map/marker_layer.py +0 -97
- flet_map-0.2.0.dev45/src/flet_map.egg-info/requires.txt +0 -1
- flet_map-0.2.0.dev45/src/flutter/flet_map/CHANGELOG.md +0 -7
- flet_map-0.2.0.dev45/src/flutter/flet_map/LICENSE +0 -201
- flet_map-0.2.0.dev45/src/flutter/flet_map/README.md +0 -3
- flet_map-0.2.0.dev45/src/flutter/flet_map/pubspec.yaml +0 -26
- {flet_map-0.2.0.dev45 → flet_map-0.70.0.dev6551}/LICENSE +0 -0
- {flet_map-0.2.0.dev45 → flet_map-0.70.0.dev6551}/setup.cfg +0 -0
- {flet_map-0.2.0.dev45 → flet_map-0.70.0.dev6551}/src/flet_map/map_layer.py +0 -0
- {flet_map-0.2.0.dev45 → flet_map-0.70.0.dev6551}/src/flet_map.egg-info/dependency_links.txt +0 -0
- {flet_map-0.2.0.dev45 → flet_map-0.70.0.dev6551}/src/flet_map.egg-info/top_level.txt +0 -0
- {flet_map-0.2.0.dev45 → flet_map-0.70.0.dev6551}/src/flutter/flet_map/analysis_options.yaml +0 -0
- {flet_map-0.2.0.dev45 → flet_map-0.70.0.dev6551}/src/flutter/flet_map/lib/flet_map.dart +0 -0
- {flet_map-0.2.0.dev45 → flet_map-0.70.0.dev6551}/src/flutter/flet_map/lib/src/circle_layer.dart +0 -0
- {flet_map-0.2.0.dev45 → flet_map-0.70.0.dev6551}/src/flutter/flet_map/lib/src/extension.dart +0 -0
- {flet_map-0.2.0.dev45 → flet_map-0.70.0.dev6551}/src/flutter/flet_map/lib/src/map.dart +0 -0
- {flet_map-0.2.0.dev45 → flet_map-0.70.0.dev6551}/src/flutter/flet_map/lib/src/marker_layer.dart +0 -0
- {flet_map-0.2.0.dev45 → flet_map-0.70.0.dev6551}/src/flutter/flet_map/lib/src/polygon_layer.dart +0 -0
- {flet_map-0.2.0.dev45 → flet_map-0.70.0.dev6551}/src/flutter/flet_map/lib/src/polyline_layer.dart +0 -0
- {flet_map-0.2.0.dev45 → flet_map-0.70.0.dev6551}/src/flutter/flet_map/lib/src/rich_attribution.dart +0 -0
- {flet_map-0.2.0.dev45 → flet_map-0.70.0.dev6551}/src/flutter/flet_map/lib/src/simple_attribution.dart +0 -0
- {flet_map-0.2.0.dev45 → flet_map-0.70.0.dev6551}/src/flutter/flet_map/lib/src/utils/attribution_alignment.dart +0 -0
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: flet-map
|
|
3
|
-
Version: 0.
|
|
4
|
-
Summary:
|
|
3
|
+
Version: 0.70.0.dev6551
|
|
4
|
+
Summary: Interactive map controls for Flet apps.
|
|
5
5
|
Author-email: Flet contributors <hello@flet.dev>
|
|
6
6
|
License-Expression: Apache-2.0
|
|
7
7
|
Project-URL: Homepage, https://flet.dev
|
|
8
|
-
Project-URL: Documentation, https://flet
|
|
9
|
-
Project-URL: Repository, https://github.com/flet-dev/flet-map
|
|
10
|
-
Project-URL: Issues, https://github.com/flet-dev/flet
|
|
8
|
+
Project-URL: Documentation, https://docs.flet.dev/map
|
|
9
|
+
Project-URL: Repository, https://github.com/flet-dev/flet/tree/main/sdk/python/packages/flet-map
|
|
10
|
+
Project-URL: Issues, https://github.com/flet-dev/flet/issues
|
|
11
11
|
Requires-Python: >=3.10
|
|
12
12
|
Description-Content-Type: text/markdown
|
|
13
13
|
License-File: LICENSE
|
|
14
|
-
Requires-Dist: flet
|
|
14
|
+
Requires-Dist: flet==0.70.0.dev6551
|
|
15
15
|
Dynamic: license-file
|
|
16
16
|
|
|
17
17
|
# flet-map
|
|
18
18
|
|
|
19
19
|
[](https://pypi.python.org/pypi/flet-map)
|
|
20
20
|
[](https://pepy.tech/project/flet-map)
|
|
21
|
-
[](https://github.com/flet-dev/flet/blob/main/sdk/python/packages/flet-map/LICENSE)
|
|
22
22
|
|
|
23
23
|
A [Flet](https://flet.dev) extension for displaying interactive maps.
|
|
24
24
|
|
|
@@ -26,22 +26,17 @@ It is based on the [flutter_map](https://pub.dev/packages/flutter_map) Flutter p
|
|
|
26
26
|
|
|
27
27
|
## Documentation
|
|
28
28
|
|
|
29
|
-
Detailed documentation to this package can be found [here](https://flet
|
|
29
|
+
Detailed documentation to this package can be found [here](https://docs.flet.dev/map/).
|
|
30
30
|
|
|
31
31
|
## Platform Support
|
|
32
32
|
|
|
33
|
-
|
|
33
|
+
| Platform | Windows | macOS | Linux | iOS | Android | Web |
|
|
34
|
+
|----------|---------|-------|-------|-----|---------|-----|
|
|
35
|
+
| Supported| ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
34
36
|
|
|
35
|
-
|
|
36
|
-
|----------|:---------:|
|
|
37
|
-
| Windows | ✅ |
|
|
38
|
-
| macOS | ✅ |
|
|
39
|
-
| Linux | ✅ |
|
|
40
|
-
| iOS | ✅ |
|
|
41
|
-
| Android | ✅ |
|
|
42
|
-
| Web | ✅ |
|
|
37
|
+
## Usage
|
|
43
38
|
|
|
44
|
-
|
|
39
|
+
### Installation
|
|
45
40
|
|
|
46
41
|
To install the `flet-map` package and add it to your project dependencies:
|
|
47
42
|
|
|
@@ -56,11 +51,6 @@ To install the `flet-map` package and add it to your project dependencies:
|
|
|
56
51
|
```
|
|
57
52
|
After this, you will have to manually add this package to your `requirements.txt` or `pyproject.toml`.
|
|
58
53
|
|
|
59
|
-
|
|
60
|
-
```bash
|
|
61
|
-
poetry add flet-map
|
|
62
|
-
```
|
|
63
|
-
|
|
64
|
-
## Examples
|
|
54
|
+
### Examples
|
|
65
55
|
|
|
66
|
-
For examples, see [
|
|
56
|
+
For examples, see [these](https://github.com/flet-dev/flet/tree/main/sdk/python/examples/controls/map).
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
[](https://pypi.python.org/pypi/flet-map)
|
|
4
4
|
[](https://pepy.tech/project/flet-map)
|
|
5
|
-
[](https://github.com/flet-dev/flet/blob/main/sdk/python/packages/flet-map/LICENSE)
|
|
6
6
|
|
|
7
7
|
A [Flet](https://flet.dev) extension for displaying interactive maps.
|
|
8
8
|
|
|
@@ -10,22 +10,17 @@ It is based on the [flutter_map](https://pub.dev/packages/flutter_map) Flutter p
|
|
|
10
10
|
|
|
11
11
|
## Documentation
|
|
12
12
|
|
|
13
|
-
Detailed documentation to this package can be found [here](https://flet
|
|
13
|
+
Detailed documentation to this package can be found [here](https://docs.flet.dev/map/).
|
|
14
14
|
|
|
15
15
|
## Platform Support
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
| Platform | Windows | macOS | Linux | iOS | Android | Web |
|
|
18
|
+
|----------|---------|-------|-------|-----|---------|-----|
|
|
19
|
+
| Supported| ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
18
20
|
|
|
19
|
-
|
|
20
|
-
|----------|:---------:|
|
|
21
|
-
| Windows | ✅ |
|
|
22
|
-
| macOS | ✅ |
|
|
23
|
-
| Linux | ✅ |
|
|
24
|
-
| iOS | ✅ |
|
|
25
|
-
| Android | ✅ |
|
|
26
|
-
| Web | ✅ |
|
|
21
|
+
## Usage
|
|
27
22
|
|
|
28
|
-
|
|
23
|
+
### Installation
|
|
29
24
|
|
|
30
25
|
To install the `flet-map` package and add it to your project dependencies:
|
|
31
26
|
|
|
@@ -40,11 +35,6 @@ To install the `flet-map` package and add it to your project dependencies:
|
|
|
40
35
|
```
|
|
41
36
|
After this, you will have to manually add this package to your `requirements.txt` or `pyproject.toml`.
|
|
42
37
|
|
|
43
|
-
|
|
44
|
-
```bash
|
|
45
|
-
poetry add flet-map
|
|
46
|
-
```
|
|
47
|
-
|
|
48
|
-
## Examples
|
|
38
|
+
### Examples
|
|
49
39
|
|
|
50
|
-
For examples, see [
|
|
40
|
+
For examples, see [these](https://github.com/flet-dev/flet/tree/main/sdk/python/examples/controls/map).
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "flet-map"
|
|
3
|
+
version = "0.70.0.dev6551"
|
|
4
|
+
description = "Interactive map controls for Flet apps."
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
authors = [{ name = "Flet contributors", email = "hello@flet.dev" }]
|
|
7
|
+
license = "Apache-2.0"
|
|
8
|
+
requires-python = ">=3.10"
|
|
9
|
+
dependencies = [
|
|
10
|
+
"flet==0.70.0.dev6551",
|
|
11
|
+
]
|
|
12
|
+
|
|
13
|
+
[project.urls]
|
|
14
|
+
Homepage = "https://flet.dev"
|
|
15
|
+
Documentation = "https://docs.flet.dev/map"
|
|
16
|
+
Repository = "https://github.com/flet-dev/flet/tree/main/sdk/python/packages/flet-map"
|
|
17
|
+
Issues = "https://github.com/flet-dev/flet/issues"
|
|
18
|
+
|
|
19
|
+
[tool.setuptools.package-data]
|
|
20
|
+
"flutter.flet_map" = ["**/*"]
|
|
21
|
+
|
|
22
|
+
[build-system]
|
|
23
|
+
requires = ["setuptools"]
|
|
24
|
+
build-backend = "setuptools.build_meta"
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
from flet_map.circle_layer import CircleLayer, CircleMarker
|
|
2
|
+
from flet_map.map import Map
|
|
3
|
+
from flet_map.map_layer import MapLayer
|
|
4
|
+
from flet_map.marker_layer import Marker, MarkerLayer
|
|
5
|
+
from flet_map.polygon_layer import PolygonLayer, PolygonMarker
|
|
6
|
+
from flet_map.polyline_layer import PolylineLayer, PolylineMarker
|
|
7
|
+
from flet_map.rich_attribution import RichAttribution
|
|
8
|
+
from flet_map.simple_attribution import SimpleAttribution
|
|
9
|
+
from flet_map.source_attribution import (
|
|
10
|
+
ImageSourceAttribution,
|
|
11
|
+
SourceAttribution,
|
|
12
|
+
TextSourceAttribution,
|
|
13
|
+
)
|
|
14
|
+
from flet_map.tile_layer import TileLayer
|
|
15
|
+
from flet_map.types import (
|
|
16
|
+
AttributionAlignment,
|
|
17
|
+
Camera,
|
|
18
|
+
CameraFit,
|
|
19
|
+
CursorKeyboardRotationConfiguration,
|
|
20
|
+
CursorRotationBehaviour,
|
|
21
|
+
DashedStrokePattern,
|
|
22
|
+
DottedStrokePattern,
|
|
23
|
+
FadeInTileDisplay,
|
|
24
|
+
InstantaneousTileDisplay,
|
|
25
|
+
InteractionConfiguration,
|
|
26
|
+
InteractionFlag,
|
|
27
|
+
KeyboardConfiguration,
|
|
28
|
+
MapEvent,
|
|
29
|
+
MapEventSource,
|
|
30
|
+
MapHoverEvent,
|
|
31
|
+
MapLatitudeLongitude,
|
|
32
|
+
MapLatitudeLongitudeBounds,
|
|
33
|
+
MapPointerEvent,
|
|
34
|
+
MapPositionChangeEvent,
|
|
35
|
+
MapTapEvent,
|
|
36
|
+
MultiFingerGesture,
|
|
37
|
+
PatternFit,
|
|
38
|
+
SolidStrokePattern,
|
|
39
|
+
StrokePattern,
|
|
40
|
+
TileDisplay,
|
|
41
|
+
TileLayerEvictErrorTileStrategy,
|
|
42
|
+
)
|
|
43
|
+
|
|
44
|
+
__all__ = [
|
|
45
|
+
"AttributionAlignment",
|
|
46
|
+
"Camera",
|
|
47
|
+
"CameraFit",
|
|
48
|
+
"CircleLayer",
|
|
49
|
+
"CircleMarker",
|
|
50
|
+
"CursorKeyboardRotationConfiguration",
|
|
51
|
+
"CursorRotationBehaviour",
|
|
52
|
+
"DashedStrokePattern",
|
|
53
|
+
"DottedStrokePattern",
|
|
54
|
+
"FadeInTileDisplay",
|
|
55
|
+
"ImageSourceAttribution",
|
|
56
|
+
"InstantaneousTileDisplay",
|
|
57
|
+
"InteractionConfiguration",
|
|
58
|
+
"InteractionFlag",
|
|
59
|
+
"KeyboardConfiguration",
|
|
60
|
+
"Map",
|
|
61
|
+
"MapEvent",
|
|
62
|
+
"MapEventSource",
|
|
63
|
+
"MapHoverEvent",
|
|
64
|
+
"MapLatitudeLongitude",
|
|
65
|
+
"MapLatitudeLongitudeBounds",
|
|
66
|
+
"MapLayer",
|
|
67
|
+
"MapPointerEvent",
|
|
68
|
+
"MapPositionChangeEvent",
|
|
69
|
+
"MapTapEvent",
|
|
70
|
+
"Marker",
|
|
71
|
+
"MarkerLayer",
|
|
72
|
+
"MultiFingerGesture",
|
|
73
|
+
"PatternFit",
|
|
74
|
+
"PolygonLayer",
|
|
75
|
+
"PolygonMarker",
|
|
76
|
+
"PolylineLayer",
|
|
77
|
+
"PolylineMarker",
|
|
78
|
+
"RichAttribution",
|
|
79
|
+
"SimpleAttribution",
|
|
80
|
+
"SolidStrokePattern",
|
|
81
|
+
"SourceAttribution",
|
|
82
|
+
"StrokePattern",
|
|
83
|
+
"TextSourceAttribution",
|
|
84
|
+
"TileDisplay",
|
|
85
|
+
"TileLayer",
|
|
86
|
+
"TileLayerEvictErrorTileStrategy",
|
|
87
|
+
]
|
|
@@ -1,20 +1,17 @@
|
|
|
1
|
-
from typing import
|
|
1
|
+
from typing import Optional
|
|
2
2
|
|
|
3
3
|
import flet as ft
|
|
4
|
+
from flet_map.map_layer import MapLayer
|
|
5
|
+
from flet_map.types import MapLatitudeLongitude
|
|
4
6
|
|
|
5
|
-
|
|
6
|
-
from .types import MapLatitudeLongitude
|
|
7
|
-
|
|
8
|
-
__all__ = ["CircleMarker", "CircleLayer"]
|
|
7
|
+
__all__ = ["CircleLayer", "CircleMarker"]
|
|
9
8
|
|
|
10
9
|
|
|
11
10
|
@ft.control("CircleMarker")
|
|
12
11
|
class CircleMarker(ft.Control):
|
|
13
12
|
"""
|
|
14
|
-
A circular marker displayed on the Map at the specified
|
|
15
|
-
|
|
16
|
-
Raises:
|
|
17
|
-
AssertionError: If the [`border_stroke_width`][(c).] is negative.
|
|
13
|
+
A circular marker displayed on the Map at the specified
|
|
14
|
+
location through the [`CircleLayer`][(p).].
|
|
18
15
|
"""
|
|
19
16
|
|
|
20
17
|
radius: ft.Number
|
|
@@ -29,28 +26,32 @@ class CircleMarker(ft.Control):
|
|
|
29
26
|
border_color: Optional[ft.ColorValue] = None
|
|
30
27
|
"""
|
|
31
28
|
The color of the circle border line.
|
|
32
|
-
|
|
33
|
-
|
|
29
|
+
|
|
30
|
+
Tip:
|
|
31
|
+
[`border_stroke_width`][(c).] must be greater than
|
|
32
|
+
`0.0` in order for this color to be visible.
|
|
34
33
|
"""
|
|
35
34
|
|
|
36
35
|
border_stroke_width: ft.Number = 0.0
|
|
37
36
|
"""
|
|
38
|
-
The stroke width for the circle border.
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
37
|
+
The stroke width for the circle border.
|
|
38
|
+
|
|
39
|
+
Raises:
|
|
40
|
+
ValueError: If it is less than `0.0`.
|
|
42
41
|
"""
|
|
43
42
|
|
|
44
43
|
use_radius_in_meter: bool = False
|
|
45
44
|
"""
|
|
46
|
-
Whether the [`radius`][
|
|
45
|
+
Whether the [`radius`][(c).] should use the unit meters.
|
|
47
46
|
"""
|
|
48
47
|
|
|
49
48
|
def before_update(self):
|
|
50
49
|
super().before_update()
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
50
|
+
if self.border_stroke_width < 0:
|
|
51
|
+
raise ValueError(
|
|
52
|
+
"border_stroke_width must be greater than or equal to 0, "
|
|
53
|
+
f"got {self.border_stroke_width}"
|
|
54
|
+
)
|
|
54
55
|
|
|
55
56
|
|
|
56
57
|
@ft.control("CircleLayer")
|
|
@@ -59,5 +60,5 @@ class CircleLayer(MapLayer):
|
|
|
59
60
|
A layer to display [`CircleMarker`][(p).]s.
|
|
60
61
|
"""
|
|
61
62
|
|
|
62
|
-
circles:
|
|
63
|
+
circles: list[CircleMarker]
|
|
63
64
|
"""A list of [`CircleMarker`][(p).]s to display."""
|
|
@@ -0,0 +1,366 @@
|
|
|
1
|
+
from dataclasses import field
|
|
2
|
+
from typing import Optional
|
|
3
|
+
|
|
4
|
+
import flet as ft
|
|
5
|
+
from flet_map.map_layer import MapLayer
|
|
6
|
+
from flet_map.types import (
|
|
7
|
+
CameraFit,
|
|
8
|
+
InteractionConfiguration,
|
|
9
|
+
MapEvent,
|
|
10
|
+
MapHoverEvent,
|
|
11
|
+
MapLatitudeLongitude,
|
|
12
|
+
MapPointerEvent,
|
|
13
|
+
MapPositionChangeEvent,
|
|
14
|
+
MapTapEvent,
|
|
15
|
+
)
|
|
16
|
+
|
|
17
|
+
__all__ = ["Map"]
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
@ft.control("Map")
|
|
21
|
+
class Map(ft.LayoutControl):
|
|
22
|
+
"""
|
|
23
|
+
An interactive map that displays various layers.
|
|
24
|
+
"""
|
|
25
|
+
|
|
26
|
+
layers: list[MapLayer]
|
|
27
|
+
"""
|
|
28
|
+
A list of layers to be displayed (stack-like) on the map.
|
|
29
|
+
"""
|
|
30
|
+
|
|
31
|
+
initial_center: MapLatitudeLongitude = field(
|
|
32
|
+
default_factory=lambda: MapLatitudeLongitude(latitude=50.5, longitude=30.51)
|
|
33
|
+
)
|
|
34
|
+
"""
|
|
35
|
+
The initial center of the map.
|
|
36
|
+
"""
|
|
37
|
+
|
|
38
|
+
initial_rotation: ft.Number = 0.0
|
|
39
|
+
"""
|
|
40
|
+
The rotation (in degrees) when the map is first loaded.
|
|
41
|
+
"""
|
|
42
|
+
|
|
43
|
+
initial_zoom: ft.Number = 13.0
|
|
44
|
+
"""
|
|
45
|
+
The zoom when the map is first loaded.
|
|
46
|
+
If initial_camera_fit is defined this has no effect.
|
|
47
|
+
"""
|
|
48
|
+
|
|
49
|
+
interaction_configuration: InteractionConfiguration = field(
|
|
50
|
+
default_factory=lambda: InteractionConfiguration()
|
|
51
|
+
)
|
|
52
|
+
"""
|
|
53
|
+
The interaction configuration.
|
|
54
|
+
"""
|
|
55
|
+
|
|
56
|
+
bgcolor: ft.ColorValue = ft.Colors.GREY_300
|
|
57
|
+
"""
|
|
58
|
+
The background color of this control.
|
|
59
|
+
"""
|
|
60
|
+
|
|
61
|
+
keep_alive: bool = False
|
|
62
|
+
"""
|
|
63
|
+
Whether to enable the built in keep-alive functionality.
|
|
64
|
+
|
|
65
|
+
If the map is within a complex layout, such as a [`ListView`][flet.ListView],
|
|
66
|
+
the map will reset to it's inital position after it appears back into view.
|
|
67
|
+
To ensure this doesn't happen, enable this flag to prevent it from rebuilding.
|
|
68
|
+
"""
|
|
69
|
+
|
|
70
|
+
max_zoom: Optional[ft.Number] = None
|
|
71
|
+
"""
|
|
72
|
+
The maximum (highest) zoom level of every layer.
|
|
73
|
+
Each layer can specify additional zoom level restrictions.
|
|
74
|
+
"""
|
|
75
|
+
|
|
76
|
+
min_zoom: Optional[ft.Number] = None
|
|
77
|
+
"""
|
|
78
|
+
The minimum (smallest) zoom level of every layer.
|
|
79
|
+
Each layer can specify additional zoom level restrictions.
|
|
80
|
+
"""
|
|
81
|
+
|
|
82
|
+
animation_curve: ft.AnimationCurve = ft.AnimationCurve.FAST_OUT_SLOWIN
|
|
83
|
+
"""
|
|
84
|
+
The default animation curve to be used for map-animations
|
|
85
|
+
when calling instance methods like [`zoom_in()`][(c).zoom_in],
|
|
86
|
+
[`rotate_from()`][(c).rotate_from],
|
|
87
|
+
[`move_to()`][(c).move_to] etc.
|
|
88
|
+
"""
|
|
89
|
+
|
|
90
|
+
animation_duration: ft.DurationValue = field(
|
|
91
|
+
default_factory=lambda: ft.Duration(milliseconds=500)
|
|
92
|
+
)
|
|
93
|
+
"""
|
|
94
|
+
The default animation duration to be used for map-animations
|
|
95
|
+
when calling instance methods like [`zoom_in()`][(c).zoom_in],
|
|
96
|
+
[`rotate_from()`][(c).rotate_from],
|
|
97
|
+
[`move_to()`][(c).move_to] etc.
|
|
98
|
+
"""
|
|
99
|
+
|
|
100
|
+
initial_camera_fit: Optional[CameraFit] = None
|
|
101
|
+
"""
|
|
102
|
+
Defines the visible bounds when the map is first loaded.
|
|
103
|
+
Takes precedence over [`initial_center`][(c).]/[`initial_zoom`][(c).].
|
|
104
|
+
"""
|
|
105
|
+
|
|
106
|
+
on_init: Optional[ft.ControlEventHandler["Map"]] = None
|
|
107
|
+
"""
|
|
108
|
+
Fires when the map is initialized.
|
|
109
|
+
"""
|
|
110
|
+
|
|
111
|
+
on_tap: Optional[ft.EventHandler[MapTapEvent]] = None
|
|
112
|
+
"""
|
|
113
|
+
Fires when a tap event occurs.
|
|
114
|
+
"""
|
|
115
|
+
|
|
116
|
+
on_hover: Optional[ft.EventHandler[MapHoverEvent]] = None
|
|
117
|
+
"""
|
|
118
|
+
Fires when a hover event occurs.
|
|
119
|
+
"""
|
|
120
|
+
|
|
121
|
+
on_secondary_tap: Optional[ft.EventHandler[MapTapEvent]] = None
|
|
122
|
+
"""
|
|
123
|
+
Fires when a secondary tap event occurs.
|
|
124
|
+
"""
|
|
125
|
+
|
|
126
|
+
on_long_press: Optional[ft.EventHandler[MapTapEvent]] = None
|
|
127
|
+
"""
|
|
128
|
+
Fires when a long press event occurs.
|
|
129
|
+
"""
|
|
130
|
+
|
|
131
|
+
on_event: Optional[ft.EventHandler[MapEvent]] = None
|
|
132
|
+
"""
|
|
133
|
+
Fires when any map events occurs.
|
|
134
|
+
"""
|
|
135
|
+
|
|
136
|
+
on_position_change: Optional[ft.EventHandler[MapPositionChangeEvent]] = None
|
|
137
|
+
"""
|
|
138
|
+
Fires when the map position changes.
|
|
139
|
+
"""
|
|
140
|
+
|
|
141
|
+
on_pointer_down: Optional[ft.EventHandler[MapPointerEvent]] = None
|
|
142
|
+
"""
|
|
143
|
+
Fires when a pointer down event occurs.
|
|
144
|
+
"""
|
|
145
|
+
|
|
146
|
+
on_pointer_cancel: Optional[ft.EventHandler[MapPointerEvent]] = None
|
|
147
|
+
"""
|
|
148
|
+
Fires when a pointer cancel event occurs.
|
|
149
|
+
"""
|
|
150
|
+
|
|
151
|
+
on_pointer_up: Optional[ft.EventHandler[MapPointerEvent]] = None
|
|
152
|
+
"""
|
|
153
|
+
Fires when a pointer up event occurs.
|
|
154
|
+
"""
|
|
155
|
+
|
|
156
|
+
async def rotate_from(
|
|
157
|
+
self,
|
|
158
|
+
degree: ft.Number,
|
|
159
|
+
animation_curve: Optional[ft.AnimationCurve] = None,
|
|
160
|
+
animation_duration: Optional[ft.DurationValue] = None,
|
|
161
|
+
cancel_ongoing_animations: bool = False,
|
|
162
|
+
) -> None:
|
|
163
|
+
"""
|
|
164
|
+
Applies a rotation of `degree` to the current rotation.
|
|
165
|
+
|
|
166
|
+
Args:
|
|
167
|
+
degree: The number of degrees to increment to the current rotation.
|
|
168
|
+
animation_curve: The curve of the animation. If None (the default),
|
|
169
|
+
[`Map.animation_curve`][(p).] will be used.
|
|
170
|
+
animation_duration: The duration of the animation.
|
|
171
|
+
If None (the default), [`Map.animation_duration`][(p).] will be used.
|
|
172
|
+
cancel_ongoing_animations: Whether to cancel/stop all
|
|
173
|
+
ongoing map-animations before starting this new one.
|
|
174
|
+
"""
|
|
175
|
+
await self._invoke_method(
|
|
176
|
+
method_name="rotate_from",
|
|
177
|
+
arguments={
|
|
178
|
+
"degree": degree,
|
|
179
|
+
"curve": animation_curve or self.animation_curve,
|
|
180
|
+
"duration": animation_duration or self.animation_duration,
|
|
181
|
+
"cancel_ongoing_animations": cancel_ongoing_animations,
|
|
182
|
+
},
|
|
183
|
+
)
|
|
184
|
+
|
|
185
|
+
async def reset_rotation(
|
|
186
|
+
self,
|
|
187
|
+
animation_curve: Optional[ft.AnimationCurve] = None,
|
|
188
|
+
animation_duration: Optional[ft.DurationValue] = None,
|
|
189
|
+
cancel_ongoing_animations: bool = False,
|
|
190
|
+
) -> None:
|
|
191
|
+
"""
|
|
192
|
+
Resets the map's rotation to 0 degrees.
|
|
193
|
+
|
|
194
|
+
Args:
|
|
195
|
+
animation_curve: The curve of the animation. If None (the default),
|
|
196
|
+
[`Map.animation_curve`][(p).] will be used.
|
|
197
|
+
animation_duration: The duration of the animation.
|
|
198
|
+
If None (the default), [`Map.animation_duration`][(p).] will be used.
|
|
199
|
+
cancel_ongoing_animations: Whether to cancel/stop all
|
|
200
|
+
ongoing map-animations before starting this new one.
|
|
201
|
+
"""
|
|
202
|
+
await self._invoke_method(
|
|
203
|
+
method_name="reset_rotation",
|
|
204
|
+
arguments={
|
|
205
|
+
"curve": animation_curve or self.animation_curve,
|
|
206
|
+
"duration": animation_duration or self.animation_duration,
|
|
207
|
+
"cancel_ongoing_animations": cancel_ongoing_animations,
|
|
208
|
+
},
|
|
209
|
+
)
|
|
210
|
+
|
|
211
|
+
async def zoom_in(
|
|
212
|
+
self,
|
|
213
|
+
animation_curve: Optional[ft.AnimationCurve] = None,
|
|
214
|
+
animation_duration: Optional[ft.DurationValue] = None,
|
|
215
|
+
cancel_ongoing_animations: bool = False,
|
|
216
|
+
) -> None:
|
|
217
|
+
"""
|
|
218
|
+
Zooms in by one zoom-level from the current one.
|
|
219
|
+
|
|
220
|
+
Args:
|
|
221
|
+
animation_curve: The curve of the animation. If None (the default),
|
|
222
|
+
[`Map.animation_curve`][(p).] will be used.
|
|
223
|
+
animation_duration: The duration of the animation.
|
|
224
|
+
If None (the default), [`Map.animation_duration`][(p).] will be used.
|
|
225
|
+
cancel_ongoing_animations: Whether to cancel/stop all
|
|
226
|
+
ongoing map-animations before starting this new one.
|
|
227
|
+
"""
|
|
228
|
+
await self._invoke_method(
|
|
229
|
+
method_name="zoom_in",
|
|
230
|
+
arguments={
|
|
231
|
+
"curve": animation_curve or self.animation_curve,
|
|
232
|
+
"duration": animation_duration or self.animation_duration,
|
|
233
|
+
"cancel_ongoing_animations": cancel_ongoing_animations,
|
|
234
|
+
},
|
|
235
|
+
)
|
|
236
|
+
|
|
237
|
+
async def zoom_out(
|
|
238
|
+
self,
|
|
239
|
+
animation_curve: Optional[ft.AnimationCurve] = None,
|
|
240
|
+
animation_duration: Optional[ft.DurationValue] = None,
|
|
241
|
+
cancel_ongoing_animations: bool = False,
|
|
242
|
+
) -> None:
|
|
243
|
+
"""
|
|
244
|
+
Zooms out by one zoom-level from the current one.
|
|
245
|
+
|
|
246
|
+
Args:
|
|
247
|
+
animation_curve: The curve of the animation. If `None` (the default),
|
|
248
|
+
[`Map.animation_curve`][(p).] will be used.
|
|
249
|
+
animation_duration: The duration of the animation.
|
|
250
|
+
If None (the default), [`Map.animation_duration`][(p).] will be used.
|
|
251
|
+
cancel_ongoing_animations: Whether to cancel/stop all
|
|
252
|
+
ongoing map-animations before starting this new one.
|
|
253
|
+
"""
|
|
254
|
+
await self._invoke_method(
|
|
255
|
+
method_name="zoom_out",
|
|
256
|
+
arguments={
|
|
257
|
+
"curve": animation_curve or self.animation_curve,
|
|
258
|
+
"duration": animation_duration or self.animation_duration,
|
|
259
|
+
"cancel_ongoing_animations": cancel_ongoing_animations,
|
|
260
|
+
},
|
|
261
|
+
)
|
|
262
|
+
|
|
263
|
+
async def zoom_to(
|
|
264
|
+
self,
|
|
265
|
+
zoom: ft.Number,
|
|
266
|
+
animation_curve: Optional[ft.AnimationCurve] = None,
|
|
267
|
+
animation_duration: Optional[ft.DurationValue] = None,
|
|
268
|
+
cancel_ongoing_animations: bool = False,
|
|
269
|
+
) -> None:
|
|
270
|
+
"""
|
|
271
|
+
Zoom the map to a specific zoom level.
|
|
272
|
+
|
|
273
|
+
Args:
|
|
274
|
+
zoom: The zoom level to zoom to.
|
|
275
|
+
animation_curve: The curve of the animation. If `None` (the default),
|
|
276
|
+
[`Map.animation_curve`][(p).] will be used.
|
|
277
|
+
animation_duration: The duration of the animation.
|
|
278
|
+
If None (the default), [`Map.animation_duration`][(p).] will be used.
|
|
279
|
+
cancel_ongoing_animations: Whether to cancel/stop all
|
|
280
|
+
ongoing map-animations before starting this new one.
|
|
281
|
+
"""
|
|
282
|
+
await self._invoke_method(
|
|
283
|
+
method_name="zoom_to",
|
|
284
|
+
arguments={
|
|
285
|
+
"zoom": zoom,
|
|
286
|
+
"curve": animation_curve or self.animation_curve,
|
|
287
|
+
"duration": animation_duration or self.animation_duration,
|
|
288
|
+
"cancel_ongoing_animations": cancel_ongoing_animations,
|
|
289
|
+
},
|
|
290
|
+
)
|
|
291
|
+
|
|
292
|
+
async def move_to(
|
|
293
|
+
self,
|
|
294
|
+
destination: Optional[MapLatitudeLongitude] = None,
|
|
295
|
+
zoom: Optional[ft.Number] = None,
|
|
296
|
+
rotation: Optional[ft.Number] = None,
|
|
297
|
+
animation_curve: Optional[ft.AnimationCurve] = None,
|
|
298
|
+
animation_duration: Optional[ft.DurationValue] = None,
|
|
299
|
+
offset: ft.OffsetValue = (0, 0),
|
|
300
|
+
cancel_ongoing_animations: bool = False,
|
|
301
|
+
) -> None:
|
|
302
|
+
"""
|
|
303
|
+
Moves to a specific location.
|
|
304
|
+
|
|
305
|
+
Args:
|
|
306
|
+
destination: The destination point to move to.
|
|
307
|
+
zoom: The zoom level to be applied. If provided,
|
|
308
|
+
must be greater than or equal to `0.0`.
|
|
309
|
+
rotation: Rotation (in degrees) to be applied.
|
|
310
|
+
offset: The offset to be used. Only works when `rotation` is `None`.
|
|
311
|
+
animation_curve: The curve of the animation. If None (the default),
|
|
312
|
+
[`Map.animation_curve`][(p).] will be used.
|
|
313
|
+
animation_duration: The duration of the animation.
|
|
314
|
+
If None (the default), [`Map.animation_duration`][(p).] will be used.
|
|
315
|
+
cancel_ongoing_animations: Whether to cancel/stop all
|
|
316
|
+
ongoing map-animations before starting this new one.
|
|
317
|
+
|
|
318
|
+
Raises:
|
|
319
|
+
ValueError: If `zoom` is not `None` and is negative.
|
|
320
|
+
"""
|
|
321
|
+
if zoom is not None and zoom < 0:
|
|
322
|
+
raise ValueError(f"zoom must be greater than or equal to zero, got {zoom}")
|
|
323
|
+
await self._invoke_method(
|
|
324
|
+
method_name="move_to",
|
|
325
|
+
arguments={
|
|
326
|
+
"destination": destination,
|
|
327
|
+
"zoom": zoom,
|
|
328
|
+
"offset": offset,
|
|
329
|
+
"rotation": rotation,
|
|
330
|
+
"curve": animation_curve or self.animation_curve,
|
|
331
|
+
"duration": animation_duration or self.animation_duration,
|
|
332
|
+
"cancel_ongoing_animations": cancel_ongoing_animations,
|
|
333
|
+
},
|
|
334
|
+
)
|
|
335
|
+
|
|
336
|
+
async def center_on(
|
|
337
|
+
self,
|
|
338
|
+
point: MapLatitudeLongitude,
|
|
339
|
+
zoom: Optional[ft.Number],
|
|
340
|
+
animation_curve: Optional[ft.AnimationCurve] = None,
|
|
341
|
+
animation_duration: Optional[ft.DurationValue] = None,
|
|
342
|
+
cancel_ongoing_animations: bool = False,
|
|
343
|
+
) -> None:
|
|
344
|
+
"""
|
|
345
|
+
Centers the map on the given point.
|
|
346
|
+
|
|
347
|
+
Args:
|
|
348
|
+
point: The point on which to center the map.
|
|
349
|
+
zoom: The zoom level to be applied.
|
|
350
|
+
animation_curve: The curve of the animation. If `None` (the default),
|
|
351
|
+
[`Map.animation_curve`][(p).] will be used.
|
|
352
|
+
animation_duration: The duration of the animation.
|
|
353
|
+
If None (the default), [`Map.animation_duration`][(p).] will be used.
|
|
354
|
+
cancel_ongoing_animations: Whether to cancel/stop all
|
|
355
|
+
ongoing map-animations before starting this new one.
|
|
356
|
+
"""
|
|
357
|
+
await self._invoke_method(
|
|
358
|
+
method_name="center_on",
|
|
359
|
+
arguments={
|
|
360
|
+
"point": point,
|
|
361
|
+
"zoom": zoom,
|
|
362
|
+
"curve": animation_curve or self.animation_curve,
|
|
363
|
+
"duration": animation_duration or self.animation_duration,
|
|
364
|
+
"cancel_ongoing_animations": cancel_ongoing_animations,
|
|
365
|
+
},
|
|
366
|
+
)
|