Skip to content
This repository was archived by the owner on Dec 24, 2025. It is now read-only.

Commit 4c5ee7d

Browse files
authored
Merge pull request #5 from flet-dev/v1
flet-map v1
2 parents dfa3cf6 + 93f5826 commit 4c5ee7d

82 files changed

Lines changed: 3343 additions & 2936 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/docs.yml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: docs
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- 'LICENSE'
9+
- 'CHANGELOG.md'
10+
- 'docs/**'
11+
- 'mkdocs.yml'
12+
- 'pyproject.toml'
13+
- '.github/workflows/docs.yml'
14+
- 'src/flet_map/**'
15+
- 'examples/map_example/src/**'
16+
17+
workflow_dispatch: # Allow manual trigger from the GitHub Actions UI
18+
19+
concurrency:
20+
group: "docs" # Prevent multiple overlapping deploys
21+
cancel-in-progress: false # Allow in-progress deploys to finish
22+
23+
permissions:
24+
contents: write # Required to push to the gh-pages branch
25+
26+
env:
27+
GH_TOKEN: ${{ secrets.GH_TOKEN }} # Token used by mkdocs for pushing
28+
UV_SYSTEM_PYTHON: 1 # Use system Python interpreter with uv
29+
30+
jobs:
31+
deploy:
32+
name: Deploy Documentation
33+
runs-on: ubuntu-latest
34+
if: github.repository == github.event.repository.full_name # don't run on forks
35+
steps:
36+
- name: Checkout repository
37+
uses: actions/checkout@v4
38+
39+
- name: Configure Git for mkdocs
40+
run: |
41+
git config user.name github-actions[bot]
42+
git config user.email 41898282+github-actions[bot]@users.noreply.github.com
43+
44+
- name: Install uv
45+
uses: astral-sh/setup-uv@v6
46+
47+
- name: Set up Python
48+
uses: actions/setup-python@v5
49+
with:
50+
python-version-file: "pyproject.toml" # Match Python version with project config
51+
52+
- name: Install dependencies
53+
run: |
54+
uv pip install -e .
55+
uv pip install --group docs
56+
57+
- name: Deploy to GitHub Pages
58+
run: uv run mkdocs gh-deploy --force

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@
22
build/
33
develop-eggs/
44
dist/
5-
.DS_store
5+
.DS_store
6+
.venv/

.pre-commit-config.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
repos:
2+
- repo: https://github.com/pycqa/isort
3+
rev: 5.13.2
4+
hooks:
5+
- id: isort
6+
- repo: https://github.com/ambv/black
7+
rev: 22.12.0
8+
hooks:
9+
- id: black

CHANGELOG.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
6+
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
7+
8+
## [0.2.0] - 2025-06-26
9+
10+
### Added
11+
12+
- Deployed online documentation: https://flet-dev.github.io/flet-map/
13+
- New controls:
14+
- `SourceAttribution`
15+
- `ImageSourceAttribution`
16+
- New types:
17+
- `Camera`
18+
- `CameraFit`
19+
- `CursorKeyboardRotationConfiguration`
20+
- `CursorRotationBehaviour`
21+
- `KeyboardConfiguration`
22+
23+
24+
25+
### Changed
26+
27+
- Refactored all controls to use `@flet.control` dataclass-style definition.
28+
- The following classes were renamed:
29+
- `MapInteractionConfiguration``InteractionConfiguration`
30+
- `MapInteractiveFlag``InteractionFlag`
31+
- `MapMultiFingerGesture``MultiFingerGesture`
32+
- `MapTileLayerEvictErrorTileStrategy``TileLayerEvictErrorTileStrategy`
33+
34+
## [0.1.0] - 2025-01-15
35+
36+
Initial release.
37+
38+
39+
[0.2.0]: https://github.com/flet-dev/flet-map/compare/0.1.0...0.2.0
40+
[0.1.0]: https://github.com/flet-dev/flet-map/releases/tag/0.1.0

README.md

Lines changed: 37 additions & 141 deletions
Original file line numberDiff line numberDiff line change
@@ -1,154 +1,50 @@
1-
# Map control for Flet
1+
# flet-map
22

