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
@@ -2,7 +2,8 @@ name: flet_map
2
2
  description: Flet Map control
3
3
  homepage: https://flet.dev
4
4
  repository: https://github.com/flet-dev/flet-map/src/flutter/flet_map
5
- version: 0.1.0
5
+ version: 0.2.0
6
+ publish_to: none
6
7
  environment:
7
8
  sdk: '>=3.2.3 <4.0.0'
8
9
  flutter: '>=1.17.0'
@@ -10,11 +11,15 @@ dependencies:
10
11
  flutter:
11
12
  sdk: flutter
12
13
  collection: ^1.16.0
13
- flutter_map: ^7.0.2
14
- flutter_map_animations: ^0.8.0
15
- flutter_map_cancellable_tile_provider: ^3.0.2
14
+ flutter_map: ^8.1.1
15
+ flutter_map_animations: ^0.9.0
16
+ flutter_map_cancellable_tile_provider: ^3.1.0
16
17
  latlong2: ^0.9.1
17
- flet: ^0.25.2
18
+ flet:
19
+ git:
20
+ url: https://github.com/flet-dev/flet.git
21
+ path: packages/flet
22
+ ref: v1
18
23
  dev_dependencies:
19
24
  flutter_test:
20
25
  sdk: flutter
@@ -1,87 +0,0 @@
1
- from typing import Any, Optional
2
-
3
- from flet.core.control import Control
4
- from flet.core.ref import Ref
5
- from flet.core.text_style import TextStyle
6
- from flet.core.types import OptionalControlEventCallable
7
-
8
-
9
- class TextSourceAttribution(Control):
10
- """
11
- A text source attribution displayed on the Map.
12
- For it to be displayed, it should be part of a RichAttribution.attributions list.
13
-
14
- -----
15
-
16
- Online docs: https://flet.dev/docs/controls/maptextsourceattribution
17
- """
18
-
19
- def __init__(
20
- self,
21
- text: str,
22
- text_style: Optional[TextStyle] = None,
23
- prepend_copyright: Optional[bool] = None,
24
- on_click: OptionalControlEventCallable = None,
25
- #
26
- # Control
27
- #
28
- ref: Optional[Ref] = None,
29
- visible: Optional[bool] = None,
30
- data: Any = None,
31
- ):
32
-
33
- Control.__init__(
34
- self,
35
- ref=ref,
36
- visible=visible,
37
- data=data,
38
- )
39
-
40
- self.text = text
41
- self.text_style = text_style
42
- self.prepend_copyright = prepend_copyright
43
- self.on_click = on_click
44
-
45
- def _get_control_name(self):
46
- return "map_text_source_attribution"
47
-
48
- def before_update(self):
49
- super().before_update()
50
- if isinstance(self.__text_style, TextStyle):
51
- self._set_attr_json("textStyle", self.__text_style)
52
-
53
- # text_style
54
- @property
55
- def text_style(self) -> Optional[TextStyle]:
56
- return self.__text_style
57
-
58
- @text_style.setter
59
- def text_style(self, value: Optional[TextStyle]):
60
- self.__text_style = value
61
-
62
- # prepend_copyright
63
- @property
64
- def prepend_copyright(self) -> bool:
65
- return self._get_attr("prependCopyright", data_type="bool", def_value=True)
66
-
67
- @prepend_copyright.setter
68
- def prepend_copyright(self, value: Optional[bool]):
69
- self._set_attr("prependCopyright", value)
70
-
71
- # text
72
- @property
73
- def text(self) -> str:
74
- return self._get_attr("text")
75
-
76
- @text.setter
77
- def text(self, value: str):
78
- self._set_attr("text", value)
79
-
80
- # on_click
81
- @property
82
- def on_click(self) -> OptionalControlEventCallable:
83
- return self._get_event_handler("click")
84
-
85
- @on_click.setter
86
- def on_click(self, handler: OptionalControlEventCallable):
87
- self._add_event_handler("click", handler)
@@ -1,168 +0,0 @@
1
- Metadata-Version: 2.2
2
- Name: flet-map
3
- Version: 0.1.0
4
- Summary: Map control for Flet
5
- Author-email: Flet contributors <hello@flet.dev>
6
- Project-URL: Homepage, https://flet.dev
7
- Project-URL: Documentation, https://flet.dev/docs/controls/map
8
- Project-URL: Repository, https://github.com/flet-dev/flet-map
9
- Project-URL: Issues, https://github.com/flet-dev/flet-map/issues
10
- Classifier: License :: OSI Approved :: Apache Software License
11
- Requires-Python: >=3.8
12
- Description-Content-Type: text/markdown
13
- Requires-Dist: flet>=0.25.2
14
-
15
- # Map control for Flet
16
-
17
- `Map` control for Flet.
18
-
19
- ## Usage
20
-
21
- Add `flet-map` as dependency (`pyproject.toml` or `requirements.txt`) to your Flet project.
22
-
23
- ## Example
24
-
25
- ```py
26
-
27
- import random
28
- import flet as ft
29
- import flet_map as map
30
-
31
-
32
- def main(page: ft.Page):
33
- marker_layer_ref = ft.Ref[map.MarkerLayer]()
34
- circle_layer_ref = ft.Ref[map.CircleLayer]()
35
-
36
- def handle_tap(e: map.MapTapEvent):
37
- print(e)
38
- if e.name == "tap":
39
- marker_layer_ref.current.markers.append(
40
- map.Marker(
41
- content=ft.Icon(
42
- ft.Icons.LOCATION_ON, color=ft.cupertino_colors.DESTRUCTIVE_RED
43
- ),
44
- coordinates=e.coordinates,
45
- )
46
- )
47
- elif e.name == "secondary_tap":
48
- circle_layer_ref.current.circles.append(
49
- map.CircleMarker(
50
- radius=random.randint(5, 10),
51
- coordinates=e.coordinates,
52
- color=ft.Colors.random_color(),
53
- border_color=ft.Colors.random_color(),
54
- border_stroke_width=4,
55
- )
56
- )
57
- page.update()
58
-
59
- def handle_event(e: map.MapEvent):
60
- print(e)
61
-
62
- page.add(
63
- ft.Text("Click anywhere to add a Marker, right-click to add a CircleMarker."),
64
- map.Map(
65
- expand=True,
66
- initial_center=map.MapLatitudeLongitude(15, 10),
67
- initial_zoom=4.2,
68
- interaction_configuration=map.MapInteractionConfiguration(
69
- flags=map.MapInteractiveFlag.ALL
70
- ),
71
- on_init=lambda e: print(f"Initialized Map"),
72
- on_tap=handle_tap,
73
- on_secondary_tap=handle_tap,
74
- on_long_press=handle_tap,
75
- on_event=lambda e: print(e),
76
- layers=[
77
- map.TileLayer(
78
- url_template="https://tile.openstreetmap.org/{z}/{x}/{y}.png",
79
- on_image_error=lambda e: print("TileLayer Error"),
80
- ),
81
- map.RichAttribution(
82
- attributions=[
83
- map.TextSourceAttribution(
84
- text="OpenStreetMap Contributors",
85
- on_click=lambda e: e.page.launch_url(
86
- "https://openstreetmap.org/copyright"
87
- ),
88
- ),
89
- map.TextSourceAttribution(
90
- text="Flet",
91
- on_click=lambda e: e.page.launch_url("https://flet.dev"),
92
- ),
93
- ]
94
- ),
95
- map.SimpleAttribution(
96
- text="Flet",
97
- alignment=ft.alignment.top_right,
98
- on_click=lambda e: print("Clicked SimpleAttribution"),
99
- ),
100
- map.MarkerLayer(
101
- ref=marker_layer_ref,
102
- markers=[
103
- map.Marker(
104
- content=ft.Icon(ft.Icons.LOCATION_ON),
105
- coordinates=map.MapLatitudeLongitude(30, 15),
106
- ),
107
- map.Marker(
108
- content=ft.Icon(ft.Icons.LOCATION_ON),
109
- coordinates=map.MapLatitudeLongitude(10, 10),
110
- ),
111
- map.Marker(
112
- content=ft.Icon(ft.Icons.LOCATION_ON),
113
- coordinates=map.MapLatitudeLongitude(25, 45),
114
- ),
115
- ],
116
- ),
117
- map.CircleLayer(
118
- ref=circle_layer_ref,
119
- circles=[
120
- map.CircleMarker(
121
- radius=10,
122
- coordinates=map.MapLatitudeLongitude(16, 24),
123
- color=ft.Colors.RED,
124
- border_color=ft.Colors.BLUE,
125
- border_stroke_width=4,
126
- ),
127
- ],
128
- ),
129
- map.PolygonLayer(
130
- polygons=[
131
- map.PolygonMarker(
132
- label="Popular Touristic Area",
133
- label_text_style=ft.TextStyle(
134
- color=ft.Colors.BLACK,
135
- size=15,
136
- weight=ft.FontWeight.BOLD,
137
- ),
138
- color=ft.Colors.with_opacity(0.3, ft.Colors.BLUE),
139
- coordinates=[
140
- map.MapLatitudeLongitude(10, 10),
141
- map.MapLatitudeLongitude(30, 15),
142
- map.MapLatitudeLongitude(25, 45),
143
- ],
144
- ),
145
- ],
146
- ),
147
- map.PolylineLayer(
148
- polylines=[
149
- map.PolylineMarker(
150
- border_stroke_width=3,
151
- border_color=ft.Colors.RED,
152
- gradient_colors=[ft.Colors.BLACK, ft.Colors.BLACK],
153
- color=ft.Colors.with_opacity(0.6, ft.Colors.GREEN),
154
- coordinates=[
155
- map.MapLatitudeLongitude(10, 10),
156
- map.MapLatitudeLongitude(30, 15),
157
- map.MapLatitudeLongitude(25, 45),
158
- ],
159
- ),
160
- ],
161
- ),
162
- ],
163
- ),
164
- )
165
-
166
-
167
- ft.app(main)
168
- ```
@@ -1,34 +0,0 @@
1
- flet_map/__init__.py,sha256=xmGk-KtjPbkpMoj3kR40zmzTQF4mGwtq_lyC0M8groQ,927
2
- flet_map/circle_layer.py,sha256=TBydZRXPvRvdkIutUMux8hQQwVzeb-yYjVjkByb68os,4111
3
- flet_map/map.py,sha256=MkRKtESgSgo2DWjCQAiwOWt7ywR6L_NF3CNwEeidEfw,23150
4
- flet_map/map_layer.py,sha256=9Uwn3vzuDevpBjH9gH8YIA0xnqog7u1rLiZEpVPI_wM,490
5
- flet_map/marker_layer.py,sha256=PXNPTxmpzFVu3-ltPjsaPBbTLX8EwVOXX9slv_S9Dpc,4576
6
- flet_map/polygon_layer.py,sha256=ovxQX_qzg6CJ2hfZy2VWmz68Z1eoiohduPs63ZxjIUo,7877
7
- flet_map/polyline_layer.py,sha256=eCTxA64Of-Q8V69XetHdHlIQl9aDQz-QiYYurTUQxp0,8560
8
- flet_map/rich_attribution.py,sha256=1-GqK75MiDN0EU4YUCqFLvcXFNmpoulHwVF4ai-0hv8,4575
9
- flet_map/simple_attribution.py,sha256=31b6WEwSOZWDO5WtEpYcV8mI-vaXR5DPqbOc_tDCNLA,2149
10
- flet_map/text_source_attribution.py,sha256=BPqT2Ph8kISnBnfzs5v_i-uKEP5JZfxwe-wZ7qEdBRE,2340
11
- flet_map/tile_layer.py,sha256=7pNIvrKbzggry7oUXWYNt5xySybEJNe3e2FUAS2Q42s,9113
12
- flutter/flet_map/CHANGELOG.md,sha256=66sWepPaeTc9_lzcYIGU55AlxSU5Z1XVtknXpzd_-p8,40
13
- flutter/flet_map/LICENSE,sha256=QwcOLU5TJoTeUhuIXzhdCEEDDvorGiC6-3YTOl4TecE,11356
14
- flutter/flet_map/README.md,sha256=ABBaDRlbz2HalnmHeD_Y8KyT1JCh4Axkl1cqv4vFZqI,56
15
- flutter/flet_map/analysis_options.yaml,sha256=32kjGAc-zF87inWaH5M46yGZWQDTwrwfvNLHeAocfG4,154
16
- flutter/flet_map/pubspec.lock,sha256=U5N7CBWNVdN5z-4SMc1YjF6LJKSj77OK87SQ_Jj1CyA,24554
17
- flutter/flet_map/pubspec.yaml,sha256=8YTcl_p4ZoQmKhpY4fiFOPKsnag9LnPhl3k_eOKARtU,493
18
- flutter/flet_map/lib/flet_map.dart,sha256=PdaEb2aoyBwp978wal3-9I0docgp0eUzcAub3kw7MUs,91
19
- flutter/flet_map/lib/src/circle_layer.dart,sha256=HYfop2lkeZnxb4tXtUWps1FMrQWiuHkQRP8QEinh3pI,1482
20
- flutter/flet_map/lib/src/create_control.dart,sha256=JjtTXKyYAxbrA3Ys0P6OmC9wtplFr-iezzr3N3gTtaQ,1814
21
- flutter/flet_map/lib/src/map.dart,sha256=EUOWt0LDRXodGl0B-fjTUbKt48JCAp2ruWuFSkHjw8o,5152
22
- flutter/flet_map/lib/src/marker_layer.dart,sha256=KYk9Sdo8cV8objkIjmwnurx0ByKlCrAoHy09h_i_k2k,1731
23
- flutter/flet_map/lib/src/polygon_layer.dart,sha256=iuYUwu2qNKT-duzdxbYtffAal9PS6wDOfYALLuknAOE,2667
24
- flutter/flet_map/lib/src/polyline_layer.dart,sha256=pDBoScHBhOpRjSOddW09OYLDP09V211T4UEQS17hTgM,3122
25
- flutter/flet_map/lib/src/rich_attribution.dart,sha256=jFmjrvSZjem5aXFP22SXmtwckQYkYoDc-b2M441W54U,2226
26
- flutter/flet_map/lib/src/simple_attribution.dart,sha256=9Ac2pL7MaIDlZ-e5SrHHRDwxgx9D3YZwRh-5buLMXew,1141
27
- flutter/flet_map/lib/src/text_source_attribution.dart,sha256=fwqZ_T9dvRZdBgaMGSNJkjtdLAodKR3VNSgw9guL06g,865
28
- flutter/flet_map/lib/src/tile_layer.dart,sha256=UqvnaCr4QquUs5KnuBB7la085cCfGWvjaqjX6E2qIO0,3092
29
- flutter/flet_map/lib/src/utils/attribution_alignment.dart,sha256=xuj188pAUG2mfcBVNbyUSZGVz-dlJua-bnu5fdojMQQ,382
30
- flutter/flet_map/lib/src/utils/map.dart,sha256=c8ynRMHtl6GGEgXJYL0Vwk8LYdKW-3MsW0ybz6LMnCw,9205
31
- flet_map-0.1.0.dist-info/METADATA,sha256=AtoHA3SzxxSj_vEzn1KZp6EOxuUS8o5gXObJTNqsGGQ,6245
32
- flet_map-0.1.0.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
33
- flet_map-0.1.0.dist-info/top_level.txt,sha256=HjaN5dGb0-hj6ciqBzy1aqisp22P0mbT98qC8rvoEjg,17
34
- flet_map-0.1.0.dist-info/RECORD,,
@@ -1,70 +0,0 @@
1
- import 'package:flet/flet.dart';
2
-
3
- import 'circle_layer.dart';
4
- import 'map.dart';
5
- import 'marker_layer.dart';
6
- import 'polygon_layer.dart';
7
- import 'polyline_layer.dart';
8
- import 'rich_attribution.dart';
9
- import 'simple_attribution.dart';
10
- import 'tile_layer.dart';
11
-
12
- CreateControlFactory createControl = (CreateControlArgs args) {
13
- switch (args.control.type) {
14
- case "map":
15
- return MapControl(
16
- parent: args.parent,
17
- control: args.control,
18
- children: args.children,
19
- parentDisabled: args.parentDisabled,
20
- backend: args.backend,
21
- );
22
- case "map_rich_attribution":
23
- return RichAttributionControl(
24
- parent: args.parent,
25
- control: args.control,
26
- backend: args.backend,
27
- );
28
- case "map_simple_attribution":
29
- return SimpleAttributionControl(
30
- parent: args.parent,
31
- control: args.control,
32
- backend: args.backend,
33
- );
34
- case "map_tile_layer":
35
- return TileLayerControl(
36
- parent: args.parent,
37
- control: args.control,
38
- backend: args.backend,
39
- );
40
- case "map_marker_layer":
41
- return MarkerLayerControl(
42
- parent: args.parent,
43
- control: args.control,
44
- children: args.children,
45
- parentDisabled: args.parentDisabled,
46
- );
47
- case "map_circle_layer":
48
- return CircleLayerControl(
49
- parent: args.parent,
50
- control: args.control,
51
- );
52
- case "map_polygon_layer":
53
- return PolygonLayerControl(
54
- parent: args.parent,
55
- control: args.control,
56
- );
57
- case "map_polyline_layer":
58
- return PolylineLayerControl(
59
- parent: args.parent,
60
- control: args.control,
61
- children: args.children,
62
- );
63
- default:
64
- return null;
65
- }
66
- };
67
-
68
- void ensureInitialized() {
69
- // nothing to initialize
70
- }
@@ -1,29 +0,0 @@
1
- import 'package:flet/flet.dart';
2
- import 'package:flutter/material.dart';
3
- import 'package:flutter_map/flutter_map.dart';
4
-
5
- class TextSourceAttributionControl extends StatelessWidget {
6
- final Control? parent;
7
- final Control control;
8
- final FletControlBackend backend;
9
-
10
- const TextSourceAttributionControl(
11
- {super.key,
12
- required this.parent,
13
- required this.control,
14
- required this.backend});
15
-
16
- @override
17
- Widget build(BuildContext context) {
18
- debugPrint("TextSourceAttributionControl build: ${control.id}");
19
-
20
- return TextSourceAttribution(
21
- control.attrString("text", "Placeholder Text")!,
22
- textStyle: parseTextStyle(Theme.of(context), control, "textStyle"),
23
- onTap: () {
24
- backend.triggerControlEvent(control.id, "click");
25
- },
26
- prependCopyright: control.attrBool("prependCopyright", true)!,
27
- );
28
- }
29
- }