flet-map 0.2.0.dev46__py3-none-any.whl → 0.2.0.dev63__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/marker_layer.py CHANGED
@@ -1,10 +1,10 @@
1
1
  from dataclasses import field
2
- from typing import List, Optional
2
+ from typing import Optional
3
3
 
4
4
  import flet as ft
5
5
 
6
- from .map_layer import MapLayer
7
- from .types import MapLatitudeLongitude
6
+ from flet_map.map_layer import MapLayer
7
+ from flet_map.types import MapLatitudeLongitude
8
8
 
9
9
  __all__ = ["Marker", "MarkerLayer"]
10
10
 
@@ -12,16 +12,18 @@ __all__ = ["Marker", "MarkerLayer"]
12
12
  @ft.control("Marker")
13
13
  class Marker(ft.Control):
14
14
  """
15
- A marker displayed on the Map at the specified location through the [`MarkerLayer`][(p).].
15
+ A marker displayed on the Map at the specified location
16
+ through the [`MarkerLayer`][(p).].
16
17
 
17
18
  Raises:
18
- AssertionError: If the [`content`][(c).] is not visible, or if [`height`][(c).] or [`width`][(c).] are negative.
19
+ AssertionError: If the [`content`][(c).] is not visible, or
20
+ if [`height`][(c).] or [`width`][(c).] are negative.
19
21
  """
20
22
 
21
23
  content: ft.Control
22
24
  """
23
25
  The content to be displayed at [`coordinates`][..].
24
-
26
+
25
27
  Note:
26
28
  Must be provided and visible.
27
29
  """
@@ -29,24 +31,29 @@ class Marker(ft.Control):
29
31
  coordinates: MapLatitudeLongitude
30
32
  """
31
33
  The coordinates of the marker.
32
-
33
- This will be the center of the marker, if `alignment=ft.Alignment.center()`.
34
+
35
+ This will be the center of the marker,
36
+ if [`alignment`][..] is [`Alignment.CENTER`][flet.Alignment.CENTER].
34
37
  """
35
38
 
36
39
  rotate: Optional[bool] = None
37
40
  """
38
- Whether to counter rotate this marker to the map's rotation, to keep a fixed orientation.
39
- So, when `True`, this marker will always appear upright and vertical from the user's perspective.
40
-
41
- Note: this is not used to apply a custom rotation in degrees to the marker.
42
-
43
- Defaults to the value of the parent [`MarkerLayer.rotate`][(p).].
41
+ Whether to counter rotate this marker to the map's rotation,
42
+ to keep a fixed orientation.
43
+ So, when `True`, this marker will always appear upright and
44
+ vertical from the user's perspective.
45
+
46
+ If `None`, defaults to the value of the parent [`MarkerLayer.rotate`][(p).].
47
+
48
+ Note:
49
+ This is not used to apply a custom rotation in degrees to this marker.
50
+
44
51
  """
45
52
 
46
53
  height: ft.Number = 30.0
47
54
  """
48
55
  The height of the [`content`][..] Control.
49
-
56
+
50
57
  Note:
51
58
  Must be non-negative.
52
59
  """
@@ -54,7 +61,7 @@ class Marker(ft.Control):
54
61
  width: ft.Number = 30.0
55
62
  """
56
63
  The width of the [`content`][..] Control.
57
-
64
+
58
65
  Note:
59
66
  Must be non-negative.
60
67
  """
@@ -62,15 +69,19 @@ class Marker(ft.Control):
62
69
  alignment: Optional[ft.Alignment] = None
63
70
  """
64
71
  Alignment of the marker relative to the normal center at [`coordinates`][..].
65
-
66
- Defaults to the value of the parent [`MarkerLayer.alignment`][(m).].
72
+
73
+ Defaults to the value of the parent [`MarkerLayer.alignment`][(p).].
67
74
  """
68
75
 
69
76
  def before_update(self):
70
77
  super().before_update()
71
78
  assert self.content.visible, "content must be visible"
