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

Commit dbf78f5

Browse files
committed
docs update
1 parent 98c2b38 commit dbf78f5

File tree

8 files changed

+123
-77
lines changed

8 files changed

+123
-77
lines changed

docs/index.md

Lines changed: 29 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -22,52 +22,47 @@ This package supports the following platforms:
2222
| Android ||
2323
| Web ||
2424

25-
## Installation
25+
## Usage
2626

27-
Add dependency to `pyproject.toml` of your Flet app:
27+
### Installation
2828

29-
```
30-
dependencies = [
31-
"flet-datatable2 @ git+https://github.com/flet-dev/flet_datatable2.git",
32-
"flet",
33-
]
29+
To install the `flet-datatable2` package and add it to your project dependencies:
30+
31+
=== "uv"
32+
33+
```bash
34+
uv add flet-datatable2
3435
```
3536

36-
Build your app:
37+
=== "pip"
38+
39+
```bash
40+
pip install flet-datatable2
3741
```
38-
flet build macos -v
42+
43+
You will have to manually add this package to your `requirements.txt` or `pyproject.toml`.
44+
45+
=== "poetry"
46+
47+
```bash
48+
poetry add flet-datatable2
3949
```
4050

4151
## Examples
4252

43-
[Live example](https://flet-controls-gallery.fly.dev/layout/datatable2)
53+
[Live demo](https://flet-controls-gallery.fly.dev/layout/datatable2)
4454

45-
### DataTable2 with `empty` property and no data rows
55+
### Example 1
4656

57+
```python
58+
--8<-- "examples/datatable2_example/src/example-1.py"
4759
```
48-
import flet as ft
49-
from flet_datatable2 import DataColumn2, DataTable2
50-
51-
def main(page: ft.Page):
52-
page.add(
53-
DataTable2(
54-
columns=[
55-
DataColumn2(ft.Text("First name")),
56-
DataColumn2(ft.Text("Last name")),
57-
DataColumn2(ft.Text("Age"), numeric=True),
58-
],
59-
empty=ft.Text("This table is empty."),
60-
),
61-
)
62-
63-
64-
ft.app(main)
65-
```
66-
67-
### DataTable2 with fixed heading row and sorting
6860

