flet-map 0.1.0__py3-none-any.whl → 0.2.0.dev42__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-map might be problematic. Click here for more details.

Files changed (37) hide show
  1. flet_map/__init__.py +30 -19
  2. flet_map/circle_layer.py +46 -139
  3. flet_map/map.py +462 -604
  4. flet_map/map_layer.py +14 -20
  5. flet_map/marker_layer.py +83 -169
  6. flet_map/polygon_layer.py +95 -232
  7. flet_map/polyline_layer.py +85 -262
  8. flet_map/rich_attribution.py +48 -126
  9. flet_map/simple_attribution.py +24 -75
  10. flet_map/source_attribution.py +73 -0
  11. flet_map/tile_layer.py +224 -266
  12. flet_map/types.py +953 -0
  13. flet_map-0.2.0.dev42.dist-info/METADATA +66 -0
  14. flet_map-0.2.0.dev42.dist-info/RECORD +35 -0
  15. {flet_map-0.1.0.dist-info → flet_map-0.2.0.dev42.dist-info}/WHEEL +1 -1
  16. flet_map-0.2.0.dev42.dist-info/licenses/LICENSE +201 -0
  17. flutter/flet_map/CHANGELOG.md +4 -0
  18. flutter/flet_map/lib/flet_map.dart +1 -1
  19. flutter/flet_map/lib/src/circle_layer.dart +15 -25
  20. flutter/flet_map/lib/src/extension.dart +37 -0
  21. flutter/flet_map/lib/src/map.dart +93 -105
  22. flutter/flet_map/lib/src/marker_layer.dart +21 -33
  23. flutter/flet_map/lib/src/polygon_layer.dart +32 -52
  24. flutter/flet_map/lib/src/polyline_layer.dart +41 -64
  25. flutter/flet_map/lib/src/rich_attribution.dart +34 -34
  26. flutter/flet_map/lib/src/simple_attribution.dart +9 -23
  27. flutter/flet_map/lib/src/tile_layer.dart +47 -60
  28. flutter/flet_map/lib/src/utils/attribution_alignment.dart +1 -3
  29. flutter/flet_map/lib/src/utils/map.dart +257 -203
  30. flutter/flet_map/pubspec.lock +179 -130
  31. flutter/flet_map/pubspec.yaml +10 -5
  32. flet_map/text_source_attribution.py +0 -87
  33. flet_map-0.1.0.dist-info/METADATA +0 -168
  34. flet_map-0.1.0.dist-info/RECORD +0 -34
  35. flutter/flet_map/lib/src/create_control.dart +0 -70
  36. flutter/flet_map/lib/src/text_source_attribution.dart +0 -29
  37. {flet_map-0.1.0.dist-info → flet_map-0.2.0.dev42.dist-info}/top_level.txt +0 -0
