Skip to content

Commit 66c8088

Browse files
Add slider docs example tests. (#5704)
* update slider docs and add integration test * add __init__.py and fix references * add nav list left margin to docs css [skip ci] * remove unused example .gifs * remove nav list indentation
1 parent d2ce854 commit 66c8088

File tree

16 files changed

+85
-15
lines changed

16 files changed

+85
-15
lines changed

sdk/python/examples/controls/slider/__init__.py

Whitespace-only changes.

sdk/python/examples/controls/slider/basic.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,5 @@ def main(page: ft.Page):
1010
)
1111

1212

13-
ft.run(main)
13+
if __name__ == "__main__":
14+
ft.run(main)

sdk/python/examples/controls/slider/custom_label.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,5 @@ def main(page: ft.Page):
1010
)
1111

1212

13-
ft.run(main)
13+
if __name__ == "__main__":
14+
ft.run(main)

sdk/python/examples/controls/slider/handling_events.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ def slider_changed(e: ft.Event[ft.Slider]):
99
page.add(
1010
ft.Text("Slider with 'on_change' event:"),
1111
ft.Slider(
12+
key="slider",
1213
min=0,
1314
max=100,
1415
divisions=10,
@@ -19,4 +20,5 @@ def slider_changed(e: ft.Event[ft.Slider]):
1920
)
2021

2122

22-
ft.run(main)
23+
if __name__ == "__main__":
24+
ft.run(main)
-144 KB
Binary file not shown.
-269 KB
Binary file not shown.
-217 KB
Binary file not shown.
-6.81 KB
Binary file not shown.

sdk/python/examples/controls/slider/random_values.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,5 @@ def handle_slider_change(e: ft.Event[ft.Slider]):
2323
slider.update()
2424

2525

26-
ft.run(main)
26+
if __name__ == "__main__":
27+
ft.run(main)
Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
11
---
22
class_name: flet.Slider
33
examples: ../../examples/controls/slider
4-
example_images: ../examples/controls/slider/media
4+
example_images: ../test-images/examples/material/golden/macos/slider
55
---
66

7-
{{ class_summary(class_name) }}
7+
{{ class_summary(class_name, example_images + "/image_for_docs.png", image_caption="Default and disabled sliders") }}
88

99
## Examples
1010

11-
[Live example](https://flet-controls-gallery.fly.dev/input/slider)
11+
[Live example](https://flet-controls-gallery.fly.dev/input/slider/basic)
1212

1313
### Basic Example
1414

1515
```python
1616
--8<-- "{{ examples }}/basic.py"
1717
```
1818

19-
{{ image(example_images + "/basic.gif", alt="basic", width="80%") }}
19+
{{ image(example_images + "/basic.png", alt="basic", width="80%") }}
2020

2121

2222
### Setting a custom label
@@ -25,7 +25,7 @@ example_images: ../examples/controls/slider/media
2525
--8<-- "{{ examples }}/custom_label"
2626
```
2727

28-
{{ image(example_images + "/custom_label.gif", alt="custom-label", width="80%") }}
28+
{{ image(example_images + "/custom_label.png", alt="custom-label", width="80%") }}
2929

3030

3131
### Handling events
@@ -34,13 +34,8 @@ example_images: ../examples/controls/slider/media
3434
--8<-- "{{ examples }}/handling_events.py"
3535
```
3636

37-
{{ image(example_images + "/handling_events.gif", alt="handling-events", width="80%") }}
37+
{{ image(example_images + "/handling_events.png", alt="handling-events", width="80%") }}
3838

3939

40-
### Random values
41-
42-
```python
43-
--8<-- "{{ examples }}/random_values.py"
44-
```
4540

4641
{{ class_members(class_name) }}

0 commit comments

Comments
 (0)