flet-map 0.85.0.dev0__tar.gz → 0.85.0.dev1__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.
Files changed (38) hide show
  1. {flet_map-0.85.0.dev0/src/flet_map.egg-info → flet_map-0.85.0.dev1}/PKG-INFO +3 -3
  2. {flet_map-0.85.0.dev0 → flet_map-0.85.0.dev1}/README.md +1 -1
  3. {flet_map-0.85.0.dev0 → flet_map-0.85.0.dev1}/pyproject.toml +2 -2
  4. {flet_map-0.85.0.dev0 → flet_map-0.85.0.dev1}/src/flet_map/__init__.py +10 -0
  5. {flet_map-0.85.0.dev0 → flet_map-0.85.0.dev1}/src/flet_map/circle_layer.py +6 -1
  6. {flet_map-0.85.0.dev0 → flet_map-0.85.0.dev1}/src/flet_map/map.py +5 -5
  7. {flet_map-0.85.0.dev0 → flet_map-0.85.0.dev1}/src/flet_map/map_layer.py +1 -0
  8. {flet_map-0.85.0.dev0 → flet_map-0.85.0.dev1}/src/flet_map/marker_layer.py +6 -1
  9. flet_map-0.85.0.dev1/src/flet_map/overlay_image_layer.py +116 -0
  10. {flet_map-0.85.0.dev0 → flet_map-0.85.0.dev1}/src/flet_map/polygon_layer.py +6 -1
  11. {flet_map-0.85.0.dev0 → flet_map-0.85.0.dev1}/src/flet_map/polyline_layer.py +6 -1
  12. {flet_map-0.85.0.dev0 → flet_map-0.85.0.dev1/src/flet_map.egg-info}/PKG-INFO +3 -3
  13. {flet_map-0.85.0.dev0 → flet_map-0.85.0.dev1}/src/flet_map.egg-info/SOURCES.txt +2 -0
  14. flet_map-0.85.0.dev1/src/flet_map.egg-info/requires.txt +1 -0
  15. {flet_map-0.85.0.dev0 → flet_map-0.85.0.dev1}/src/flutter/flet_map/lib/src/circle_layer.dart +2 -2
  16. {flet_map-0.85.0.dev0 → flet_map-0.85.0.dev1}/src/flutter/flet_map/lib/src/extension.dart +3 -0
  17. {flet_map-0.85.0.dev0 → flet_map-0.85.0.dev1}/src/flutter/flet_map/lib/src/marker_layer.dart +8 -5
  18. flet_map-0.85.0.dev1/src/flutter/flet_map/lib/src/overlay_image_layer.dart +73 -0
  19. {flet_map-0.85.0.dev0 → flet_map-0.85.0.dev1}/src/flutter/flet_map/lib/src/polygon_layer.dart +12 -13
  20. {flet_map-0.85.0.dev0 → flet_map-0.85.0.dev1}/src/flutter/flet_map/lib/src/polyline_layer.dart +12 -13
  21. {flet_map-0.85.0.dev0 → flet_map-0.85.0.dev1}/src/flutter/flet_map/lib/src/rich_attribution.dart +16 -14
  22. {flet_map-0.85.0.dev0 → flet_map-0.85.0.dev1}/src/flutter/flet_map/lib/src/simple_attribution.dart +9 -6
  23. {flet_map-0.85.0.dev0 → flet_map-0.85.0.dev1}/src/flutter/flet_map/lib/src/tile_layer.dart +6 -7
  24. {flet_map-0.85.0.dev0 → flet_map-0.85.0.dev1}/src/flutter/flet_map/lib/src/utils/attribution_alignment.dart +7 -0
  25. {flet_map-0.85.0.dev0 → flet_map-0.85.0.dev1}/src/flutter/flet_map/lib/src/utils/map.dart +70 -8
  26. {flet_map-0.85.0.dev0 → flet_map-0.85.0.dev1}/src/flutter/flet_map/pubspec.yaml +1 -1
  27. flet_map-0.85.0.dev0/src/flet_map.egg-info/requires.txt +0 -1
  28. {flet_map-0.85.0.dev0 → flet_map-0.85.0.dev1}/LICENSE +0 -0
  29. {flet_map-0.85.0.dev0 → flet_map-0.85.0.dev1}/setup.cfg +0 -0
  30. {flet_map-0.85.0.dev0 → flet_map-0.85.0.dev1}/src/flet_map/rich_attribution.py +0 -0
  31. {flet_map-0.85.0.dev0 → flet_map-0.85.0.dev1}/src/flet_map/simple_attribution.py +0 -0
  32. {flet_map-0.85.0.dev0 → flet_map-0.85.0.dev1}/src/flet_map/source_attribution.py +0 -0
  33. {flet_map-0.85.0.dev0 → flet_map-0.85.0.dev1}/src/flet_map/tile_layer.py +0 -0
  34. {flet_map-0.85.0.dev0 → flet_map-0.85.0.dev1}/src/flet_map/types.py +0 -0
  35. {flet_map-0.85.0.dev0 → flet_map-0.85.0.dev1}/src/flet_map.egg-info/dependency_links.txt +0 -0
  36. {flet_map-0.85.0.dev0 → flet_map-0.85.0.dev1}/src/flet_map.egg-info/top_level.txt +0 -0
  37. {flet_map-0.85.0.dev0 → flet_map-0.85.0.dev1}/src/flutter/flet_map/lib/flet_map.dart +0 -0
  38. {flet_map-0.85.0.dev0 → flet_map-0.85.0.dev1}/src/flutter/flet_map/lib/src/map.dart +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: flet-map