69-
<img src="assets/datatable2-example.gif">
70-
71-
See source code for this example [here](https://github.com/flet-dev/flet_datatable2/tree/main/examples/flet_datatable2_example/src).
61+
### Example 2
7262

63+
![DataTable2 example 2](assets/example-2.gif)
7364

65+
```
66+
```python
67+
--8<-- "examples/datatable2_example/src/example-2.py"
68+
```

examples/datatable2_example/pyproject.toml

Lines changed: 4 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -4,44 +4,18 @@ version = "1.0.0"
44
description = ""
55
readme = "README.md"
66
requires-python = ">=3.10"
7-
authors = [
8-
{ name = "Flet developer", email = "you@example.com" }
9-
]
7+
authors = [{ name = "Flet Contributors", email = "hello@flet.dev" }]
108
dependencies = [
119
"flet-datatable2",
1210
"flet",
1311
]
1412

13+
# Docs: https://flet.dev/docs/publish
1514
[tool.flet]
16-
# org name in reverse domain name notation, e.g. "com.mycompany".
17-
# Combined with project.name to build bundle ID for iOS and Android apps
1815
org = "com.mycompany"
19-
20-
# project display name that is used as an app title on Android and iOS home screens,
21-
# shown in window titles and about app dialogs on desktop.
2216
product = "flet-datatable2-example"
23-
24-
# company name to display in about app dialogs
25-
26-
# copyright text to display in about app dialogs
17+
company = "Flet"
2718
copyright = "Copyright (C) 2025 by Flet"
2819

2920
[tool.flet.app]
30-
path = "src"
31-
32-
[tool.flet.dev_packages]
33-
flet-datatable2 = "../.." # relative path
34-
flet = "git+https://github.com/flet-dev/flet.git@v1#subdirectory=sdk/python/packages/flet"
35-
36-
[tool.uv]
37-
dev-dependencies = [
38-
"flet",
39-
"flet-cli",
40-
"flet-desktop",
41-
]
42-
43-
[tool.uv.sources]
44-
flet-datatable2 = { path = "../../", editable = true }
45-
flet = { git = "https://github.com/flet-dev/flet", subdirectory = "sdk/python/packages/flet", rev = "v1" }
46-
flet-cli = { git = "https://github.com/flet-dev/flet", subdirectory = "sdk/python/packages/flet-cli", rev = "v1" }
47-
flet-desktop = { git = "https://github.com/flet-dev/flet", subdirectory = "sdk/python/packages/flet-desktop", rev = "v1" }
21+
path = "src"
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import flet as ft
2+
3+
import flet_datatable2 as fdt
4+
5+
6+
def main(page: ft.Page):
7+
page.add(
8+
fdt.DataTable2(
9+
empty=ft.Text("This table is empty."),
10+
columns=[
11+
fdt.DataColumn2(ft.Text("First name")),
12+
fdt.DataColumn2(ft.Text("Last name")),
13+
fdt.DataColumn2(ft.Text("Age"), numeric=True),
14+
],
15+
),
16+
)
17+
18+
19+
ft.run(main)

examples/datatable2_example/src/main.py renamed to examples/datatable2_example/src/example-2.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import flet as ft
2-
import flet_datatable2 as ftd
32
from data import desserts
43

4+
import flet_datatable2 as ftd
5+
56

67
def main(page: ft.Page):
78
page.vertical_alignment = ft.MainAxisAlignment.CENTER
@@ -102,4 +103,5 @@ def get_data_rows(desserts):
102103
),
103104
)
104105

106+
105107
ft.run(main)

mkdocs.yml

Lines changed: 29 additions & 7 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
@@ -103,6 +104,7 @@ plugins:
103104
- mike:
104105
alias_type: symlink
105106
- glightbox
107+
- section-index
106108
- mkdocstrings:
107109
default_handler: python_xref
108110
handlers:
@@ -122,35 +124,55 @@ plugins:
122124
show_category_heading: false
123125
show_labels: false
124126
show_if_no_docstring: true
127+
docstring_section_style: spacy
125128
inherited_members: true
126-
preload_modules: [flet]
129+
preload_modules: [ flet ]
127130
filters:
128131
- "!^_" # Exclude private members starting with only one underscore
129-
- "!before_update" # Exclude before_update method
132+
- "!before_update"
130133
inventories:
131134
- url: https://docs.python.org/3/objects.inv
132135
domains: [ py, std ]
133136
- url: https://typing-extensions.readthedocs.io/en/latest/objects.inv
134137

135138
# Markdown Extensions
136139
markdown_extensions:
140+
- abbr
137141
- admonition
142+
- attr_list
143+
- def_list
144+
- footnotes
145+
- md_in_html
138146
- toc:
139147
permalink: "#"
148+
149+
# Python Markdown Extensions
150+
- pymdownx.arithmatex:
151+
generic: true
152+
- pymdownx.betterem:
153+
smart_enable: all
154+
- pymdownx.caret
155+
- pymdownx.details
156+
- pymdownx.emoji:
157+
emoji_index: !!python/name:material.extensions.emoji.twemoji
158+
emoji_generator: !!python/name:material.extensions.emoji.to_svg
140159
- pymdownx.highlight:
141160
anchor_linenums: true
142161
line_spans: __span
143162
pygments_lang_class: true
144163
- pymdownx.inlinehilite
145-
- pymdownx.snippets
164+
- pymdownx.keys
165+
- pymdownx.mark
166+
- pymdownx.smartsymbols
146167
- pymdownx.superfences
147-
- pymdownx.details
168+
- pymdownx.snippets
148169
- pymdownx.magiclink:
149170
repo_url_shorthand: true
150171
- pymdownx.tabbed:
151172
alternate_style: true
152-
- attr_list
153-
- md_in_html
154-
- def_list
173+
slugify: !!python/object/apply:pymdownx.slugs.slugify
174+
kwds:
175+
case: lower
155176
- pymdownx.tasklist:
156177
custom_checkbox: true
178+
- pymdownx.tilde

pyproject.toml

Lines changed: 34 additions & 1 deletion
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

@@ -43,4 +44,36 @@ license-files = []
4344

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

src/flet_datatable2/datarow2.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
__all__ = ["DataRow2"]
66

7+
78
@ft.control("DataRow2")
89
class DataRow2(ft.DataRow):
910
"""
@@ -27,28 +28,28 @@ class DataRow2(ft.DataRow):
2728
Falls back to `data_row_height` if not set.
2829
"""
2930

30-
on_double_tap: ft.OptionalControlEventCallable = None
31+
on_double_tap: ft.OptionalControlEventHandler["DataRow2"] = None
3132
"""
3233
Fires when the row is double-tapped.
3334
3435
Ignored if the tapped cell has a `tap` handler.
3536
"""
3637

37-
on_secondary_tap: ft.OptionalControlEventCallable = None
38+
on_secondary_tap: ft.OptionalControlEventHandler["DataRow2"] = None
3839
"""
3940
Fires when the row is right-clicked (secondary tap).
4041
4142
Ignored if the tapped cell has a `tap` handler.
4243
"""
4344

44-
on_secondary_tap_down: ft.OptionalControlEventCallable = None
45+
on_secondary_tap_down: ft.OptionalControlEventHandler["DataRow2"] = None
4546
"""
4647
Fires when the row is right-clicked (secondary tap down).
4748
4849
Ignored if the tapped cell has a `tap` handler.
4950
"""
5051

51-
on_tap: ft.OptionalEventCallable[ft.TapEvent] = None
52+
on_tap: ft.OptionalEventHandler[ft.TapEvent["DataRow2"]] = None
5253
"""
5354
Fires when the row is tapped.
5455

0 commit comments

Comments
 (0)