flet-map 0.1.0.dev2__py3-none-any.whl → 0.2.0.dev45__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.
- flet_map/__init__.py +30 -19
- flet_map/circle_layer.py +46 -139
- flet_map/map.py +462 -604
- flet_map/map_layer.py +14 -20
- flet_map/marker_layer.py +83 -169
- flet_map/polygon_layer.py +95 -232
- flet_map/polyline_layer.py +85 -262
- flet_map/rich_attribution.py +48 -126
- flet_map/simple_attribution.py +24 -75
- flet_map/source_attribution.py +73 -0
- flet_map/tile_layer.py +224 -266
- flet_map/types.py +953 -0
- flet_map-0.2.0.dev45.dist-info/METADATA +66 -0
- flet_map-0.2.0.dev45.dist-info/RECORD +35 -0
- {flet_map-0.1.0.dev2.dist-info → flet_map-0.2.0.dev45.dist-info}/WHEEL +1 -1
- flet_map-0.2.0.dev45.dist-info/licenses/LICENSE +201 -0
- flutter/flet_map/CHANGELOG.md +4 -0
- flutter/flet_map/lib/flet_map.dart +1 -1
- flutter/flet_map/lib/src/circle_layer.dart +15 -25
- flutter/flet_map/lib/src/extension.dart +37 -0
- flutter/flet_map/lib/src/map.dart +93 -105
- flutter/flet_map/lib/src/marker_layer.dart +21 -33
- flutter/flet_map/lib/src/polygon_layer.dart +32 -52
- flutter/flet_map/lib/src/polyline_layer.dart +41 -64
- flutter/flet_map/lib/src/rich_attribution.dart +34 -34
- flutter/flet_map/lib/src/simple_attribution.dart +9 -23
- flutter/flet_map/lib/src/tile_layer.dart +47 -60
- flutter/flet_map/lib/src/utils/attribution_alignment.dart +1 -3
- flutter/flet_map/lib/src/utils/map.dart +257 -203
- flutter/flet_map/pubspec.lock +179 -130
- flutter/flet_map/pubspec.yaml +10 -5
- flet_map/text_source_attribution.py +0 -87
- flet_map-0.1.0.dev2.dist-info/METADATA +0 -168
- flet_map-0.1.0.dev2.dist-info/RECORD +0 -34
- flutter/flet_map/lib/src/create_control.dart +0 -70
- flutter/flet_map/lib/src/text_source_attribution.dart +0 -29
- {flet_map-0.1.0.dev2.dist-info → flet_map-0.2.0.dev45.dist-info}/top_level.txt +0 -0
flet_map/polyline_layer.py
CHANGED
|
@@ -1,292 +1,115 @@
|
|
|
1
|
-
from dataclasses import
|
|
2
|
-
from
|
|
3
|
-
from typing import Any, List, Optional, Union
|
|
1
|
+
from dataclasses import field
|
|
2
|
+
from typing import Optional
|
|
4
3
|
|
|
5
|
-
|
|
6
|
-
from flet_map.map import MapLatitudeLongitude
|
|
7
|
-
from flet_map.map_layer import MapLayer
|
|
8
|
-
from flet.core.ref import Ref
|
|
9
|
-
from flet.core.types import ColorEnums, ColorValue, StrokeCap, StrokeJoin
|
|
4
|
+
import flet as ft
|
|
10
5
|
|
|
6
|
+
from .map_layer import MapLayer
|
|
7
|
+
from .types import MapLatitudeLongitude, SolidStrokePattern, StrokePattern
|
|
11
8
|
|
|
12
|
-
|
|
13
|
-
SCALE_DOWN = "scaleDown"
|
|
14
|
-
SCALE_UP = "scaleUp"
|
|
15
|
-
APPEND_DOT = "appendDot"
|
|
16
|
-
EXTEND_FINAL_DASH = "extendFinalDash"
|
|
9
|
+
__all__ = ["PolylineMarker", "PolylineLayer"]
|
|
17
10
|
|
|
18
11
|
|
|
19
|
-
@
|
|
20
|
-
class
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
@dataclass
|
|
25
|
-
class SolidStrokePattern(StrokePattern):
|
|
26
|
-
def __post_init__(self):
|
|
27
|
-
self.type = "solid"
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
@dataclass
|
|
31
|
-
class DashedStrokePattern(StrokePattern):
|
|
32
|
-
segments: Optional[List[Union[float, int]]] = None
|
|
33
|
-
pattern_fit: Optional[PatternFit] = PatternFit.SCALE_UP
|
|
12
|
+
@ft.control("PolylineMarker")
|
|
13
|
+
class PolylineMarker(ft.Control):
|
|
14
|
+
"""
|
|
15
|
+
A marker for the [`PolylineLayer`][(p).].
|
|
16
|
+
"""
|
|
34
17
|
|
|
35
|
-
|
|
36
|
-
|
|
18
|
+
coordinates: list[MapLatitudeLongitude]
|
|
19
|
+
"""
|
|
20
|
+
The list of coordinates for the polyline.
|
|
21
|
+
"""
|
|
37
22
|
|
|
23
|
+
colors_stop: Optional[list[ft.Number]] = None
|
|
24
|
+
"""
|
|
25
|
+
The stops for the [`gradient_colors`][..].
|
|
26
|
+
"""
|
|
38
27
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
28
|
+
gradient_colors: Optional[list[ft.ColorValue]] = None
|
|
29
|
+
"""
|
|
30
|
+
The List of colors in case a gradient should get used.
|
|
31
|
+
"""
|
|
43
32
|
|
|
44
|
-
|
|
45
|
-
|
|
33
|
+
border_color: ft.ColorValue = ft.Colors.YELLOW
|
|
34
|
+
"""
|
|
35
|
+
The border's color.
|
|
36
|
+
"""
|
|
46
37
|
|
|
38
|
+
color: ft.ColorValue = ft.Colors.YELLOW
|
|
39
|
+
"""
|
|
40
|
+
The color of the line stroke.
|
|
41
|
+
"""
|
|
47
42
|
|
|
48
|
-
|
|
43
|
+
stroke_width: ft.Number = 1.0
|
|
44
|
+
"""
|
|
45
|
+
The width of the stroke.
|
|
46
|
+
|
|
47
|
+
Note:
|
|
48
|
+
Must be non-negative.
|
|
49
49
|
"""
|
|
50
|
-
A marker for the PolylineLayer.
|
|
51
50
|
|
|
52
|
-
|
|
51
|
+
border_stroke_width: ft.Number = 0.0
|
|
52
|
+
"""
|
|
53
|
+
The width of the stroke with of the line border.
|
|
54
|
+
|
|
55
|
+
Note:
|
|
56
|
+
Must be non-negative.
|
|
57
|
+
"""
|
|
53
58
|
|
|
54
|
-
|
|
59
|
+
use_stroke_width_in_meter: bool = False
|
|
60
|
+
"""
|
|
61
|
+
Whether the stroke's width should have meters as unit.
|
|
55
62
|
"""
|
|
56
63
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
border_color: Optional[ColorValue] = None,
|
|
63
|
-
color: Optional[ColorValue] = None,
|
|
64
|
-
stroke_width: OptionalNumber = None,
|
|
65
|
-
border_stroke_width: OptionalNumber = None,
|
|
66
|
-
use_stroke_width_in_meter: Optional[bool] = None,
|
|
67
|
-
stroke_pattern: Optional[StrokePattern] = None,
|
|
68
|
-
stroke_cap: Optional[StrokeCap] = None,
|
|
69
|
-
stroke_join: Optional[StrokeJoin] = None,
|
|
70
|
-
#
|
|
71
|
-
# Control
|
|
72
|
-
#
|
|
73
|
-
ref: Optional[Ref] = None,
|
|
74
|
-
visible: Optional[bool] = None,
|
|
75
|
-
data: Any = None,
|
|
76
|
-
):
|
|
77
|
-
Control.__init__(
|
|
78
|
-
self,
|
|
79
|
-
ref=ref,
|
|
80
|
-
visible=visible,
|
|
81
|
-
data=data,
|
|
82
|
-
)
|
|
64
|
+
stroke_pattern: StrokePattern = field(default_factory=lambda: SolidStrokePattern())
|
|
65
|
+
"""
|
|
66
|
+
Determines whether the line should be solid, dotted, or dashed, and the
|
|
67
|
+
exact characteristics of each.
|
|
68
|
+
"""
|
|
83
69
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
self.stroke_width = stroke_width
|
|
89
|
-
self.stroke_cap = stroke_cap
|
|
90
|
-
self.stroke_join = stroke_join
|
|
91
|
-
self.colors_stop = colors_stop
|
|
92
|
-
self.gradient_colors = gradient_colors
|
|
93
|
-
self.use_stroke_width_in_meter = use_stroke_width_in_meter
|
|
94
|
-
self.stroke_pattern = stroke_pattern
|
|
70
|
+
stroke_cap: ft.StrokeCap = ft.StrokeCap.ROUND
|
|
71
|
+
"""
|
|
72
|
+
Style to use for line endings.
|
|
73
|
+
"""
|
|
95
74
|
|
|
96
|
-
|
|
97
|
-
|
|
75
|
+
stroke_join: ft.StrokeJoin = ft.StrokeJoin.ROUND
|
|
76
|
+
"""
|
|
77
|
+
Style to use for line segment joins.
|
|
78
|
+
"""
|
|
98
79
|
|
|
99
80
|
def before_update(self):
|
|
100
81
|
super().before_update()
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
self._set_attr_json("gradientColors", self.__gradient_colors)
|
|
106
|
-
self._set_attr_json("strokePattern", self.__stroke_pattern)
|
|
107
|
-
|
|
108
|
-
# stroke_cap
|
|
109
|
-
@property
|
|
110
|
-
def stroke_cap(self) -> Optional[StrokeCap]:
|
|
111
|
-
return self.__stroke_cap
|
|
112
|
-
|
|
113
|
-
@stroke_cap.setter
|
|
114
|
-
def stroke_cap(self, value: Optional[StrokeCap]):
|
|
115
|
-
self.__stroke_cap = value
|
|
116
|
-
self._set_enum_attr("strokeCap", value, StrokeCap)
|
|
117
|
-
|
|
118
|
-
# gradient_colors
|
|
119
|
-
@property
|
|
120
|
-
def gradient_colors(self) -> Optional[List[str]]:
|
|
121
|
-
return self.__gradient_colors
|
|
122
|
-
|
|
123
|
-
@gradient_colors.setter
|
|
124
|
-
def gradient_colors(self, value: Optional[List[str]]):
|
|
125
|
-
self.__gradient_colors = value
|
|
126
|
-
|
|
127
|
-
# stroke_pattern
|
|
128
|
-
@property
|
|
129
|
-
def stroke_pattern(self) -> Optional[StrokePattern]:
|
|
130
|
-
return self.__stroke_pattern
|
|
131
|
-
|
|
132
|
-
@stroke_pattern.setter
|
|
133
|
-
def stroke_pattern(self, value: Optional[StrokePattern]):
|
|
134
|
-
self.__stroke_pattern = value
|
|
135
|
-
|
|
136
|
-
# colors_stop
|
|
137
|
-
@property
|
|
138
|
-
def colors_stop(self) -> Optional[List[Union[float, int]]]:
|
|
139
|
-
return self.__colors_stop
|
|
140
|
-
|
|
141
|
-
@colors_stop.setter
|
|
142
|
-
def colors_stop(self, value: Optional[List[Union[float, int]]]):
|
|
143
|
-
self.__colors_stop = value
|
|
144
|
-
|
|
145
|
-
# stroke_join
|
|
146
|
-
@property
|
|
147
|
-
def stroke_join(self) -> Optional[StrokeJoin]:
|
|
148
|
-
return self.__stroke_join
|
|
149
|
-
|
|
150
|
-
@stroke_join.setter
|
|
151
|
-
def stroke_join(self, value: Optional[StrokeJoin]):
|
|
152
|
-
self.__stroke_join = value
|
|
153
|
-
self._set_enum_attr("strokeJoin", value, StrokeJoin)
|
|
154
|
-
|
|
155
|
-
# use_stroke_width_in_meter
|
|
156
|
-
@property
|
|
157
|
-
def use_stroke_width_in_meter(self) -> bool:
|
|
158
|
-
return self._get_attr(
|
|
159
|
-
"useStrokeWidthInMeter", data_type="bool", def_value=False
|
|
160
|
-
)
|
|
161
|
-
|
|
162
|
-
@use_stroke_width_in_meter.setter
|
|
163
|
-
def use_stroke_width_in_meter(self, value: Optional[bool]):
|
|
164
|
-
self._set_attr("useStrokeWidthInMeter", value)
|
|
165
|
-
|
|
166
|
-
# color
|
|
167
|
-
@property
|
|
168
|
-
def color(self) -> Optional[ColorValue]:
|
|
169
|
-
return self.__color
|
|
170
|
-
|
|
171
|
-
@color.setter
|
|
172
|
-
def color(self, value: Optional[ColorValue]):
|
|
173
|
-
self.__color = value
|
|
174
|
-
self._set_enum_attr("color", value, ColorEnums)
|
|
175
|
-
|
|
176
|
-
# border_color
|
|
177
|
-
@property
|
|
178
|
-
def border_color(self) -> Optional[ColorValue]:
|
|
179
|
-
return self.__border_color
|
|
180
|
-
|
|
181
|
-
@border_color.setter
|
|
182
|
-
def border_color(self, value: Optional[ColorValue]):
|
|
183
|
-
self.__border_color = value
|
|
184
|
-
self._set_enum_attr("borderColor", value, ColorEnums)
|
|
185
|
-
|
|
186
|
-
# border_stroke_width
|
|
187
|
-
@property
|
|
188
|
-
def border_stroke_width(self) -> float:
|
|
189
|
-
return self._get_attr("borderStrokeWidth", data_type="float", def_value=0.0)
|
|
190
|
-
|
|
191
|
-
@border_stroke_width.setter
|
|
192
|
-
def border_stroke_width(self, value: OptionalNumber):
|
|
193
|
-
assert value is None or value >= 0, "border_stroke_width cannot be negative"
|
|
194
|
-
self._set_attr("borderStrokeWidth", value)
|
|
195
|
-
|
|
196
|
-
# stroke_width
|
|
197
|
-
@property
|
|
198
|
-
def stroke_width(self) -> float:
|
|
199
|
-
return self._get_attr("strokeWidth", data_type="float", def_value=1.0)
|
|
200
|
-
|
|
201
|
-
@stroke_width.setter
|
|
202
|
-
def stroke_width(self, value: OptionalNumber):
|
|
203
|
-
assert value is None or value >= 0, "stroke_width cannot be negative"
|
|
204
|
-
self._set_attr("strokeWidth", value)
|
|
205
|
-
|
|
206
|
-
# coordinates
|
|
207
|
-
@property
|
|
208
|
-
def coordinates(self) -> List[MapLatitudeLongitude]:
|
|
209
|
-
return self.__coordinates
|
|
210
|
-
|
|
211
|
-
@coordinates.setter
|
|
212
|
-
def coordinates(self, value: List[MapLatitudeLongitude]):
|
|
213
|
-
self.__coordinates = value
|
|
82
|
+
assert (
|
|
83
|
+
self.border_stroke_width >= 0
|
|
84
|
+
), "border_stroke_width must be greater than or equal to 0"
|
|
85
|
+
assert self.stroke_width >= 0, "stroke_width must be greater than or equal to 0"
|
|
214
86
|
|
|
215
87
|
|
|
88
|
+
@ft.control("PolylineLayer")
|
|
216
89
|
class PolylineLayer(MapLayer):
|
|
217
90
|
"""
|
|
218
|
-
A layer to display
|
|
219
|
-
|
|
220
|
-
-----
|
|
221
|
-
|
|
222
|
-
Online docs: https://flet.dev/docs/controls/mappolylinelayer
|
|
91
|
+
A layer to display [`PolylineMarker`][(p).]s.
|
|
223
92
|
"""
|
|
224
93
|
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
min_hittable_radius: OptionalNumber = None,
|
|
230
|
-
simplify_tolerance: OptionalNumber = None,
|
|
231
|
-
#
|
|
232
|
-
# MapLayer
|
|
233
|
-
#
|
|
234
|
-
ref: Optional[Ref] = None,
|
|
235
|
-
visible: Optional[bool] = None,
|
|
236
|
-
data: Any = None,
|
|
237
|
-
):
|
|
238
|
-
MapLayer.__init__(
|
|
239
|
-
self,
|
|
240
|
-
ref=ref,
|
|
241
|
-
visible=visible,
|
|
242
|
-
data=data,
|
|
243
|
-
)
|
|
244
|
-
|
|
245
|
-
self.polylines = polylines
|
|
246
|
-
self.culling_margin = culling_margin
|
|
247
|
-
self.min_hittable_radius = min_hittable_radius
|
|
248
|
-
self.simplify_tolerance = simplify_tolerance
|
|
249
|
-
|
|
250
|
-
def _get_control_name(self):
|
|
251
|
-
return "map_polyline_layer"
|
|
252
|
-
|
|
253
|
-
def _get_children(self):
|
|
254
|
-
return self.__polylines
|
|
255
|
-
|
|
256
|
-
# polylines
|
|
257
|
-
@property
|
|
258
|
-
def polylines(self) -> List[PolylineMarker]:
|
|
259
|
-
return self.__polylines
|
|
260
|
-
|
|
261
|
-
@polylines.setter
|
|
262
|
-
def polylines(self, value: List[PolylineMarker]):
|
|
263
|
-
self.__polylines = value
|
|
264
|
-
|
|
265
|
-
# culling_margin
|
|
266
|
-
@property
|
|
267
|
-
def culling_margin(self) -> float:
|
|
268
|
-
return self._get_attr("cullingMargin", data_type="float", def_value=10.0)
|
|
269
|
-
|
|
270
|
-
@culling_margin.setter
|
|
271
|
-
def culling_margin(self, value: OptionalNumber):
|
|
272
|
-
self._set_attr("cullingMargin", value)
|
|
273
|
-
|
|
274
|
-
# simplification_tolerance
|
|
275
|
-
@property
|
|
276
|
-
def simplification_tolerance(self) -> float:
|
|
277
|
-
return self._get_attr(
|
|
278
|
-
"simplificationTolerance", data_type="float", def_value=0.4
|
|
279
|
-
)
|
|
94
|
+
polylines: list[PolylineMarker]
|
|
95
|
+
"""
|
|
96
|
+
List of [`PolylineMarker`][(p).]s to be drawn.
|
|
97
|
+
"""
|
|
280
98
|
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
99
|
+
culling_margin: ft.Number = 10.0
|
|
100
|
+
"""
|
|
101
|
+
Acceptable extent outside of viewport before culling polyline segments.
|
|
102
|
+
"""
|
|
284
103
|
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
104
|
+
min_hittable_radius: ft.Number = 10.0
|
|
105
|
+
"""
|
|
106
|
+
The minimum radius of the hittable area around each polyline in logical pixels.
|
|
107
|
+
|
|
108
|
+
The entire visible area is always hittable, but if the visible area is
|
|
109
|
+
smaller than this, then this will be the hittable area.
|
|
110
|
+
"""
|
|
289
111
|
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
112
|
+
simplification_tolerance: ft.Number = 0.3
|
|
113
|
+
"""
|
|
114
|
+
|
|
115
|
+
"""
|
flet_map/rich_attribution.py
CHANGED
|
@@ -1,141 +1,63 @@
|
|
|
1
|
-
from
|
|
2
|
-
from typing import
|
|
1
|
+
from dataclasses import field
|
|
2
|
+
from typing import List, Optional
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
from flet.core.control import OptionalNumber
|
|
6
|
-
from flet_map.map_layer import MapLayer
|
|
7
|
-
from flet_map.text_source_attribution import TextSourceAttribution
|
|
8
|
-
from flet.core.ref import Ref
|
|
9
|
-
from flet.core.types import ColorEnums, ColorValue
|
|
4
|
+
import flet as ft
|
|
10
5
|
|
|
6
|
+
from .map_layer import MapLayer
|
|
7
|
+
from .source_attribution import SourceAttribution
|
|
8
|
+
from .types import AttributionAlignment
|
|
11
9
|
|
|
12
|
-
|
|
13
|
-
BOTTOM_LEFT = "bottomLeft"
|
|
14
|
-
BOTTOM_RIGHT = "bottomRight"
|
|
10
|
+
__all__ = ["RichAttribution"]
|
|
15
11
|
|
|
16
12
|
|
|
13
|
+
@ft.control("RichAttribution")
|
|
17
14
|
class RichAttribution(MapLayer):
|
|
18
15
|
"""
|
|
19
|
-
An animated and interactive attribution layer that supports both
|
|
20
|
-
(displayed in a popup controlled by an icon button adjacent to the
|
|
21
|
-
|
|
22
|
-
-----
|
|
23
|
-
|
|
24
|
-
Online docs: https://flet.dev/docs/controls/maprichattribution
|
|
16
|
+
An animated and interactive attribution layer that supports both images and text
|
|
17
|
+
(displayed in a popup controlled by an icon button adjacent to the images).
|
|
25
18
|
"""
|
|
26
19
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
permanent_height: OptionalNumber = None,
|
|
35
|
-
show_flutter_map_attribution: Optional[bool] = None,
|
|
36
|
-
#
|
|
37
|
-
# MapLayer
|
|
38
|
-
#
|
|
39
|
-
ref: Optional[Ref] = None,
|
|
40
|
-
visible: Optional[bool] = None,
|
|
41
|
-
data: Any = None,
|
|
42
|
-
):
|
|
43
|
-
|
|
44
|
-
MapLayer.__init__(
|
|
45
|
-
self,
|
|
46
|
-
ref=ref,
|
|
47
|
-
visible=visible,
|
|
48
|
-
data=data,
|
|
49
|
-
)
|
|
50
|
-
|
|
51
|
-
self.attributions = attributions
|
|
52
|
-
self.alignment = alignment
|
|
53
|
-
self.popup_bgcolor = popup_bgcolor
|
|
54
|
-
self.permanent_height = permanent_height
|
|
55
|
-
self.show_flutter_map_attribution = show_flutter_map_attribution
|
|
56
|
-
self.popup_border_radius = popup_border_radius
|
|
57
|
-
self.popup_initial_display_duration = popup_initial_display_duration
|
|
58
|
-
|
|
59
|
-
def _get_control_name(self):
|
|
60
|
-
return "map_rich_attribution"
|
|
61
|
-
|
|
62
|
-
def _get_children(self):
|
|
63
|
-
return self.attributions
|
|
64
|
-
|
|
65
|
-
def before_update(self):
|
|
66
|
-
super().before_update()
|
|
67
|
-
self._set_attr_json("popupBorderRadius", self.__popup_border_radius)
|
|
68
|
-
self._set_attr_json("alignment", self.__alignment)
|
|
69
|
-
|
|
70
|
-
# permanent_height
|
|
71
|
-
@property
|
|
72
|
-
def permanent_height(self) -> float:
|
|
73
|
-
return self._get_attr("permanentHeight", data_type="float", def_value=24.0)
|
|
74
|
-
|
|
75
|
-
@permanent_height.setter
|
|
76
|
-
def permanent_height(self, value: OptionalNumber):
|
|
77
|
-
assert value is None or value >= 0, "permanent_height cannot be negative"
|
|
78
|
-
self._set_attr("permanentHeight", value)
|
|
79
|
-
|
|
80
|
-
# popup_initial_display_duration
|
|
81
|
-
@property
|
|
82
|
-
def popup_initial_display_duration(self) -> int:
|
|
83
|
-
return self._get_attr(
|
|
84
|
-
"popupInitialDisplayDuration", data_type="int", def_value=0
|
|
85
|
-
)
|
|
86
|
-
|
|
87
|
-
@popup_initial_display_duration.setter
|
|
88
|
-
def popup_initial_display_duration(self, value: Optional[int]):
|
|
89
|
-
assert (
|
|
90
|
-
value is None or value >= 0
|
|
91
|
-
), "popup_initial_display_duration cannot be negative"
|
|
92
|
-
self._set_attr("popupInitialDisplayDuration", value)
|
|
93
|
-
|
|
94
|
-
# popup_border_radius
|
|
95
|
-
@property
|
|
96
|
-
def popup_border_radius(self) -> Optional[BorderRadius]:
|
|
97
|
-
return self.__popup_border_radius
|
|
98
|
-
|
|
99
|
-
@popup_border_radius.setter
|
|
100
|
-
def popup_border_radius(self, value: Optional[BorderRadius]):
|
|
101
|
-
self.__popup_border_radius = value
|
|
102
|
-
|
|
103
|
-
# alignment
|
|
104
|
-
@property
|
|
105
|
-
def alignment(self) -> Optional[AttributionAlignment]:
|
|
106
|
-
return self.__alignment
|
|
107
|
-
|
|
108
|
-
@alignment.setter
|
|
109
|
-
def alignment(self, value: Optional[AttributionAlignment]):
|
|
110
|
-
self.__alignment = value
|
|
111
|
-
self._set_enum_attr("alignment", value, AttributionAlignment)
|
|
20
|
+
attributions: List[SourceAttribution]
|
|
21
|
+
"""
|
|
22
|
+
List of attributions to display.
|
|
23
|
+
|
|
24
|
+
[`TextSourceAttribution`][(p).]s are shown in a popup box,
|
|
25
|
+
unlike [`ImageSourceAttribution`][(p).], which are visible permanently.
|
|
26
|
+
"""
|
|
112
27
|
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
"showFlutterMapAttribution", data_type="bool", def_value=True
|
|
118
|
-
)
|
|
28
|
+
alignment: Optional[AttributionAlignment] = None
|
|
29
|
+
"""
|
|
30
|
+
The position in which to anchor this attribution control.
|
|
31
|
+
"""
|
|
119
32
|
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
33
|
+
popup_bgcolor: Optional[ft.ColorValue] = ft.Colors.SURFACE
|
|
34
|
+
"""
|
|
35
|
+
The color to use as the popup box's background color.
|
|
36
|
+
"""
|
|
123
37
|
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
38
|
+
popup_border_radius: Optional[ft.BorderRadiusValue] = None
|
|
39
|
+
"""
|
|
40
|
+
The radius of the edges of the popup box.
|
|
41
|
+
"""
|
|
128
42
|
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
43
|
+
popup_initial_display_duration: ft.DurationValue = field(
|
|
44
|
+
default_factory=lambda: ft.Duration()
|
|
45
|
+
)
|
|
46
|
+
"""
|
|
47
|
+
The popup box will be open by default and be hidden this long after the map is initialised.
|
|
48
|
+
|
|
49
|
+
This is useful with certain sources/tile servers that make immediate
|
|
50
|
+
attribution mandatory and are not attributed with a permanently visible [`ImageSourceAttribution`][(p).].
|
|
51
|
+
"""
|
|
133
52
|
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
53
|
+
permanent_height: ft.Number = 24.0
|
|
54
|
+
"""
|
|
55
|
+
The height of the permanent row in which is found the popup menu toggle button.
|
|
56
|
+
Also determines spacing between the items within the row.
|
|
57
|
+
"""
|
|
138
58
|
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
59
|
+
show_flutter_map_attribution: bool = True
|
|
60
|
+
"""
|
|
61
|
+
Whether to add an additional attribution logo and text for [`flutter-map`](https://docs.fleaflet.dev/),
|
|
62
|
+
on which 'flet-map' package is based for map-renderings.
|
|
63
|
+
"""
|
flet_map/simple_attribution.py
CHANGED
|
@@ -1,86 +1,35 @@
|
|
|
1
|
-
from
|
|
1
|
+
from dataclasses import field
|
|
2
|
+
from typing import Union
|
|
2
3
|
|
|
3
|
-
|
|
4
|
-
from flet_map.map_layer import MapLayer
|
|
5
|
-
from flet.core.ref import Ref
|
|
6
|
-
from flet.core.types import ColorEnums, ColorValue, OptionalControlEventCallable
|
|
4
|
+
import flet as ft
|
|
7
5
|
|
|
6
|
+
from .map_layer import MapLayer
|
|
8
7
|
|
|
8
|
+
__all__ = ["SimpleAttribution"]
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
@ft.control("SimpleAttribution")
|
|
9
12
|
class SimpleAttribution(MapLayer):
|
|
10
13
|
"""
|
|
11
14
|
A simple attribution layer displayed on the Map.
|
|
12
|
-
|
|
13
|
-
-----
|
|
14
|
-
|
|
15
|
-
Online docs: https://flet.dev/docs/controls/mapsimpleattribution
|
|
16
15
|
"""
|
|
17
16
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
#
|
|
25
|
-
# MapLayer
|
|
26
|
-
#
|
|
27
|
-
ref: Optional[Ref] = None,
|
|
28
|
-
visible: Optional[bool] = None,
|
|
29
|
-
data: Any = None,
|
|
30
|
-
):
|
|
31
|
-
|
|
32
|
-
MapLayer.__init__(
|
|
33
|
-
self,
|
|
34
|
-
ref=ref,
|
|
35
|
-
visible=visible,
|
|
36
|
-
data=data,
|
|
37
|
-
)
|
|
38
|
-
|
|
39
|
-
self.text = text
|
|
40
|
-
self.alignment = alignment
|
|
41
|
-
self.bgcolor = bgcolor
|
|
42
|
-
self.on_click = on_click
|
|
43
|
-
|
|
44
|
-
def _get_control_name(self):
|
|
45
|
-
return "map_simple_attribution"
|
|
46
|
-
|
|
47
|
-
def before_update(self):
|
|
48
|
-
super().before_update()
|
|
49
|
-
self._set_attr_json("alignment", self.__alignment)
|
|
50
|
-
|
|
51
|
-
# alignment
|
|
52
|
-
@property
|
|
53
|
-
def alignment(self) -> Optional[Alignment]:
|
|
54
|
-
return self.__alignment
|
|
55
|
-
|
|
56
|
-
@alignment.setter
|
|
57
|
-
def alignment(self, value: Optional[Alignment]):
|
|
58
|
-
self.__alignment = value
|
|
59
|
-
|
|
60
|
-
# bgcolor
|
|
61
|
-
@property
|
|
62
|
-
def bgcolor(self) -> Optional[ColorValue]:
|
|
63
|
-
return self.__bgcolor
|
|
64
|
-
|
|
65
|
-
@bgcolor.setter
|
|
66
|
-
def bgcolor(self, value: Optional[ColorValue]):
|
|
67
|
-
self.__bgcolor = value
|
|
68
|
-
self._set_enum_attr("bgcolor", value, ColorEnums)
|
|
69
|
-
|
|
70
|
-
# text
|
|
71
|
-
@property
|
|
72
|
-
def text(self) -> str:
|
|
73
|
-
return self._get_attr("text")
|
|
17
|
+
text: Union[str, ft.Text]
|
|
18
|
+
"""
|
|
19
|
+
The attribution message to be displayed.
|
|
20
|
+
|
|
21
|
+
Value is of type `str` and `ft.Text`.
|
|
22
|
+
"""
|
|
74
23
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
24
|
+
alignment: ft.Alignment = field(default_factory=lambda: ft.Alignment.bottom_right())
|
|
25
|
+
"""
|
|
26
|
+
The alignment of this attribution on the map.
|
|
27
|
+
"""
|
|
78
28
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
29
|
+
bgcolor: ft.ColorValue = ft.Colors.SURFACE
|
|
30
|
+
"""
|
|
31
|
+
The color of the box containing the `text`.
|
|
32
|
+
"""
|
|
83
33
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
self._add_event_handler("click", handler)
|
|
34
|
+
on_click: ft.OptionalControlEventHandler["SimpleAttribution"] = None
|
|
35
|
+
"""Fired when this attribution is clicked/pressed."""
|