flet_map/__init__.py CHANGED
@@ -1,30 +1,41 @@
1
- from flet_map.circle_layer import CircleLayer, CircleMarker
2
- from flet_map.map import (
3
- Map,
1
+ from .circle_layer import CircleLayer, CircleMarker
2
+ from .map import Map
3
+ from .marker_layer import Marker, MarkerLayer
4
+ from .polygon_layer import PolygonLayer, PolygonMarker
5
+ from .polyline_layer import PolylineLayer, PolylineMarker
6
+ from .rich_attribution import RichAttribution
7
+ from .simple_attribution import SimpleAttribution
8
+ from .source_attribution import (
9
+ ImageSourceAttribution,
10
+ SourceAttribution,
11
+ TextSourceAttribution,
12
+ )
13
+ from .tile_layer import TileLayer
14
+ from .types import (
15
+ AttributionAlignment,
16
+ Camera,
17
+ CameraFit,
18
+ CursorKeyboardRotationConfiguration,
19
+ CursorRotationBehaviour,
20
+ DashedStrokePattern,
21
+ DottedStrokePattern,
22
+ FadeInTileDisplay,
23
+ InstantaneousTileDisplay,
24
+ InteractionConfiguration,
25
+ InteractionFlag,
26
+ KeyboardConfiguration,
4
27
  MapEvent,
5
28
  MapEventSource,
6
29
  MapHoverEvent,
7
- MapInteractionConfiguration,
8
- MapInteractiveFlag,
9
30
  MapLatitudeLongitude,
10
31
  MapLatitudeLongitudeBounds,
11
- MapMultiFingerGesture,
12
- MapPointerDeviceType,
13
32
  MapPointerEvent,
14
33
  MapPositionChangeEvent,
15
34
  MapTapEvent,
16
- )
17
- from flet_map.marker_layer import Marker, MarkerLayer
18
- from flet_map.polygon_layer import PolygonLayer, PolygonMarker
19
- from flet_map.polyline_layer import (
20
- DashedStrokePattern,
21
- DottedStrokePattern,
35
+ MultiFingerGesture,
22
36
  PatternFit,
23
- PolylineLayer,
24
- PolylineMarker,
25
37
  SolidStrokePattern,
38
+ StrokePattern,
39
+ TileDisplay,
40
+ TileLayerEvictErrorTileStrategy,
26
41
  )
27
- from flet_map.rich_attribution import RichAttribution
28
- from flet_map.simple_attribution import SimpleAttribution
29
- from flet_map.text_source_attribution import TextSourceAttribution
30
- from flet_map.tile_layer import MapTileLayerEvictErrorTileStrategy, TileLayer
flet_map/circle_layer.py CHANGED
@@ -1,156 +1,63 @@
1
- from typing import Any, List, Optional, Union
1
+ from typing import List, Optional
2
2
 
3
- from flet.core.control import Control, OptionalNumber
4
- from flet_map.map import MapLatitudeLongitude
5
- from flet_map.map_layer import MapLayer
6
- from flet.core.ref import Ref
7
- from flet.core.types import ColorEnums, ColorValue
3
+ import flet as ft
8
4
 
5
+ from .map_layer import MapLayer
6
+ from .types import MapLatitudeLongitude
9
7
 
10
- class CircleMarker(Control):
8
+ __all__ = ["CircleMarker", "CircleLayer"]
9
+
10
+
11
+ @ft.control("CircleMarker")
12
+ class CircleMarker(ft.Control):
13
+ """
14
+ A circular marker displayed on the Map at the specified location through the [`CircleLayer`][(p).].
15
+
16
+ Raises:
17
+ AssertionError: If the [`border_stroke_width`][(c).] is negative.
11
18
  """
12
- A circular marker displayed on the Map at the specified location through the CircleLayer.
13
19
 
14
- -----
20
+ radius: ft.Number
21
+ """The radius of the circle"""
22
+
23
+ coordinates: MapLatitudeLongitude
24
+ """The center coordinates of the circle"""
25
+
26
+ color: Optional[ft.ColorValue] = None
27
+ """The color of the circle area."""
28
+
29
+ border_color: Optional[ft.ColorValue] = None
30
+ """
31
+ The color of the circle border line.
32
+
33
+ Needs [`border_stroke_width`][..] to be greater than `0.0` in order to be visible.
34
+ """
15
35
 
16
- Online docs: https://flet.dev/docs/controls/mapcirclemarker
36
+ border_stroke_width: ft.Number = 0.0
37
+ """
38
+ The stroke width for the circle border.
39
+
40
+ Note:
41
+ Must be non-negative.
17
42
  """
18
43
 
19
- def __init__(
20
- self,
21
- radius: Union[int, float],
22
- coordinates: MapLatitudeLongitude,
23
- color: Optional[ColorValue] = None,
24
- border_color: Optional[ColorValue] = None,
25
- border_stroke_width: OptionalNumber = None,
26
- use_radius_in_meter: Optional[bool] = None,
27
- #
28
- # Control
29
- #
30
- ref: Optional[Ref] = None,
31
- visible: Optional[bool] = None,
32
- data: Any = None,
33
- ):
34
-
35
- Control.__init__(
36
- self,
37
- ref=ref,
38
- visible=visible,
39
- data=data,
40
- )
41
-
42
- self.coordinates = coordinates
43
- self.color = color
44
- self.border_color = border_color
45
- self.border_stroke_width = border_stroke_width
46
- self.use_radius_in_meter = use_radius_in_meter
47
- self.radius = radius
48
-
49
- def _get_control_name(self):
50
- return "map_circle_marker"
44
+ use_radius_in_meter: bool = False
45
+ """
46
+ Whether the [`radius`][..] should use the unit meters.
47
+ """
51
48
 
52
49
  def before_update(self):
53
50
  super().before_update()
54
- self._set_attr_json("coordinates", self.__coordinates)
55
-
56
- # use_radius_in_meter
57
- @property
58
- def use_radius_in_meter(self) -> bool:
59
- return self._get_attr("useRadiusInMeter", data_type="bool", def_value=False)
60
-
61
- @use_radius_in_meter.setter
62
- def use_radius_in_meter(self, value: Optional[bool]):
63
- self._set_attr("useRadiusInMeter", value)
64
-
65
- # color
66
- @property
67
- def color(self) -> Optional[ColorValue]:
68
- return self.__color
69
-
70
- @color.setter
71
- def color(self, value: Optional[ColorValue]):
72
- self.__color = value
73
- self._set_enum_attr("color", value, ColorEnums)
74
-
75
- # border_color
76
- @property
77
- def border_color(self) -> Optional[ColorValue]:
78
- return self.__border_color
79
-
80
- @border_color.setter
81
- def border_color(self, value: Optional[ColorValue]):
82
- self.__border_color = value
83
- self._set_enum_attr("borderColor", value, ColorEnums)
84
-
85
- # radius
86
- @property
87
- def radius(self) -> Union[int, float]:
88
- return self._get_attr("radius", data_type="float")
89
-
90
- @radius.setter
91
- def radius(self, value: Union[int, float]):
92
- self._set_attr("radius", value)
93
-
94
- # border_stroke_width
95
- @property
96
- def border_stroke_width(self) -> OptionalNumber:
97
- return self._get_attr("borderStrokeWidth", data_type="float")
98
-
99
- @border_stroke_width.setter
100
- def border_stroke_width(self, value: OptionalNumber):
101
- assert value is None or value >= 0, "border_stroke_width cannot be negative"
102
- self._set_attr("borderStrokeWidth", value)
103
-
104
- # coordinates
105
- @property
106
- def coordinates(self) -> MapLatitudeLongitude:
107
- return self.__coordinates
108
-
109
- @coordinates.setter
110
- def coordinates(self, value: MapLatitudeLongitude):
111
- self.__coordinates = value
51
+ assert (
52
+ self.border_stroke_width >= 0
53
+ ), "border_stroke_width must be greater than or equal to 0"
112
54
 
113
55
 
56
+ @ft.control("CircleLayer")
114
57
  class CircleLayer(MapLayer):
115
58
  """
116
- A layer to display CircleMarkers.
117
-
118
- -----
119
-
120
- Online docs: https://flet.dev/docs/controls/mapcirclelayer
59
+ A layer to display [`CircleMarker`][(p).]s.
121
60
  """
122
61
 
123
- def __init__(
124
- self,
125
- circles: List[CircleMarker],
126
- #
127
- # MapLayer
128
- #
129
- ref: Optional[Ref] = None,
130
- visible: Optional[bool] = None,
131
- data: Any = None,
132
- ):
133
-
134
- MapLayer.__init__(
135
- self,
136
- ref=ref,
137
- visible=visible,
138
- data=data,
139
- )
140
-
141
- self.circles = circles
142
-
143
- def _get_control_name(self):
144
- return "map_circle_layer"
145
-
146
- def _get_children(self):
147
- return self.__circles
148
-
149
- # circles
150
- @property
151
- def circles(self) -> List[CircleMarker]:
152
- return self.__circles
153
-
154
- @circles.setter
155
- def circles(self, value: List[CircleMarker]):
156
- self.__circles = value
62
+ circles: List[CircleMarker]
63
+ """A list of [`CircleMarker`][(p).]s to display."""