3
- Version: 0.85.0.dev0
3
+ Version: 0.85.0.dev1
4
4
  Summary: Interactive map controls for Flet apps.
5
5
  Author-email: Flet contributors <hello@flet.dev>
6
6
  License-Expression: Apache-2.0
@@ -11,7 +11,7 @@ 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==0.85.0.dev0
14
+ Requires-Dist: flet==0.85.0.dev1
15
15
  Dynamic: license-file
16
16
 
17
17
  # flet-map
@@ -55,4 +55,4 @@ To install the `flet-map` package and add it to your project dependencies:
55
55
 
56
56
  ### Examples
57
57
 
58
- For examples, see [these](https://github.com/flet-dev/flet/tree/main/sdk/python/examples/controls/map).
58
+ For examples, see [these](https://github.com/flet-dev/flet/tree/main/sdk/python/examples/extensions/map).
@@ -39,4 +39,4 @@ To install the `flet-map` package and add it to your project dependencies:
39
39
 
40
40
  ### Examples
41
41
 
42
- For examples, see [these](https://github.com/flet-dev/flet/tree/main/sdk/python/examples/controls/map).
42
+ For examples, see [these](https://github.com/flet-dev/flet/tree/main/sdk/python/examples/extensions/map).
@@ -1,13 +1,13 @@
1
1
  [project]
2
2
  name = "flet-map"
3
- version = "0.85.0.dev0"
3
+ version = "0.85.0.dev1"
4
4
  description = "Interactive map controls for Flet apps."
5
5
  readme = "README.md"
6
6
  authors = [{ name = "Flet contributors", email = "hello@flet.dev" }]
7
7
  license = "Apache-2.0"
8
8
  requires-python = ">=3.10"
9
9
  dependencies = [
10
- "flet==0.85.0.dev0",
10
+ "flet==0.85.0.dev1",
11
11
  ]
12
12
 
13
13
  [project.urls]
@@ -2,6 +2,12 @@ from flet_map.circle_layer import CircleLayer, CircleMarker
2
2
  from flet_map.map import Map
3
3
  from flet_map.map_layer import MapLayer
4
4
  from flet_map.marker_layer import Marker, MarkerLayer
5
+ from flet_map.overlay_image_layer import (
6
+ BaseOverlayImage,
7
+ OverlayImage,
8
+ OverlayImageLayer,
9
+ RotatedOverlayImage,
10
+ )
5
11
  from flet_map.polygon_layer import PolygonLayer, PolygonMarker
6
12
  from flet_map.polyline_layer import PolylineLayer, PolylineMarker
7
13
  from flet_map.rich_attribution import RichAttribution
@@ -45,6 +51,7 @@ from flet_map.types import (
45
51
 
46
52
  __all__ = [
47
53
  "AttributionAlignment",
54
+ "BaseOverlayImage",
48
55
  "Camera",
49
56
  "CameraFit",
50
57
  "CircleLayer",
@@ -73,12 +80,15 @@ __all__ = [
73
80
  "Marker",
74
81
  "MarkerLayer",
75
82
  "MultiFingerGesture",
83
+ "OverlayImage",
84
+ "OverlayImageLayer",
76
85
  "PatternFit",
77
86
  "PolygonLayer",
78
87
  "PolygonMarker",
79
88
  "PolylineLayer",
80
89
  "PolylineMarker",
81
90
  "RichAttribution",
91
+ "RotatedOverlayImage",
82
92
  "SimpleAttribution",
83
93
  "SolidStrokePattern",
84
94
  "SourceAttribution",
@@ -8,7 +8,7 @@ __all__ = ["CircleLayer", "CircleMarker"]
8
8
 
9
9
 
10
10
  @ft.control("CircleMarker")
11
- class CircleMarker(ft.Control):
11
+ class CircleMarker(ft.BaseControl):
12
12
  """
13
13
  A circular marker displayed on the Map at the specified
14
14
  location through the :class:`~flet_map.CircleLayer`.
@@ -45,6 +45,11 @@ class CircleMarker(ft.Control):
45
45
  Whether the :attr:`radius` should use the unit meters.
46
46
  """
47
47
 
48
+ visible: bool = True
49
+ """
50
+ Whether this marker is rendered on the map.
51
+ """
52
+
48
53
  def before_update(self):
49
54
  super().before_update()
50
55
  if self.border_stroke_width < 0:
@@ -45,7 +45,8 @@ class Map(ft.LayoutControl):
45
45
  initial_zoom: ft.Number = 13.0
46
46
  """
47
47
  The zoom when the map is first loaded.
48
- If initial_camera_fit is defined this has no effect.
48
+
49
+ If :attr:`initial_camera_fit` is non-`None` this has no effect.
49
50
  """
50
51
 
51
52
  interaction_configuration: InteractionConfiguration = field(
@@ -224,9 +225,8 @@ class Map(ft.LayoutControl):
224
225
  Args:
225
226
  animation_curve: The curve of the animation. If None (the default),
226
227
  :attr:`flet_map.Map.animation_curve` will be used.
227
- animation_duration: The duration of the animation.
228
- If None (the default), :attr:`flet_map.Map.animation_duration` will be \
229
- used.
228
+ animation_duration: The duration of the animation. If None (the default),
229
+ :attr:`flet_map.Map.animation_duration` will be used.
230
230
  cancel_ongoing_animations: Whether to cancel/stop all
231
231
  ongoing map-animations before starting this new one.
232
232
  """
@@ -379,7 +379,7 @@ class Map(ft.LayoutControl):
379
379
  Gets the current camera snapshot of the map.
380
380
 
381
381
  Returns:
382
- Current :class:`~flet_map.Camera` state.
382
+ The current camera state.
383
383
  """
384
384
  camera = await self._invoke_method("get_camera")
385
385
  return from_dict(Camera, camera)
@@ -12,6 +12,7 @@ class MapLayer(ft.Control):
12
12
 
13
13
  - :class:`~flet_map.CircleLayer`
14
14
  - :class:`~flet_map.MarkerLayer`
15
+ - :class:`~flet_map.OverlayImageLayer`
15
16
  - :class:`~flet_map.PolygonLayer`
16
17
  - :class:`~flet_map.PolylineLayer`
17
18
  - :class:`~flet_map.RichAttribution`
@@ -9,7 +9,7 @@ __all__ = ["Marker", "MarkerLayer"]
9
9
 
10
10
 
11
11
  @ft.control("Marker")
12
- class Marker(ft.Control):
12
+ class Marker(ft.BaseControl):
13
13
  """
14
14
  A marker displayed on the Map at the specified location
15
15
  through the :class:`~flet_map.MarkerLayer`.
@@ -68,6 +68,11 @@ class Marker(ft.Control):
68
68
  Defaults to the value of the parent :attr:`flet_map.MarkerLayer.alignment`.
69
69
  """
70
70
 
71
+ visible: bool = True
72
+ """
73
+ Whether this marker is rendered on the map.
74
+ """
75
+
71
76
  def before_update(self):
72
77
  super().before_update()
73
78
  if not self.content.visible:
@@ -0,0 +1,116 @@
1
+ from typing import Annotated, Union
2
+
3
+ import flet as ft
4
+ from flet.utils.validation import V
5
+ from flet_map.map_layer import MapLayer
6
+ from flet_map.types import MapLatitudeLongitude, MapLatitudeLongitudeBounds
7
+
8
+ __all__ = [
9
+ "BaseOverlayImage",
10
+ "OverlayImage",
11
+ "OverlayImageLayer",
12
+ "RotatedOverlayImage",
13
+ ]
14
+
15
+
16
+ @ft.control("BaseOverlayImage", kw_only=True)
17
+ class BaseOverlayImage(ft.BaseControl):
18
+ """
19
+ Abstract class for image overlays displayed through
20
+ :class:`~flet_map.OverlayImageLayer`.
21
+
22
+ The following overlay image types are available:
23
+
24
+ - :class:`~flet_map.OverlayImage`
25
+ - :class:`~flet_map.RotatedOverlayImage`
26
+ """
27
+
28
+ src: Union[str, bytes]
29
+ """
30
+ The image source.
31
+
32
+ It can be one of the following:
33
+ - A URL or local [asset file](https://flet.dev/docs/cookbook/assets) path;
34
+ - A base64 string;
35
+ - Raw bytes.
36
+ """
37
+
38
+ opacity: Annotated[
39
+ ft.Number,
40
+ V.between(0.0, 1.0),
41
+ ] = 1.0
42
+ """
43
+ The opacity in which the image should get rendered on the map.
44
+
45
+ Raises:
46
+ ValueError: If it is not between `0.0` and `1.0`, inclusive.
47
+ """
48
+
49
+ gapless_playback: bool = False
50
+ """
51
+ Whether to continue showing the old image (`True`), or briefly show nothing
52
+ (`False`), when the image provider changes.
53
+ """
54
+
55
+ filter_quality: ft.FilterQuality = ft.FilterQuality.MEDIUM
56
+ """
57
+ The rendering quality of the image.
58
+ """
59
+
60
+ visible: bool = True
61
+ """
62
+ Whether this overlay image is rendered on the map.
63
+ """
64
+
65
+
66
+ @ft.control("OverlayImage", kw_only=True)
67
+ class OverlayImage(BaseOverlayImage):
68
+ """
69
+ An unrotated image overlay that spans between a given bounding box.
70
+ """
71
+
72
+ bounds: MapLatitudeLongitudeBounds
73
+ """
74
+ The latitude and longitude bounds where this image will be displayed.
75
+ """
76
+
77
+
78
+ @ft.control("RotatedOverlayImage", kw_only=True)
79
+ class RotatedOverlayImage(BaseOverlayImage):
80
+ """
81
+ An image overlay transformed across three corner points.
82
+
83
+ The top-right corner is derived from :attr:`top_left_corner`,
84
+ :attr:`bottom_left_corner`, and :attr:`bottom_right_corner`.
85
+ """
86
+
87
+ top_left_corner: MapLatitudeLongitude
88
+ """
89
+ The coordinates of the top-left corner of the image.
90
+ """
91
+
92
+ bottom_left_corner: MapLatitudeLongitude
93
+ """
94
+ The coordinates of the bottom-left corner of the image.
95
+ """
96
+
97
+ bottom_right_corner: MapLatitudeLongitude
98
+ """
99
+ The coordinates of the bottom-right corner of the image.
100
+ """
101
+
102
+
103
+ @ft.control("OverlayImageLayer", kw_only=True)
104
+ class OverlayImageLayer(MapLayer):
105
+ """
106
+ A layer to display image overlays.
107
+
108
+ Tip:
109
+ Place this layer after every non-translucent layer that should appear
110
+ below it. Layers rendered after this one may cover its overlay images.
111
+ """
112
+
113
+ overlay_images: list[BaseOverlayImage]
114
+ """
115
+ A list of image overlays to display.
116
+ """
@@ -8,7 +8,7 @@ __all__ = ["PolygonLayer", "PolygonMarker"]
8
8
 
9
9
 
10
10
  @ft.control("PolygonMarker")
11
- class PolygonMarker(ft.Control):
11
+ class PolygonMarker(ft.BaseControl):
12
12
  """
13
13
  A marker for the :class:`~flet_map.PolygonLayer`.
14
14
  """
@@ -74,6 +74,11 @@ class PolygonMarker(ft.Control):
74
74
  Style to use for line segment joins.
75
75
  """
76
76
 
77
+ visible: bool = True
78
+ """
79
+ Whether this marker is rendered on the map.
80
+ """
81
+
77
82
  def before_update(self):
78
83
  super().before_update()
79
84
  if self.border_stroke_width < 0:
@@ -9,7 +9,7 @@ __all__ = ["PolylineLayer", "PolylineMarker"]
9
9
 
10
10
 
11
11
  @ft.control("PolylineMarker")
12
- class PolylineMarker(ft.Control):
12
+ class PolylineMarker(ft.BaseControl):
13
13
  """
14
14
  A marker for the :class:`~flet_map.PolylineLayer`.
15
15
  """
@@ -76,6 +76,11 @@ class PolylineMarker(ft.Control):
76
76
  Style to use for line segment joins.
77
77
  """
78
78
 
79
+ visible: bool = True
80
+ """
81
+ Whether this marker is rendered on the map.
82
+ """
83
+
79
84
  def before_update(self):
80
85
  super().before_update()
81
86
  if self.border_stroke_width < 0:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: flet-map
3
- Version: 0.85.0.dev0
3
+ Version: 0.85.0.dev1
4
4
  Summary: Interactive map controls for Flet apps.
5
5
  Author-email: Flet contributors <hello@flet.dev>
6
6
  License-Expression: Apache-2.0
@@ -11,7 +11,7 @@ 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==0.85.0.dev0
14
+ Requires-Dist: flet==0.85.0.dev1
15
15
  Dynamic: license-file
16
16
 
17
17
  # flet-map
@@ -55,4 +55,4 @@ To install the `flet-map` package and add it to your project dependencies:
55
55
 
56
56
  ### Examples
57
57
 
58
- For examples, see [these](https://github.com/flet-dev/flet/tree/main/sdk/python/examples/controls/map).
58
+ For examples, see [these](https://github.com/flet-dev/flet/tree/main/sdk/python/examples/extensions/map).
@@ -6,6 +6,7 @@ src/flet_map/circle_layer.py
6
6
  src/flet_map/map.py
7
7
  src/flet_map/map_layer.py
8
8
  src/flet_map/marker_layer.py
9
+ src/flet_map/overlay_image_layer.py
9
10
  src/flet_map/polygon_layer.py
10
11
  src/flet_map/polyline_layer.py
11
12
  src/flet_map/rich_attribution.py
@@ -24,6 +25,7 @@ src/flutter/flet_map/lib/src/circle_layer.dart
24
25
  src/flutter/flet_map/lib/src/extension.dart
25
26
  src/flutter/flet_map/lib/src/map.dart
26
27
  src/flutter/flet_map/lib/src/marker_layer.dart
28
+ src/flutter/flet_map/lib/src/overlay_image_layer.dart
27
29
  src/flutter/flet_map/lib/src/polygon_layer.dart
28
30
  src/flutter/flet_map/lib/src/polyline_layer.dart
29
31
  src/flutter/flet_map/lib/src/rich_attribution.dart
@@ -0,0 +1 @@
1
+ flet==0.85.0.dev1
@@ -20,7 +20,7 @@ class CircleLayerControl extends StatelessWidget with FletStoreMixin {
20
20
  .map((circle) {
21
21
  circle.notifyParent = true;
22
22
  return CircleMarker(
23
- point: parseLatLng(circle.get("coordinates"))!,
23
+ point: circle.getLatLng("coordinates")!,
24
24
  color: circle.getColor("color", context, const Color(0xFF00FF00))!,
25
25
  borderColor: circle.getColor(
26
26
  "border_color", context, const Color(0xFFFFFF00))!,
@@ -29,6 +29,6 @@ class CircleLayerControl extends StatelessWidget with FletStoreMixin {
29
29
  radius: circle.getDouble("radius", 10)!);
30
30
  }).toList();
31
31
 
32
- return CircleLayer(circles: circles);
32
+ return BaseControl(control: control, child: CircleLayer(circles: circles));
33
33
  }
34
34
  }
@@ -4,6 +4,7 @@ import 'package:flutter/cupertino.dart';
4
4
  import 'circle_layer.dart';
5
5
  import 'map.dart';
6
6
  import 'marker_layer.dart';
7
+ import 'overlay_image_layer.dart';
7
8
  import 'polygon_layer.dart';
8
9
  import 'polyline_layer.dart';
9
10
  import 'rich_attribution.dart';
@@ -24,6 +25,8 @@ class Extension extends FletExtension {
24
25
  return TileLayerControl(key: key, control: control);
25
26
  case "MarkerLayer":
26
27
  return MarkerLayerControl(key: key, control: control);
28
+ case "OverlayImageLayer":
29
+ return OverlayImageLayerControl(key: key, control: control);
27
30
  case "CircleLayer":
28
31
  return CircleLayerControl(key: key, control: control);
29
32
  case "PolygonLayer":
@@ -19,7 +19,7 @@ class MarkerLayerControl extends StatelessWidget with FletStoreMixin {
19
19
  .map((marker) {
20
20
  marker.notifyParent = true;
21
21
  return AnimatedMarker(
22
- point: parseLatLng(marker.get("coordinates"))!,
22
+ point: marker.getLatLng("coordinates")!,
23
23
  rotate: marker.getBool("rotate"),
24
24
  height: marker.getDouble("height", 30.0)!,
25
25
  width: marker.getDouble("width", 30.0)!,
@@ -30,10 +30,13 @@ class MarkerLayerControl extends StatelessWidget with FletStoreMixin {
30
30
  });
31
31
  }).toList();
32
32
 
33
- return AnimatedMarkerLayer(
34
- markers: markers,
35
- rotate: control.getBool("rotate", false)!,
36
- alignment: control.getAlignment("alignment", Alignment.center)!,
33
+ return BaseControl(
34
+ control: control,
35
+ child: AnimatedMarkerLayer(
36
+ markers: markers,
37
+ rotate: control.getBool("rotate", false)!,
38
+ alignment: control.getAlignment("alignment", Alignment.center)!,
39
+ ),
37
40
  );
38
41
  }
39
42
  }
@@ -0,0 +1,73 @@
1
+ import 'package:flet/flet.dart';
2
+ import 'package:flutter/material.dart';
3
+ import 'package:flutter_map/flutter_map.dart';
4
+
5
+ import 'utils/map.dart';
6
+
7
+ class OverlayImageLayerControl extends StatelessWidget {
8
+ final Control control;
9
+
10
+ const OverlayImageLayerControl({super.key, required this.control});
11
+
12
+ @override
13
+ Widget build(BuildContext context) {
14
+ debugPrint("OverlayImageLayerControl build: ${control.id}");
15
+
16
+ final overlayImages = control
17
+ .children("overlay_images")
18
+ .map((overlayImage) {
19
+ overlayImage.notifyParent = true;
20
+
21
+ final imageProvider = overlayImage.getImageProvider("src", context);
22
+ if (imageProvider == null) return null;
23
+
24
+ final opacity = overlayImage.getDouble("opacity", 1.0)!;
25
+ final gaplessPlayback =
26
+ overlayImage.getBool("gapless_playback", false)!;
27
+ final filterQuality = overlayImage.getFilterQuality(
28
+ "filter_quality", FilterQuality.medium)!;
29
+
30
+ switch (overlayImage.type) {
31
+ case "OverlayImage":
32
+ final bounds = overlayImage.getLatLngBounds("bounds");
33
+ if (bounds == null) return null;
34
+ return OverlayImage(
35
+ imageProvider: imageProvider,
36
+ bounds: bounds,
37
+ opacity: opacity,
38
+ gaplessPlayback: gaplessPlayback,
39
+ filterQuality: filterQuality,
40
+ );
41
+ case "RotatedOverlayImage":
42
+ final topLeftCorner = overlayImage.getLatLng("top_left_corner");
43
+ final bottomLeftCorner =
44
+ overlayImage.getLatLng("bottom_left_corner");
45
+ final bottomRightCorner =
46
+ overlayImage.getLatLng("bottom_right_corner");
47
+ if (topLeftCorner == null ||
48
+ bottomLeftCorner == null ||
49
+ bottomRightCorner == null) {
50
+ return null;
51
+ }
52
+ return RotatedOverlayImage(
53
+ imageProvider: imageProvider,
54
+ topLeftCorner: topLeftCorner,
55
+ bottomLeftCorner: bottomLeftCorner,
56
+ bottomRightCorner: bottomRightCorner,
57
+ opacity: opacity,
58
+ gaplessPlayback: gaplessPlayback,
59
+ filterQuality: filterQuality,
60
+ );
61
+ default:
62
+ return null;
63
+ }
64
+ })
65
+ .nonNulls
66
+ .toList();
67
+
68
+ return BaseControl(
69
+ control: control,
70
+ child: OverlayImageLayer(overlayImages: overlayImages),
71
+ );
72
+ }
73
+ }
@@ -29,21 +29,20 @@ class PolygonLayerControl extends StatelessWidget with FletStoreMixin {
29
29
  "label_text_style", Theme.of(context), const TextStyle())!,
30
30
  strokeCap: polygon.getStrokeCap("stroke_cap", StrokeCap.round)!,
31
31
  strokeJoin: polygon.getStrokeJoin("stroke_join", StrokeJoin.round)!,
32
- points: polygon
33
- .get("coordinates", [])!
34
- .map((c) => parseLatLng(c))
35
- .nonNulls
36
- .toList());
32
+ points: polygon.getLatLngList("coordinates"));
37
33
  }).toList();
38
34
 
39
- return PolygonLayer(
40
- polygons: polygons,
41
- polygonCulling: control.getBool("polygon_culling", true)!,
42
- polygonLabels: control.getBool("polygon_labels", true)!,
43
- drawLabelsLast: control.getBool("draw_labels_last", false)!,
44
- simplificationTolerance:
45
- control.getDouble("simplification_tolerance", 0.3)!,
46
- useAltRendering: control.getBool("use_alternative_rendering", false)!,
35
+ return BaseControl(
36
+ control: control,
37
+ child: PolygonLayer(
38
+ polygons: polygons,
39
+ polygonCulling: control.getBool("polygon_culling", true)!,
40
+ polygonLabels: control.getBool("polygon_labels", true)!,
41
+ drawLabelsLast: control.getBool("draw_labels_last", false)!,
42
+ simplificationTolerance:
43
+ control.getDouble("simplification_tolerance", 0.3)!,
44
+ useAltRendering: control.getBool("use_alternative_rendering", false)!,
45
+ ),
47
46
  );
48
47
  }
49
48
  }
@@ -23,8 +23,8 @@ class PolylineLayerControl extends StatelessWidget with FletStoreMixin {
23
23
  borderColor:
24
24
  polyline.getColor("border_color", context, Colors.yellow)!,
25
25
  color: polyline.getColor("color", context, Colors.yellow)!,
26
- pattern: parseStrokePattern(
27
- polyline.get("stroke_pattern"), const StrokePattern.solid())!,
26
+ pattern: polyline.getStrokePattern(
27
+ "stroke_pattern", const StrokePattern.solid())!,
28
28
  strokeCap: polyline.getStrokeCap("stroke_cap", StrokeCap.round)!,
29
29
  strokeJoin: polyline.getStrokeJoin("stroke_join", StrokeJoin.round)!,
30
30
  strokeWidth: polyline.getDouble("stroke_width", 1.0)!,
@@ -40,19 +40,18 @@ class PolylineLayerControl extends StatelessWidget with FletStoreMixin {
40
40
  .map((e) => parseColor(e, Theme.of(context)))
41
41
  .nonNulls
42
42
  .toList(),
43
- points: polyline
44
- .get("coordinates", [])!
45
- .map((c) => parseLatLng(c))
46
- .nonNulls
47
- .toList());
43
+ points: polyline.getLatLngList("coordinates"));
48
44
  }).toList();
49
45
 
50
- return PolylineLayer(
51
- polylines: polylines,
52
- cullingMargin: control.getDouble("culling_margin", 10.0)!,
53
- minimumHitbox: control.getDouble("min_hittable_radius", 10.0)!,
54
- simplificationTolerance:
55
- control.getDouble("simplification_tolerance", 0.3)!,
46
+ return BaseControl(
47
+ control: control,
48
+ child: PolylineLayer(
49
+ polylines: polylines,
50
+ cullingMargin: control.getDouble("culling_margin", 10.0)!,
51
+ minimumHitbox: control.getDouble("min_hittable_radius", 10.0)!,
52
+ simplificationTolerance:
53
+ control.getDouble("simplification_tolerance", 0.3)!,
54
+ ),
56
55
  );
57
56
  }
58
57
  }
@@ -44,19 +44,21 @@ class _RichAttributionControlState extends State<RichAttributionControl>
44
44
  .nonNulls
45
45
  .toList();
46
46
 
47
- return RichAttributionWidget(
48
- attributions: attributions,
49
- permanentHeight: widget.control.getDouble("permanent_height", 24.0)!,
50
- popupBackgroundColor: widget.control.getColor(
51
- "popup_bgcolor", context, Theme.of(context).colorScheme.surface),
52
- showFlutterMapAttribution:
53
- widget.control.getBool("show_flutter_map_attribution", true)!,
54
- alignment: parseAttributionAlignment(
55
- widget.control.getString("alignment"),
56
- AttributionAlignment.bottomRight)!,
57
- popupBorderRadius:
58
- widget.control.getBorderRadius("popup_border_radius"),
59
- popupInitialDisplayDuration: widget.control
60
- .getDuration("popup_initial_display_duration", Duration.zero)!);
47
+ return BaseControl(
48
+ control: widget.control,
49
+ child: RichAttributionWidget(
50
+ attributions: attributions,
51
+ permanentHeight: widget.control.getDouble("permanent_height", 24.0)!,
52
+ popupBackgroundColor: widget.control.getColor(
53
+ "popup_bgcolor", context, Theme.of(context).colorScheme.surface),
54
+ showFlutterMapAttribution:
55
+ widget.control.getBool("show_flutter_map_attribution", true)!,
56
+ alignment: widget.control.getAttributionAlignment(
57
+ "alignment", AttributionAlignment.bottomRight)!,
58
+ popupBorderRadius:
59
+ widget.control.getBorderRadius("popup_border_radius"),
60
+ popupInitialDisplayDuration: widget.control
61
+ .getDuration("popup_initial_display_duration", Duration.zero)!),
62
+ );
61
63
  }
62
64
  }
@@ -12,12 +12,15 @@ class SimpleAttributionControl extends StatelessWidget {
12
12
  debugPrint("SimpleAttributionControl build: ${control.id}");
13
13
  var text = control.buildTextOrWidget("text");
14
14
 
15
- return SimpleAttributionWidget(
16
- source: text is Text ? text : const Text("Placeholder Text"),
17
- onTap: () => control.triggerEvent("click"),
18
- backgroundColor: control.getColor(
19
- "bgcolor", context, Theme.of(context).colorScheme.surface)!,
20
- alignment: control.getAlignment("alignment", Alignment.bottomRight)!,
15
+ return BaseControl(
16
+ control: control,
17
+ child: SimpleAttributionWidget(
18
+ source: text is Text ? text : const Text("Placeholder Text"),
19
+ onTap: () => control.triggerEvent("click"),
20
+ backgroundColor: control.getColor(
21
+ "bgcolor", context, Theme.of(context).colorScheme.surface)!,
22
+ alignment: control.getAlignment("alignment", Alignment.bottomRight)!,
23
+ ),
21
24
  );
22
25
  }
23
26
  }
@@ -34,8 +34,8 @@ class TileLayerControl extends StatelessWidget {
34
34
  control.get<List>("subdomains")?.map((e) => e.toString()).toList() ??
35
35
  const ['a', 'b', 'c'],
36
36
  tileProvider: NetworkTileProvider(),
37
- tileDisplay: parseTileDisplay(
38
- control.get("display_mode"), const TileDisplay.fadeIn())!,
37
+ tileDisplay:
38
+ control.getTileDisplay("display_mode", const TileDisplay.fadeIn())!,
39
39
  tileDimension: control.getInt("tile_size", 256)!,
40
40
  userAgentPackageName:
41
41
  control.getString("user_agent_package_name", 'unknown')!,
@@ -46,13 +46,12 @@ class TileLayerControl extends StatelessWidget {
46
46
  keepBuffer: control.getInt("keep_buffer", 2)!,
47
47
  panBuffer: control.getInt("pan_buffer", 1)!,
48
48
  tms: control.getBool("enable_tms", false)!,
49
- tileBounds: parseLatLngBounds(control.get("tile_bounds")),
49
+ tileBounds: control.getLatLngBounds("tile_bounds"),
50
50
  retinaMode: control.getBool("enable_retina_mode"),
51
51
  maxZoom: control.getDouble("max_zoom", double.infinity)!,
52
52
  minZoom: control.getDouble("min_zoom", 0)!,
53
- evictErrorTileStrategy: parseEvictErrorTileStrategy(
54
- control.getString("evict_error_tile_strategy"),
55
- EvictErrorTileStrategy.none)!,
53
+ evictErrorTileStrategy: control.getEvictErrorTileStrategy(
54
+ "evict_error_tile_strategy", EvictErrorTileStrategy.none)!,
56
55
  errorImage: errorImage,
57
56
  errorTileCallback: (TileImage t, Object o, StackTrace? s) {
58
57
  control.triggerEvent("image_error", o.toString());
@@ -61,7 +60,7 @@ class TileLayerControl extends StatelessWidget {
61
60
  .get<Map>("additional_options")
62
61
  ?.map((k, v) => MapEntry(k.toString(), v.toString())) ??
63
62
  const {},
64
- wmsOptions: parseWMSTileLayerOptions(control.get("wms_configuration")),
63
+ wmsOptions: control.getWMSTileLayerOptions("wms_configuration"),
65
64
  );
66
65
 
67
66
  return BaseControl(control: control, child: tileLayer);
@@ -5,3 +5,10 @@ AttributionAlignment? parseAttributionAlignment(String? value,
5
5
  [AttributionAlignment? defaultValue]) {
6
6
  return parseEnum(AttributionAlignment.values, value, defaultValue);
7
7
  }
8
+
9
+ extension AttributionAlignmentControlExtension on Control {
10
+ AttributionAlignment? getAttributionAlignment(String propertyName,
11
+ [AttributionAlignment? defaultValue]) {
12
+ return parseAttributionAlignment(getString(propertyName), defaultValue);
13
+ }
14
+ }
@@ -153,10 +153,12 @@ KeyboardOptions? parseKeyboardOptions(dynamic value,
153
153
  parseDouble(value["rotate_leap_velocity_multiplier"], 3)!,
154
154
  zoomLeapVelocityMultiplier:
155
155
  parseDouble(value["zoom_leap_velocity_multiplier"], 3)!,
156
- performLeapTriggerDuration:
157
- parseDuration(value["perform_leap_trigger_duration"], const Duration(milliseconds: 100))!,
158
- animationCurveReverseDuration:
159
- parseDuration(value["animation_curve_reverse_duration"], const Duration(milliseconds: 600))!);
156
+ performLeapTriggerDuration: parseDuration(
157
+ value["perform_leap_trigger_duration"],
158
+ const Duration(milliseconds: 100))!,
159
+ animationCurveReverseDuration: parseDuration(
160
+ value["animation_curve_reverse_duration"],
161
+ const Duration(milliseconds: 600))!);
160
162
  }
161
163
 
162
164
  CursorRotationBehaviour? parseCursorRotationBehaviour(String? value,
@@ -257,16 +259,16 @@ MapOptions? parseConfiguration(Control control, BuildContext context,
257
259
  [MapOptions? defaultValue]) {
258
260
  return MapOptions(
259
261
  initialCenter:
260
- parseLatLng(control.get("initial_center"), const LatLng(50.5, 30.51))!,
261
- interactionOptions: parseInteractionOptions(
262
- control.get("interaction_configuration"), const InteractionOptions())!,
262
+ control.getLatLng("initial_center", const LatLng(50.5, 30.51))!,
263
+ interactionOptions: control.getInteractionOptions(
264
+ "interaction_configuration", const InteractionOptions())!,
263
265
  backgroundColor: control.getColor("bgcolor", context, Colors.grey[300])!,
264
266
  initialRotation: control.getDouble("initial_rotation", 0.0)!,
265
267
  initialZoom: control.getDouble("initial_zoom", 13.0)!,
266
268
  keepAlive: control.getBool("keep_alive", false)!,
267
269
  maxZoom: control.getDouble("max_zoom"),
268
270
  minZoom: control.getDouble("min_zoom"),
269
- initialCameraFit: parseCameraFit(control.get("initial_camera_fit")),
271
+ initialCameraFit: control.getCameraFit("initial_camera_fit"),
270
272
  onPointerHover: control.hasEventHandler("hover")
271
273
  ? (PointerHoverEvent e, LatLng latlng) {
272
274
  control.triggerEvent("hover", {
@@ -393,3 +395,63 @@ extension MapEventExtension on MapEvent {
393
395
  };
394
396
  }
395
397
  }
398
+
399
+ extension MapParsersControlExtension on Control {
400
+ LatLng? getLatLng(String propertyName, [LatLng? defaultValue]) {
401
+ return parseLatLng(get(propertyName), defaultValue);
402
+ }
403
+
404
+ LatLngBounds? getLatLngBounds(String propertyName,
405
+ [LatLngBounds? defaultValue]) {
406
+ return parseLatLngBounds(get(propertyName), defaultValue);
407
+ }
408
+
409
+ List<LatLng> getLatLngList(String propertyName,
410
+ [List<LatLng> defaultValue = const []]) {
411
+ return get<List>(propertyName)
412
+ ?.map((c) => parseLatLng(c))
413
+ .nonNulls
414
+ .toList() ??
415
+ defaultValue;
416
+ }
417
+
418
+ StrokePattern? getStrokePattern(String propertyName,
419
+ [StrokePattern? defaultValue]) {
420
+ return parseStrokePattern(get(propertyName), defaultValue);
421
+ }
422
+
423
+ TileDisplay? getTileDisplay(String propertyName,
424
+ [TileDisplay? defaultValue]) {
425
+ return parseTileDisplay(get(propertyName), defaultValue);
426
+ }
427
+
428
+ InteractionOptions? getInteractionOptions(String propertyName,
429
+ [InteractionOptions? defaultValue]) {
430
+ return parseInteractionOptions(get(propertyName), defaultValue);
431
+ }
432
+
433
+ CameraFit? getCameraFit(String propertyName, [CameraFit? defaultValue]) {
434
+ return parseCameraFit(get(propertyName), defaultValue);
435
+ }
436
+
437
+ KeyboardOptions? getKeyboardOptions(String propertyName,
438
+ [KeyboardOptions? defaultValue]) {
439
+ return parseKeyboardOptions(get(propertyName), defaultValue);
440
+ }
441
+
442
+ CursorKeyboardRotationOptions? getCursorKeyboardRotationOptions(
443
+ String propertyName,
444
+ [CursorKeyboardRotationOptions? defaultValue]) {
445
+ return parseCursorKeyboardRotationOptions(get(propertyName), defaultValue);
446
+ }
447
+
448
+ EvictErrorTileStrategy? getEvictErrorTileStrategy(String propertyName,
449
+ [EvictErrorTileStrategy? defaultValue]) {
450
+ return parseEvictErrorTileStrategy(getString(propertyName), defaultValue);
451
+ }
452
+
453
+ WMSTileLayerOptions? getWMSTileLayerOptions(String propertyName,
454
+ [WMSTileLayerOptions? defaultValue]) {
455
+ return parseWMSTileLayerOptions(get(propertyName), defaultValue);
456
+ }
457
+ }
@@ -12,7 +12,7 @@ dependencies:
12
12
  sdk: flutter
13
13
 
14
14
  collection: ^1.16.0
15
- flutter_map: 8.2.2
15
+ flutter_map: ^8.3.0
16
16
  flutter_map_animations: 0.9.0
17
17
  latlong2: 0.9.1
18
18
 
@@ -1 +0,0 @@
1
- flet==0.85.0.dev0
File without changes
File without changes