3-
`Map` control for Flet.
3+
[![pypi](https://img.shields.io/pypi/v/flet-map.svg)](https://pypi.python.org/pypi/flet-map)
4+
[![downloads](https://static.pepy.tech/badge/flet-map/month)](https://pepy.tech/project/flet-map)
5+
[![license](https://img.shields.io/github/license/flet-dev/flet-map.svg)](https://github.com/flet-dev/flet-map/blob/main/LICENSE)
46

5-
## Usage
7+
A [Flet](https://flet.dev) extension for displaying interactive maps.
68

7-
Add `flet-map` as dependency (`pyproject.toml` or `requirements.txt`) to your Flet project.
9+
It is based on the [flutter_map](https://pub.dev/packages/flutter_map) Flutter package.
810

9-
## Example
11+
## Documentation
1012

11-
```py
13+
Detailed documentation to this package can be found [here](https://flet-dev.github.io/flet-map/).
1214

13-
import random
14-
import flet as ft
15-
import flet_map as map
15+
## Platform Support
1616

17+
This package supports the following platforms:
1718

18-
def main(page: ft.Page):
19-
marker_layer_ref = ft.Ref[map.MarkerLayer]()
20-
circle_layer_ref = ft.Ref[map.CircleLayer]()
19+
| Platform | Supported |
20+
|----------|:---------:|
21+
| Windows ||
22+
| macOS ||
23+
| Linux ||
24+
| iOS ||
25+
| Android ||
26+
| Web ||
2127

22-
def handle_tap(e: map.MapTapEvent):
23-
print(e)
24-
if e.name == "tap":
25-
marker_layer_ref.current.markers.append(
26-
map.Marker(
27-
content=ft.Icon(
28-
ft.Icons.LOCATION_ON, color=ft.cupertino_colors.DESTRUCTIVE_RED
29-
),
30-
coordinates=e.coordinates,
31-
)
32-
)
33-
elif e.name == "secondary_tap":
34-
circle_layer_ref.current.circles.append(
35-
map.CircleMarker(
36-
radius=random.randint(5, 10),
37-
coordinates=e.coordinates,
38-
color=ft.Colors.random_color(),
39-
border_color=ft.Colors.random_color(),
40-
border_stroke_width=4,
41-
)
42-
)
43-
page.update()
28+
## Installation
4429

45-
def handle_event(e: map.MapEvent):
46-
print(e)
30+
To install the `flet-map` package and add it to your project dependencies:
4731

48-
page.add(
49-
ft.Text("Click anywhere to add a Marker, right-click to add a CircleMarker."),
50-
map.Map(
51-
expand=True,
52-
initial_center=map.MapLatitudeLongitude(15, 10),
53-
initial_zoom=4.2,
54-
interaction_configuration=map.MapInteractionConfiguration(
55-
flags=map.MapInteractiveFlag.ALL
56-
),
57-
on_init=lambda e: print(f"Initialized Map"),
58-
on_tap=handle_tap,
59-
on_secondary_tap=handle_tap,
60-
on_long_press=handle_tap,
61-
on_event=lambda e: print(e),
62-
layers=[
63-
map.TileLayer(
64-
url_template="https://tile.openstreetmap.org/{z}/{x}/{y}.png",
65-
on_image_error=lambda e: print("TileLayer Error"),
66-
),
67-
map.RichAttribution(
68-
attributions=[
69-
map.TextSourceAttribution(
70-
text="OpenStreetMap Contributors",
71-
on_click=lambda e: e.page.launch_url(
72-
"https://openstreetmap.org/copyright"
73-
),
74-
),
75-
map.TextSourceAttribution(
76-
text="Flet",
77-
on_click=lambda e: e.page.launch_url("https://flet.dev"),
78-
),
79-
]
80-
),
81-
map.SimpleAttribution(
82-
text="Flet",
83-
alignment=ft.alignment.top_right,
84-
on_click=lambda e: print("Clicked SimpleAttribution"),
85-
),
86-
map.MarkerLayer(
87-
ref=marker_layer_ref,
88-
markers=[
89-
map.Marker(
90-
content=ft.Icon(ft.Icons.LOCATION_ON),
91-
coordinates=map.MapLatitudeLongitude(30, 15),
92-
),
93-
map.Marker(
94-
content=ft.Icon(ft.Icons.LOCATION_ON),
95-
coordinates=map.MapLatitudeLongitude(10, 10),
96-
),
97-
map.Marker(
98-
content=ft.Icon(ft.Icons.LOCATION_ON),
99-
coordinates=map.MapLatitudeLongitude(25, 45),
100-
),
101-
],
102-
),
103-
map.CircleLayer(
104-
ref=circle_layer_ref,
105-
circles=[
106-
map.CircleMarker(
107-
radius=10,
108-
coordinates=map.MapLatitudeLongitude(16, 24),
109-
color=ft.Colors.RED,
110-
border_color=ft.Colors.BLUE,
111-
border_stroke_width=4,
112-
),
113-
],
114-
),
115-
map.PolygonLayer(
116-
polygons=[
117-
map.PolygonMarker(
118-
label="Popular Touristic Area",
119-
label_text_style=ft.TextStyle(
120-
color=ft.Colors.BLACK,
121-
size=15,
122-
weight=ft.FontWeight.BOLD,
123-
),
124-
color=ft.Colors.with_opacity(0.3, ft.Colors.BLUE),
125-
coordinates=[
126-
map.MapLatitudeLongitude(10, 10),
127-
map.MapLatitudeLongitude(30, 15),
128-
map.MapLatitudeLongitude(25, 45),
129-
],
130-
),
131-
],
132-
),
133-
map.PolylineLayer(
134-
polylines=[
135-
map.PolylineMarker(
136-
border_stroke_width=3,
137-
border_color=ft.Colors.RED,
138-
gradient_colors=[ft.Colors.BLACK, ft.Colors.BLACK],
139-
color=ft.Colors.with_opacity(0.6, ft.Colors.GREEN),
140-
coordinates=[
141-
map.MapLatitudeLongitude(10, 10),
142-
map.MapLatitudeLongitude(30, 15),
143-
map.MapLatitudeLongitude(25, 45),
144-
],
145-
),
146-
],
147-
),
148-
],
149-
),
150-
)
32+
- Using `uv`:
33+
```bash
34+
uv add flet-map
35+
```
15136

37+
- Using `pip`:
38+
```bash
39+
pip install flet-map
40+
```
41+
After this, you will have to manually add this package to your `requirements.txt` or `pyproject.toml`.
15242

153-
ft.app(main)
154-
```
43+
- Using `poetry`:
44+
```bash
45+
poetry add flet-map
46+
```
47+
48+
## Examples
49+
50+
For examples, see [this](./examples)

docs/changelog.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
title: Changelog
3+
---
4+
5+
--8<-- "CHANGELOG.md"

docs/circle_layer.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
::: flet_map.circle_layer.CircleLayer

docs/circle_marker.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
::: flet_map.circle_layer.CircleMarker

docs/image_source_attribution.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
::: flet_map.source_attribution.ImageSourceAttribution

docs/images/favicon.ico

15 KB
Binary file not shown.

0 commit comments

Comments
 (0)