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

Commit 3553980

Browse files
committed
docs update
1 parent ed8be1e commit 3553980

File tree

6 files changed

+95
-32
lines changed

6 files changed

+95
-32
lines changed

docs/index.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,32 @@ This package supports the following platforms:
2121
| Android ||
2222
| Web ||
2323

24+
## Usage
25+
26+
### Installation
27+
28+
To install the `flet-flashlight` package and add it to your project dependencies:
29+
30+
=== "uv"
31+
32+
```bash
33+
uv add flet-flashlight
34+
```
35+
36+
=== "pip"
37+
38+
```bash
39+
pip install flet-flashlight
40+
```
41+
42+
You will have to manually add this package to your `requirements.txt` or `pyproject.toml`.
43+
44+
=== "poetry"
45+
46+
```bash
47+
poetry add flet-flashlight
48+
```
49+
2450
## Example
2551

2652
```python title="main.py"
Lines changed: 3 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[project]
2-
name = "flashlight_example"
2+
name = "flet-flashlight-example"
33
version = "1.0.0"
4-
description = "Flet Flashlight Example"
4+
description = "flet-flashlight-example"
55
readme = "README.md"
66
license = "Apache-2.0"
77
requires-python = ">=3.10"
@@ -14,26 +14,9 @@ dependencies = [
1414
# Docs: https://flet.dev/docs/publish
1515
[tool.flet]
1616
org = "com.mycompany"
17-
product = "Flet Flashlight Example"
17+
product = "flet-flashlight-example"
1818
company = "Flet"
1919
copyright = "Copyright (C) 2024 by Flet"
2020

2121
[tool.flet.app]
2222
path = "src"
23-
24-
[tool.flet.dev_packages]
25-
flet-flashlight = "../.." # relative path
26-
flet = "git+https://github.com/flet-dev/flet.git@v1#subdirectory=sdk/python/packages/flet"
27-
28-
[tool.uv]
29-
dev-dependencies = [
30-
"flet",
31-
"flet-cli",
32-
"flet-desktop",
33-
]
34-
35-
[tool.uv.sources]
36-
flet-flashlight = { path = "../../", editable = true }
37-
flet = { git = "https://github.com/flet-dev/flet", subdirectory = "sdk/python/packages/flet", rev = "v1" }
38-
flet-cli = { git = "https://github.com/flet-dev/flet", subdirectory = "sdk/python/packages/flet-cli", rev = "v1" }
39-
flet-desktop = { git = "https://github.com/flet-dev/flet", subdirectory = "sdk/python/packages/flet-desktop", rev = "v1" }

examples/flashlight_example/src/main.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,12 @@
22

33
import flet_flashlight as ffl
44

5+
56
def main(page: ft.Page):
67
flashlight = ffl.Flashlight()
7-
page.overlay.append(flashlight)
8-
page.add(
9-
ft.TextButton("toggle", on_click=lambda _: flashlight.toggle())
10-
)
8+
page.services.append(flashlight)
9+
10+
page.add(ft.TextButton("toggle", on_click=lambda _: flashlight.toggle()))
11+
1112

12-
ft.app(main)
13+
ft.run(main)

mkdocs.yml

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ theme:
4747
- content.code.annotate
4848
- content.code.copy
4949
- content.code.select
50+
- content.tabs.link
5051
# - navigation.tabs
5152
- navigation.instant
5253
- navigation.tracking
@@ -107,6 +108,7 @@ plugins:
107108
- mike:
108109
alias_type: symlink
109110
- glightbox
111+
- section-index
110112
- mkdocstrings:
111113
default_handler: python_xref
112114
handlers:
@@ -131,7 +133,6 @@ plugins:
131133
preload_modules: [ flet ]
132134
filters:
133135
- "!^_" # Exclude private members starting with only one underscore
134-
- "^__" # Include private members starting with two underscores
135136
- "!before_update"
136137
inventories:
137138
- url: https://docs.python.org/3/objects.inv
@@ -140,23 +141,42 @@ plugins:
140141

141142
# Markdown Extensions
142143
markdown_extensions:
144+
- abbr
143145
- admonition
146+
- attr_list
147+
- def_list
148+
- footnotes
149+
- md_in_html
144150
- toc:
145151
permalink: "#"
152+
153+
# Python Markdown Extensions
154+
- pymdownx.arithmatex:
155+
generic: true
156+
- pymdownx.betterem:
157+
smart_enable: all
158+
- pymdownx.caret
159+
- pymdownx.details
160+
- pymdownx.emoji:
161+
emoji_index: !!python/name:material.extensions.emoji.twemoji
162+
emoji_generator: !!python/name:material.extensions.emoji.to_svg
146163
- pymdownx.highlight:
147164
anchor_linenums: true
148165
line_spans: __span
149166
pygments_lang_class: true
150167
- pymdownx.inlinehilite
151-
- pymdownx.snippets
168+
- pymdownx.keys
169+
- pymdownx.mark
170+
- pymdownx.smartsymbols
152171
- pymdownx.superfences
153-
- pymdownx.details
172+
- pymdownx.snippets
154173
- pymdownx.magiclink:
155174
repo_url_shorthand: true
156175
- pymdownx.tabbed:
157176
alternate_style: true
158-
- attr_list
159-
- md_in_html
160-
- def_list
177+
slugify: !!python/object/apply:pymdownx.slugs.slugify
178+
kwds:
179+
case: lower
161180
- pymdownx.tasklist:
162181
custom_checkbox: true
182+
- pymdownx.tilde

pyproject.toml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ docs = [
3232
"markdown>=3.6",
3333
"pymdown-extensions",
3434
"mkdocs-glightbox",
35+
"mkdocs-section-index",
3536
"pygments>=2.16",
3637
]
3738

@@ -41,3 +42,35 @@ docs = [
4142
[build-system]
4243
requires = ["setuptools"]
4344
build-backend = "setuptools.build_meta"
45+
46+
[tool.ruff]
47+
line-length = 88
48+
target-version = "py39"
49+
fix = true
50+
show-fixes = true
51+
52+
[tool.ruff.lint]
53+
select = [
54+
# pycodestyle
55+
"E",
56+
# Pyflakes
57+
"F",
58+
# pyupgrade
59+
"UP",
60+
# flake8-bugbear
61+
"B",
62+
# flake8-simplify
63+
"SIM",
64+
# isort
65+
"I"
66+
]
67+
ignore = [
68+
# Pyflakes
69+
"F401", # unused import
70+
]
71+
preview = true
72+
73+
[tool.ruff.format]
74+
quote-style = "double"
75+
indent-style = "space"
76+
line-ending = "auto"

src/flet_flashlight/flashlight.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class Flashlight(ft.Service):
2121
Whether the flashlight is currently turned on.
2222
"""
2323

24-
on_error: ft.OptionalControlEventCallable = None
24+
on_error: ft.OptionalControlEventHandler["Flashlight"] = None
2525
"""
2626
Fires when an error occurs.
2727

0 commit comments

Comments
 (0)