72
- assert self.height >= 0, "height must be greater than or equal to 0"
73
- assert self.width >= 0, "width must be greater than or equal to 0"
79
+ assert self.height >= 0, (
80
+ f"height must be greater than or equal to 0, got {self.height}"
81
+ )
82
+ assert self.width >= 0, (
83
+ f"width must be greater than or equal to 0, got {self.width}"
84
+ )
74
85
 
75
86
 
76
87
  @ft.control("MarkerLayer")
@@ -79,19 +90,21 @@ class MarkerLayer(MapLayer):
79
90
  A layer to display Markers.
80
91
  """
81
92
 
82
- markers: List[Marker]
93
+ markers: list[Marker]
83
94
  """
84
- List of [`Marker`][(m).]s to display.
95
+ A list of [`Marker`][(m).]s to display.
85
96
  """
86
97
 
87
98
  alignment: Optional[ft.Alignment] = field(
88
- default_factory=lambda: ft.Alignment.center()
99
+ default_factory=lambda: ft.Alignment.CENTER
89
100
  )
90
101
  """
91
- Alignment of each marker relative to its normal center at `Marker.coordinates`.
102
+ The alignment of each marker relative to its normal center at
103
+ [`Marker.coordinates`][(m).].
92
104
  """
93
105
 
94
106
  rotate: bool = False
95
107
  """
96
- Whether to counter-rotate `markers` to the map's rotation, to keep a fixed orientation.
108
+ Whether to counter-rotate `markers` to the map's rotation,
109
+ to keep a fixed orientation.
97
110
  """
flet_map/polygon_layer.py CHANGED
@@ -1,11 +1,11 @@
1
- from typing import List, Optional
1
+ from typing import Optional
2
2
 
3
3
  import flet as ft
4
4
 
5
- from .map_layer import MapLayer
6
- from .types import MapLatitudeLongitude
5
+ from flet_map.map_layer import MapLayer
6
+ from flet_map.types import MapLatitudeLongitude
7
7
 
8
- __all__ = ["PolygonMarker", "PolygonLayer"]
8
+ __all__ = ["PolygonLayer", "PolygonMarker"]
9
9
 
10
10
 
11
11
  @ft.control("PolygonMarker")
@@ -14,7 +14,7 @@ class PolygonMarker(ft.Control):
14
14
  A marker for the [`PolygonLayer`][(p).].
15
15
  """
16
16
 
17
- coordinates: List[MapLatitudeLongitude]
17
+ coordinates: list[MapLatitudeLongitude]
18
18
  """
19
19
  The points for the outline of this polygon.
20
20
  """
@@ -47,7 +47,7 @@ class PolygonMarker(ft.Control):
47
47
  border_stroke_width: ft.Number = 0.0
48
48
  """
49
49
  The width of the border outline.
50
-
50
+
51
51
  Note:
52
52
  Must be non-negative.
53
53
  """
@@ -59,7 +59,7 @@ class PolygonMarker(ft.Control):
59
59
 
60
60
  rotate_label: bool = False
61
61
  """
62
- Whether to rotate the label counter to the camera's rotation,
62
+ Whether to rotate the label counter to the camera's rotation,
63
63
  to ensure it remains upright.
64
64
  """
65
65
 
@@ -75,9 +75,10 @@ class PolygonMarker(ft.Control):
75
75
 
76
76
  def before_update(self):
77
77
  super().before_update()
78
- assert (
79
- self.border_stroke_width >= 0
80
- ), "border_stroke_width must be greater than or equal to 0"
78
+ assert self.border_stroke_width >= 0, (
79
+ f"border_stroke_width must be greater than or equal to 0, "
80
+ f"got {self.border_stroke_width}"
81
+ )
81
82
 
82
83
 
83
84
  @ft.control("PolygonLayer")
@@ -86,7 +87,7 @@ class PolygonLayer(MapLayer):
86
87
  A layer to display PolygonMarkers.
87
88
  """
88
89
 
89
- polygons: List[PolygonMarker]
90
+ polygons: list[PolygonMarker]
90
91
  """
91
92
  A list of [`PolygonMarker`][(p).]s to display.
92
93
  """
@@ -108,14 +109,14 @@ class PolygonLayer(MapLayer):
108
109
 
109
110
  simplification_tolerance: ft.Number = 0.3
110
111
  """
