Skip to content

flet-geolocator v1 #5

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 16 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 59 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: docs

on:
push:
branches:
- main
- v1
paths:
- 'LICENSE'
- 'CHANGELOG.md'
- 'docs/**'
- 'mkdocs.yml'
- 'pyproject.toml'
- '.github/workflows/docs.yml'
- 'src/flet_geolocator/**'
- 'examples/geolocator_example/src/**'

workflow_dispatch: # Allow manual trigger from the GitHub Actions UI

concurrency:
group: "docs" # Prevent multiple overlapping deploys
cancel-in-progress: false # Allow in-progress deploys to finish

permissions:
contents: write # Required to push to the gh-pages branch

env:
GH_TOKEN: ${{ secrets.GH_TOKEN }} # Token used by mkdocs for pushing
UV_SYSTEM_PYTHON: 1 # Use system Python interpreter with uv

jobs:
deploy:
name: Deploy Documentation
runs-on: ubuntu-latest
if: github.repository == github.event.repository.full_name # don't run on forks
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Configure Git for mkdocs
run: |
git config user.name github-actions[bot]
git config user.email 41898282+github-actions[bot]@users.noreply.github.com

- name: Install uv
uses: astral-sh/setup-uv@v6

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version-file: "pyproject.toml" # Match Python version with project config

- name: Install dependencies
run: |
uv pip install -e .
uv pip install --group docs

- name: Deploy to GitHub Pages
run: uv run mkdocs gh-deploy --force
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
build/
develop-eggs/
dist/
.DS_store
.DS_store
.venv/
9 changes: 9 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
repos:
- repo: https://github.com/pycqa/isort
rev: 5.13.2
hooks:
- id: isort
- repo: https://github.com/ambv/black
rev: 22.12.0
hooks:
- id: black
51 changes: 51 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## [Unreleased] - 2025-mm-dd

### Added

- Deployed online documentation: https://flet-dev.github.io/flet-geolocator/
- `Geolocator` control new methods: `distance_between_async`
- `Geolocator` control new properties: `position`, `configuration`
- New dataclasses:
- `GeolocatorConfiguration`
- `GeolocatorWebConfiguration`
- `GeolocatorIosConfiguration`
- `GeolocatorAndroidConfiguration`
- `ForegroundNotificationConfiguration`

### Changed

- Refactored `Geolocator` control to use `@ft.control` dataclass-style definition and switched to `Service` control type

#### Breaking Changes

- `Geolocator` must now be added to `Page.services` instead of `Page.overlay`.
- `Geolocator` method `get_current_position_async` parameters changed:
- removed `accuracy`
- `location_settings` renamed to `configuration` (type changed)
- `wait_timeout` renamed to `timeout`
- In all `Geolocator` methods, parameter `wait_timeout` renamed to `timeout`.
- Removed sync methods from `Geolocator`:
- `get_current_position` → use `get_current_position_async` instead
- `get_last_known_position` → use `get_last_known_position_async` instead
- `get_permission_status` → use `get_permission_status_async` instead
- `request_permission` → use `request_permission_async` instead
- `is_location_service_enabled` → use `is_location_service_enabled_async` instead
- `open_app_settings` → use `open_app_settings_async` instead
- `open_location_settings` → use `open_location_settings_async` instead
- Enum `GeolocatorActivityType` renamed to `GeolocatorIosActivityType`

## [0.1.0] - 2025-01-15

Initial release.


[Unreleased]: https://github.com/flet-dev/flet-lottie/compare/0.1.0...HEAD

[0.1.0]: https://github.com/flet-dev/flet-lottie/releases/tag/0.1.0
5 changes: 5 additions & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
title: Changelog
---

--8<-- "CHANGELOG.md"
1 change: 1 addition & 0 deletions docs/geolocator.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
::: flet_geolocator.geolocator.Geolocator
Binary file added docs/images/favicon.ico
Binary file not shown.
19 changes: 19 additions & 0 deletions docs/images/logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
58 changes: 58 additions & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# flet-geolocator

