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

Commit f0d097e

Browse files
Merge pull request #3 from flet-dev/v1
flet-flashlight v1
2 parents a12a122 + d3ae3e5 commit f0d097e

30 files changed

+754
-209
lines changed

.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_flashlight/**'
15+
- 'examples/flashlight_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: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
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-flashlight/
13+
- `Flashlight` control new properties: `on`, `on_error`
14+
- `Flashlight` control new methods: `is_available_async`
15+
- New exception classes:
16+
- `FlashlightException`
17+
- `FlashlightEnableExistentUserException`
18+
- `FlashlightEnableNotAvailableException`
19+
- `FlashlightEnableException`
20+
- `FlashlightDisableExistentUserException`
21+
- `FlashlightDisableNotAvailableException`
22+
- `FlashlightDisableException`
23+
24+
### Changed
25+
26+
- Refactored `Flashlight` control to use `@ft.control` dataclass-style definition and switched to `Service` control type.
27+
- `Flashlight` must now be added to `Page.services` instead of `Page.overlay` due to control type change.
28+
29+
## [0.1.0] - 2025-01-15
30+
31+
Initial release.
32+
33+
34+
[0.2.0]: https://github.com/flet-dev/flet-flashlight/compare/0.1.0...0.2.0
35+
[0.1.0]: https://github.com/flet-dev/flet-flashlight/releases/tag/0.1.0

README.md

Lines changed: 37 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,46 @@
1-
# Flashlight control for Flet
1+
# flet-flashlight
22

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

5-
## Usage
7+
A [Flet](https://flet.dev) extension to manage the device torch/flashlight.
68

7-
Add `flet-flashlight` as dependency (`pyproject.toml` or `requirements.txt`) to your Flet project.
9+
It is based on the [flashlight](https://pub.dev/packages/flashlight) 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-flashlight/).
1214

13-
import flet as ft
15+
## Platform Support
1416

15-
import flet_flashlight as ffl
17+
This package supports the following platforms:
1618

17-
def main(page: ft.Page):
18-
flashlight = ffl.Flashlight()
19-
page.overlay.append(flashlight)
20-
page.add(
21-
ft.TextButton("toggle", on_click=lambda _: flashlight.toggle())
22-
)
19+
| Platform | Supported |
20+
|----------|:---------:|
21+
| Windows ||
22+
| macOS ||
23+
| Linux ||
24+
| iOS ||
25+
| Android ||
26+
| Web ||
2327

24-
ft.app(main)
25-
```
28+
## Installation
29+
30+
To install the `flet-flashlight` package and add it to your project dependencies:
31+
32+
- Using `uv`:
33+
```bash
34+
uv add flet-flashlight
35+
```
36+
37+
- Using `pip`:
38+
```bash
39+
pip install flet-flashlight
40+
```
41+
After this, you will have to manually add this package to your `requirements.txt` or `pyproject.toml`.
42+
43+
- Using `poetry`:
44+
```bash
45+
poetry add flet-flashlight
46+
```

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"
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
::: flet_flashlight.exceptions.FlashlightDisableException
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
::: flet_flashlight.exceptions.FlashlightDisableExistentUserException
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
::: flet_flashlight.exceptions.FlashlightDisableNotAvailableException
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
::: flet_flashlight.exceptions.FlashlightEnableException

0 commit comments

Comments
 (0)