111
-
112
+
112
113
  """
113
114
 
114
115
  use_alternative_rendering: bool = False
115
116
  """
116
117
  Whether to use an alternative rendering pathway to draw polygons onto the
117
- underlying `Canvas`, which can be more performant in 'some' circumstances.
118
-
118
+ underlying `Canvas`, which can be more performant in 'some' circumstances.
119
+
119
120
  This will not always improve performance, and there are other important
120
121
  considerations before enabling it. It is intended for use when prior
121
122
  profiling indicates more performance is required after other methods are
@@ -3,10 +3,10 @@ from typing import Optional
3
3
 
4
4
  import flet as ft
5
5
 
6
- from .map_layer import MapLayer
7
- from .types import MapLatitudeLongitude, SolidStrokePattern, StrokePattern
6
+ from flet_map.map_layer import MapLayer
7
+ from flet_map.types import MapLatitudeLongitude, SolidStrokePattern, StrokePattern
8
8
 
9
- __all__ = ["PolylineMarker", "PolylineLayer"]
9
+ __all__ = ["PolylineLayer", "PolylineMarker"]
10
10
 
11
11
 
12
12
  @ft.control("PolylineMarker")
@@ -43,7 +43,7 @@ class PolylineMarker(ft.Control):
43
43
  stroke_width: ft.Number = 1.0
44
44
  """
45
45
  The width of the stroke.
46
-
46
+
47
47
  Note:
48
48
  Must be non-negative.
49
49
  """
@@ -51,7 +51,7 @@ class PolylineMarker(ft.Control):
51
51
  border_stroke_width: ft.Number = 0.0
52
52
  """
53
53
  The width of the stroke with of the line border.
54
-
54
+
55
55
  Note:
56
56
  Must be non-negative.
57
57
  """
@@ -79,10 +79,13 @@ class PolylineMarker(ft.Control):
79
79
 
80
80
  def before_update(self):
81
81
  super().before_update()
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"
82
+ assert self.border_stroke_width >= 0, (
83
+ f"border_stroke_width must be greater than or equal to 0, "
84
+ f"got {self.border_stroke_width}"
85
+ )
86
+ assert self.stroke_width >= 0, (
87
+ f"stroke_width must be greater than or equal to 0, got {self.stroke_width}"
88
+ )
86
89
 
87
90
 
88
91
  @ft.control("PolylineLayer")
@@ -93,7 +96,7 @@ class PolylineLayer(MapLayer):
93
96
 
94
97
  polylines: list[PolylineMarker]
95
98
  """
96
- List of [`PolylineMarker`][(p).]s to be drawn.
99
+ List of [`PolylineMarker`][(p).]s to be drawn.
97
100
  """
98
101
 
99
102
  culling_margin: ft.Number = 10.0
@@ -104,12 +107,12 @@ class PolylineLayer(MapLayer):
104
107
  min_hittable_radius: ft.Number = 10.0
105
108
  """
106
109
  The minimum radius of the hittable area around each polyline in logical pixels.
107
-
110
+
108
111
  The entire visible area is always hittable, but if the visible area is
109
112
  smaller than this, then this will be the hittable area.
110
113
  """
111
114
 
112
115
  simplification_tolerance: ft.Number = 0.3
113
116
  """
114
-
117
+
115
118
  """
@@ -1,11 +1,11 @@
1
1
  from dataclasses import field
2
- from typing import List, Optional
2
+ from typing import Optional
3
3
 
4
4
  import flet as ft
5
5
 
6
- from .map_layer import MapLayer
7
- from .source_attribution import SourceAttribution
8
- from .types import AttributionAlignment
6
+ from flet_map.map_layer import MapLayer
7
+ from flet_map.source_attribution import SourceAttribution
8
+ from flet_map.types import AttributionAlignment
9
9
 
10
10
  __all__ = ["RichAttribution"]
11
11
 
@@ -17,11 +17,11 @@ class RichAttribution(MapLayer):
17
17
  (displayed in a popup controlled by an icon button adjacent to the images).