[![pypi](https://img.shields.io/pypi/v/flet-geolocator.svg)](https://pypi.python.org/pypi/flet-geolocator)
[![downloads](https://static.pepy.tech/badge/flet-geolocator/month)](https://pepy.tech/project/flet-geolocator)
[![license](https://img.shields.io/github/license/flet-dev/flet-geolocator.svg)](https://github.com/flet-dev/flet-geolocator/blob/main/LICENSE)

Adds geolocation capabilities to your Flet apps.

Features include:
- Get the last known location;
- Get the current location of the device;
- Get continuous location updates;
- Check if location services are enabled on the device.

It is based on the [geolocator](https://pub.dev/packages/geolocator) Flutter package.

## Platform Support

This package supports the following platforms:

| Platform | Supported |
|----------|:---------:|
| Windows | ✅ |
| macOS | ✅ |
| Linux | ✅ |
| iOS | ✅ |
| Android | ✅ |
| Web | ✅ |

## Usage

### Installation

To install the `flet-geolocator` package and add it to your project dependencies:

=== "uv"
```bash
uv add flet-geolocator
```

=== "pip"
```bash
pip install flet-geolocator # (1)!
```

1. After this, you will have to manually add this package to your `requirements.txt` or `pyproject.toml`.

=== "poetry"
```bash
poetry add flet-geolocator
```


## Example

```python title="main.py"
--8<-- "examples/geolocator_example/src/main.py"
```
7 changes: 7 additions & 0 deletions docs/license.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
title: Licence
---

```
--8<-- "LICENSE"
```
1 change: 1 addition & 0 deletions docs/types/foreground_notification_configuration.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
::: flet_geolocator.types.ForegroundNotificationConfiguration
1 change: 1 addition & 0 deletions docs/types/geolocator_android_configuration.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
::: flet_geolocator.types.GeolocatorAndroidConfiguration
1 change: 1 addition & 0 deletions docs/types/geolocator_configuration.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
::: flet_geolocator.types.GeolocatorPosition
1 change: 1 addition & 0 deletions docs/types/geolocator_ios_activity_type.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
::: flet_geolocator.types.GeolocatorIosActivityType
1 change: 1 addition & 0 deletions docs/types/geolocator_ios_configuration.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
::: flet_geolocator.types.GeolocatorIosConfiguration
1 change: 1 addition & 0 deletions docs/types/geolocator_permission_status.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
::: flet_geolocator.types.GeolocatorPermissionStatus
1 change: 1 addition & 0 deletions docs/types/geolocator_position.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
::: flet_geolocator.types.GeolocatorPosition
1 change: 1 addition & 0 deletions docs/types/geolocator_position_accuracy.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
::: flet_geolocator.types.GeolocatorPositionAccuracy
1 change: 1 addition & 0 deletions docs/types/geolocator_position_change_event.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
::: flet_geolocator.types.GeolocatorPositionChangeEvent
1 change: 1 addition & 0 deletions docs/types/geolocator_web_configuration.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
::: flet_geolocator.types.GeolocatorWebConfiguration
31 changes: 9 additions & 22 deletions examples/geolocator_example/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,34 +1,21 @@
[project]
name = "geolocator_example"
name = "flet-geolocator-example"
version = "1.0.0"
description = ""
description = "flet-geolocator-example"
readme = "README.md"
requires-python = ">=3.8"
license = "Apache-2.0"
requires-python = ">=3.10"
dependencies = [
"flet-geolocator @ git+https://github.com/flet-dev/flet-geolocator.git",
"flet>=0.25.2",
"flet-geolocator",
"flet",
]


# Docs: https://flet.dev/docs/publish
[tool.flet]
# org name in reverse domain name notation, e.g. "com.mycompany".
# Combined with project.name to build bundle ID for iOS and Android apps
org = "com.mycompany"

# project display name that is used as an app title on Android and iOS home screens,
# shown in window titles and about app dialogs on desktop.
product = "Flet Geolocator Example"

# company name to display in about app dialogs
product = "flet-geolocator-example"
company = "Flet"

# copyright text to display in about app dialogs
copyright = "Copyright (C) 2024 by Flet"
copyright = "Copyright (C) 2025 by Flet"

[tool.flet.app]
path = "src"

[tool.uv]
dev-dependencies = [
"flet[all]>=0.25.2",
]
Loading