18
18
  """
19
19
 
20
- attributions: List[SourceAttribution]
20
+ attributions: list[SourceAttribution]
21
21
  """
22
22
  List of attributions to display.
23
-
24
- [`TextSourceAttribution`][(p).]s are shown in a popup box,
23
+
24
+ [`TextSourceAttribution`][(p).]s are shown in a popup box,
25
25
  unlike [`ImageSourceAttribution`][(p).], which are visible permanently.
26
26
  """
27
27
 
@@ -44,10 +44,12 @@ class RichAttribution(MapLayer):
44
44
  default_factory=lambda: ft.Duration()
45
45
  )
46
46
  """
47
- The popup box will be open by default and be hidden this long after the map is initialised.
48
-
47
+ The popup box will be open by default and be hidden this
48
+ long after the map is initialised.
49
+
49
50
  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
+ attribution mandatory and are not attributed with a permanently
52
+ visible [`ImageSourceAttribution`][(p).].
51
53
  """
52
54
 
53
55
  permanent_height: ft.Number = 24.0
@@ -58,6 +60,7 @@ class RichAttribution(MapLayer):
58
60
 
59
61
  show_flutter_map_attribution: bool = True
60
62
  """
61
- Whether to add an additional attribution logo and text for [`flutter-map`](https://docs.fleaflet.dev/),
63
+ Whether to add an additional attribution logo and text
64
+ for [`flutter-map`](https://docs.fleaflet.dev/),
62
65
  on which 'flet-map' package is based for map-renderings.
63
66
  """
@@ -1,9 +1,9 @@
1
1
  from dataclasses import field
2
- from typing import Union
2
+ from typing import Optional, Union
3
3
 
4
4
  import flet as ft
5
5
 
6
- from .map_layer import MapLayer
6
+ from flet_map.map_layer import MapLayer
7
7
 
8
8
  __all__ = ["SimpleAttribution"]
9
9
 
@@ -17,19 +17,17 @@ class SimpleAttribution(MapLayer):
17
17
  text: Union[str, ft.Text]
18
18
  """
19
19
  The attribution message to be displayed.
20
-
21
- Value is of type `str` and `ft.Text`.
22
20
  """
23
21
 
24
- alignment: ft.Alignment = field(default_factory=lambda: ft.Alignment.bottom_right())
22
+ alignment: ft.Alignment = field(default_factory=lambda: ft.Alignment.BOTTOM_RIGHT)
25
23
  """
26
24
  The alignment of this attribution on the map.
27
25
  """
28
26
 
29
27
  bgcolor: ft.ColorValue = ft.Colors.SURFACE
30
28
  """
31
- The color of the box containing the `text`.
29
+ The color of the box containing the [`text`][..].
32
30
  """
33
31
 
34
- on_click: ft.OptionalControlEventHandler["SimpleAttribution"] = None
32
+ on_click: Optional[ft.ControlEventHandler["SimpleAttribution"]] = None
35
33
  """Fired when this attribution is clicked/pressed."""
@@ -6,7 +6,7 @@ import flet as ft
6
6
  __all__ = ["ImageSourceAttribution", "SourceAttribution", "TextSourceAttribution"]
7
7
 
8
8
 
9
- @dataclass(kw_only=True)
9
+ @dataclass
10
10
  class SourceAttribution(ft.BaseControl):
11
11
  """
12
12
  Abstract class for source attribution controls:
@@ -19,8 +19,10 @@ class SourceAttribution(ft.BaseControl):
19
19
  @ft.control("ImageSourceAttribution")
20
20
  class ImageSourceAttribution(SourceAttribution):
21
21
  """
22
- An image attribution permanently displayed adjacent to the open/close icon of a [`RichAttribution`][(p).] control.
23
- For it to be displayed, it should be part of a [`RichAttribution.attributions`][(p).] list.
22
+ An image attribution permanently displayed adjacent to the
23
+ open/close icon of a [`RichAttribution`][(p).] control.
24
+ For it to be displayed, it should be part of a
25
+ [`RichAttribution.attributions`][(p).] list.
24
26
 
25
27
  Raises:
26
28
  AssertionError: If the [`image`][(c).] is not visible.
@@ -29,7 +31,7 @@ class ImageSourceAttribution(SourceAttribution):
29
31
  image: ft.Image
30
32
  """
31
33
  The `Image` to be displayed.
32
-
34
+
33
35
  Note:
34
36
  Must be provided and visible.
35
37
  """
@@ -37,13 +39,14 @@ class ImageSourceAttribution(SourceAttribution):
37
39
  height: ft.Number = 24.0
38
40
  """
39
41
  The height of the image.
40
- Should be the same as [`RichAttribution.permanent_height`][(p).], otherwise layout issues may occur.
42
+ Should be the same as [`RichAttribution.permanent_height`][(p).],
43
+ otherwise layout issues may occur.
41
44
  """
42
45
 
43
46
  tooltip: Optional[str] = None
44
47
  """Tooltip text to be displayed when the image is hovered over."""
45
48
 
46
- on_click: ft.OptionalControlEventHandler["ImageSourceAttribution"] = None
49
+ on_click: Optional[ft.ControlEventHandler["ImageSourceAttribution"]] = None
47
50
  """Fired when this attribution is clicked/pressed."""
48
51
 
49
52
  def before_update(self):
@@ -55,7 +58,8 @@ class ImageSourceAttribution(SourceAttribution):
55
58
  class TextSourceAttribution(SourceAttribution):
56
59
  """
57
60
  A text source attribution displayed on the Map.
58
- For it to be displayed, it should be part of a [`RichAttribution.attributions`][(p).] list.
61
+ For it to be displayed, it should be part of a
62
+ [`RichAttribution.attributions`][(p).] list.
59
63
  """
60
64
 
61
65
  text: str
@@ -69,5 +73,5 @@ class TextSourceAttribution(SourceAttribution):
69
73
  Whether to add the '©' character to the start of [`text`][..] automatically.
70
74
  """
71
75
 
72
- on_click: ft.OptionalControlEventHandler["TextSourceAttribution"] = None
76
+ on_click: Optional[ft.ControlEventHandler["TextSourceAttribution"]] = None
73
77
  """Fired when this attribution is clicked/pressed."""
flet_map/tile_layer.py CHANGED
@@ -1,10 +1,10 @@
1
1
  from dataclasses import field
2
- from typing import Dict, List, Optional
2
+ from typing import Optional
3
3
 
4
4
  import flet as ft
5
5
 
6
- from .map_layer import MapLayer
7
- from .types import (
6
+ from flet_map.map_layer import MapLayer
7
+ from flet_map.types import (
8
8
  FadeInTileDisplay,
9
9
  MapLatitudeLongitudeBounds,
10
10
  TileDisplay,
@@ -20,17 +20,20 @@ class TileLayer(MapLayer):
20
20
  Displays square raster images in a continuous grid,
21
21
  sourced from the provided [`url_template`][(c).] and [`fallback_url`][(c).].
22
22
 
23
- Typically the first layer to be added to a [`Map`][(p).], as it provides the tiles on which
23
+ Typically the first layer to be added to a [`Map`][(p).],
24
+ as it provides the tiles on which
24
25
  other layers are displayed.
25
26
 
26
27
  Raises:
27
28
  AssertionError: If one or more of the following is negative:
28
- [`tile_size`][(c).], [`min_native_zoom`][(c).], [`max_native_zoom`][(c).], [`zoom_offset`][(c).], [`max_zoom`][(c).], [`min_zoom`][(c).]
29
+ [`tile_size`][(c).], [`min_native_zoom`][(c).],
30
+ [`max_native_zoom`][(c).], [`zoom_offset`][(c).],
31
+ [`max_zoom`][(c).], [`min_zoom`][(c).]
29
32
  """
30
33
 
31
34
  url_template: str
32
35
  """
33
- The URL template is a string that contains placeholders,
36
+ The URL template is a string that contains placeholders,
34
37
  which, when filled in, create a URL/URI to a specific tile.
35
38
  """
36
39
 
@@ -38,20 +41,21 @@ class TileLayer(MapLayer):
38
41
  """
39
42
  Fallback URL template, used if an error occurs when fetching tiles from
40
43
  the [`url_template`][..].
41
-
44
+
42
45
  Note that specifying this (non-none) will result in tiles not being cached
43
46
  in memory. This is to avoid issues where the [`url_template`][..] is flaky, to
44
47
  prevent different tilesets being displayed at the same time.
45
-
46
- It is expected that this follows the same retina support behaviour as [`url_template`][..].
48
+
49
+ It is expected that this follows the same retina support behaviour
50
+ as [`url_template`][..].
47
51
  """
48
52
 
49
- subdomains: List[str] = field(default_factory=lambda: ["a", "b", "c"])
53
+ subdomains: list[str] = field(default_factory=lambda: ["a", "b", "c"])
50
54
  """
51
55
  List of subdomains used in the URL template.
52
56
 
53
- For example, if [`subdomains`][..] is set to `["a", "b", "c"]` and the
54
- `url_template` is `"https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"`,
57
+ For example, if [`subdomains`][..] is set to `["a", "b", "c"]` and the
58
+ `url_template` is `"https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"`,
55
59
  the resulting tile URLs will be:
56
60
 
57
61
  - `"https://a.tile.openstreetmap.org/{z}/{x}/{y}.png"`
@@ -61,7 +65,7 @@ class TileLayer(MapLayer):
61
65
 
62
66
  tile_bounds: Optional[MapLatitudeLongitudeBounds] = None
63
67
  """
64
- Defines the bounds of the map.
68
+ Defines the bounds of the map.
65
69
  Only tiles that fall within these bounds will be loaded.
66
70
  """
67
71
 
@@ -69,7 +73,7 @@ class TileLayer(MapLayer):
69
73
  """
70
74
  The size in pixels of each tile image.
71
75
  Should be a positive power of 2.
72
-
76
+
73
77
  Note:
74
78
  Must be greater than or equal to `0.0`.
75
79
  """
@@ -80,10 +84,10 @@ class TileLayer(MapLayer):
80
84
 
81
85
  Tiles from below this zoom level will not be displayed, instead tiles at
82
86
  this zoom level will be displayed and scaled.
83
-
87
+
84
88
  This should usually be 0 (as default), as most tile sources will support
85
89
  zoom levels onwards from this.
86
-
90
+
87
91
  Note:
88
92
  Must be greater than or equal to `0.0`.
89
93
  """
@@ -94,30 +98,32 @@ class TileLayer(MapLayer):
94
98
 
95
99
  Tiles from above this zoom level will not be displayed, instead tiles at
96
100
  this zoom level will be displayed and scaled.
97
-
101
+
98
102
  Most tile servers support up to zoom level `19`, which is the default.
99
103
  Otherwise, this should be specified.
100
-
104
+
101
105
  Note:
102
106
  Must be greater than or equal to `0.0`.
103
107
  """
104
108
 
105
109
  zoom_reverse: bool = False
106
110
  """
107
- Whether the zoom number used in tile URLs will be reversed (`max_zoom - zoom` instead of `zoom`).
111
+ Whether the zoom number used in tile URLs will be reversed
112
+ (`max_zoom - zoom` instead of `zoom`).
108
113
  """
109
114
 
110
115
  zoom_offset: ft.Number = 0.0
111
116
  """
112
117
  The zoom number used in tile URLs will be offset with this value.
113
-
118
+
114
119
  Note:
115
120
  Must be greater than or equal to `0.0`.
116
121
  """
117
122
 
118
123
  keep_buffer: int = 2
119
124
  """
120
- When panning the map, keep this many rows and columns of tiles before unloading them.
125
+ When panning the map, keep this many rows and columns of
126
+ tiles before unloading them.
121
127
  """
122
128
 
123
129
  pan_buffer: int = 1
@@ -137,14 +143,15 @@ class TileLayer(MapLayer):
137
143
  enable_retina_mode: bool = False
138
144
  """
139
145
  Whether to enable retina mode.
140
- Retina mode improves the resolution of map tiles, particularly on high density displays.
146
+ Retina mode improves the resolution of map tiles, particularly on
147
+ high density displays.
141
148
  """
142
149
 
143
- additional_options: Dict[str, str] = field(default_factory=dict)
150
+ additional_options: dict[str, str] = field(default_factory=dict)
144
151
  """
145
152
  Static information that should replace placeholders in the [`url_template`][..].
146
153
  Applying API keys, for example, is a good usecase of this parameter.
147
-
154
+
148
155
  Example:
149
156
  ```python
150
157
  TileLayer(
@@ -162,12 +169,12 @@ class TileLayer(MapLayer):
162
169
  The maximum zoom level up to which this layer will be displayed (inclusive).
163
170
  The main usage for this property is to display a different `TileLayer`
164
171
  when zoomed far in.
165
-
172
+
166
173
  Prefer [`max_native_zoom`][..] for setting the maximum zoom level supported by the
167
- tile source.
168
-
174
+ tile source.
175
+
169
176
  Typically set to infinity so that there are tiles always displayed.
170
-
177
+
171
178
  Note:
172
179
  Must be greater than or equal to `0.0`.
173
180
  """
@@ -176,7 +183,7 @@ class TileLayer(MapLayer):
176
183
  """
177
184
  The minimum zoom level at which this layer is displayed (inclusive).
178
185
  Typically `0.0`.
179
-
186
+
180
187
  Note:
181
188
  Must be greater than or equal to `0.0`.
182
189
  """
@@ -184,21 +191,21 @@ class TileLayer(MapLayer):
184
191
  error_image_src: Optional[str] = None
185
192
  """
186
193
  The source of the tile image to show in place of the tile that failed to load.
187
-
194
+
188
195
  See [`on_image_error`][..] property for details on the error.
189
196
  """
190
197
 
191
- evict_error_tile_strategy: Optional[
192
- TileLayerEvictErrorTileStrategy
193
- ] = TileLayerEvictErrorTileStrategy.NONE
198
+ evict_error_tile_strategy: Optional[TileLayerEvictErrorTileStrategy] = (
199
+ TileLayerEvictErrorTileStrategy.NONE
200
+ )
194
201
  """
195
- If a tile was loaded with error,
202
+ If a tile was loaded with error,
196
203
  the tile provider will be asked to evict the image based on this strategy.
197
204
  """
198
205
 
199
206
  display_mode: TileDisplay = field(default_factory=lambda: FadeInTileDisplay())
200
207
  """
201
-
208
+
202
209
  Defines how tiles are displayed on the map.
203
210
  """
204
211
 
@@ -207,11 +214,12 @@ class TileLayer(MapLayer):
207
214
  The package name of the user agent.
208
215
  """
209
216
 
210
- on_image_error: ft.OptionalControlEventHandler["TileLayer"] = None
217
+ on_image_error: Optional[ft.ControlEventHandler["TileLayer"]] = None
211
218
  """
212
219
  Fires if an error occurs when fetching the tiles.
213
-
214
- Event handler argument `data` property contains information about the error.
220
+
221
+ Event handler argument [`data`][flet.Event.data] property contains
222
+ information about the error.
215
223
  """
216
224
 
217
225
  def before_update(self):
@@ -220,10 +228,12 @@ class TileLayer(MapLayer):
220
228
  f"tile_size must be greater than or equal to 0, got {self.tile_size}"
221
229
  )
222
230
  assert self.min_native_zoom >= 0, (
223
- f"min_native_zoom must be greater than or equal to 0, got {self.min_native_zoom}"
231
+ f"min_native_zoom must be greater than or equal to 0, "
232
+ f"got {self.min_native_zoom}"
224
233
  )
225
234
  assert self.max_native_zoom >= 0, (
226
- f"max_native_zoom must be greater than or equal to 0, got {self.max_native_zoom}"
235
+ f"max_native_zoom must be greater than or equal to 0, "
236
+ f"got {self.max_native_zoom}"
227
237
  )
228
238
  assert self.zoom_offset >= 0, (
229
239
  f"zoom_offset must be greater than or equal to 0, got {self.zoom_offset}"