Skip to content
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,5 @@ async def main(page: ft.Page):
page.update()


ft.run(main)
if __name__ == "__main__":
ft.run(main)
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@ def main(page: ft.Page):
)


ft.run(main)
if __name__ == "__main__":
ft.run(main)
Empty file.
3 changes: 2 additions & 1 deletion sdk/python/examples/controls/radio/basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,5 @@ def handle_button_click(e: ft.Event[ft.Button]):
)


ft.run(main)
if __name__ == "__main__":
ft.run(main)
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,5 @@ def handle_selection_change(e: ft.Event[ft.RadioGroup]):
)


ft.run(main)
if __name__ == "__main__":
ft.run(main)
3 changes: 2 additions & 1 deletion sdk/python/examples/controls/radio/styled.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,5 @@ def main(page: ft.Page):
)


ft.run(main)
if __name__ == "__main__":
ft.run(main)
Empty file.
5 changes: 3 additions & 2 deletions sdk/python/examples/controls/range_slider/basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,12 @@ def main(page: ft.Page):
inactive_color=ft.Colors.GREEN_300,
active_color=ft.Colors.GREEN_700,
overlay_color=ft.Colors.GREEN_100,
label="{value}%",
label="{value}",
),
],
)
)


ft.run(main)
if __name__ == "__main__":
ft.run(main)
Original file line number Diff line number Diff line change
Expand Up @@ -26,19 +26,21 @@ def handle_slider_change_end(e: ft.Event[ft.RangeSlider]):
),
ft.Container(height=30),
ft.RangeSlider(
divisions=50,
divisions=100,
min=0,
max=50,
max=100,
start_value=10,
end_value=20,
on_change_start=handle_slider_change_start,
on_change=handle_slider_change,
on_change_end=handle_slider_change_end,
label="{value}%",
),
message := ft.Text(),
],
)
)


ft.run(main)
if __name__ == "__main__":
ft.run(main)
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,5 @@ def get_color(i):
)


ft.run(main)
if __name__ == "__main__":
ft.run(main)
Empty file.
5 changes: 3 additions & 2 deletions sdk/python/examples/controls/responsive_row/basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ def main(page: ft.Page):
def handle_page_resize(e: ft.PageResizeEvent):
pw.value = f"{page.width} px"
pw.update()
page.update()

page.on_resize = handle_page_resize

Expand Down Expand Up @@ -75,7 +76,7 @@ def handle_page_resize(e: ft.PageResizeEvent):
),
pw,
)
handle_page_resize(None)


ft.run(main)
if __name__ == "__main__":
ft.run(main)
Original file line number Diff line number Diff line change
Expand Up @@ -99,4 +99,5 @@ def update_status(_=None):
update_status()


ft.run(main)
if __name__ == "__main__":
ft.run(main)
9 changes: 6 additions & 3 deletions sdk/python/packages/flet/docs/controls/progressring.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
---
class_name: flet.ProgressRing
examples: ../../examples/controls/progress_ring
example_images: ../examples/controls/progress_ring/media
example_images: ../test-images/examples/material/golden/macos/progress_ring
example_media: ../examples/controls/progress_ring/media
---

{{ class_summary(class_name) }}
{{ class_summary(class_name, example_images + "/image_for_docs.png", image_caption="Fixed progress ring") }}

## Examples

Expand All @@ -16,7 +17,7 @@ example_images: ../examples/controls/progress_ring/media
--8<-- "{{ examples }}/determinate_and_indeterminate.py"
```

{{ image(example_images + "/determinate_and_indeterminate.gif", alt="determinate-and-indeterminate", width="80%") }}
{{ image(example_media + "/determinate_and_indeterminate.gif", alt="determinate-and-indeterminate", width="80%") }}


### Gauge with progress
Expand All @@ -25,4 +26,6 @@ example_images: ../examples/controls/progress_ring/media
--8<-- "{{ examples }}/gauge_with_progress.py"
```

{{ image(example_images + "/gauge_with_progress.png", alt="determinate-and-indeterminate", width="80%") }}

{{ class_members(class_name) }}
8 changes: 4 additions & 4 deletions sdk/python/packages/flet/docs/controls/radio.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
---
class_name: flet.Radio
examples: ../../examples/controls/radio
example_images: ../examples/controls/radio/media
example_images: ../test-images/examples/material/golden/macos/radio
---

{{ class_summary(class_name) }}
{{ class_summary(class_name, example_images + "/image_for_docs.png", image_caption="Simple radio buttons") }}

## Examples

Expand All @@ -16,7 +16,7 @@ example_images: ../examples/controls/radio/media
--8<-- "{{ examples }}/basic.py"
```

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



Expand All @@ -26,7 +26,7 @@ example_images: ../examples/controls/radio/media
--8<-- "{{ examples }}/handling_selection_changes.py"
```

{{ image(example_images + "/handling_selection_changes.gif", alt="handling-selection-changes", width="80%") }}
{{ image(example_images + "/handling_selection_changes.png", alt="handling-selection-changes", width="80%") }}


### Styled radio buttons
Expand Down
6 changes: 4 additions & 2 deletions sdk/python/packages/flet/docs/controls/rangeslider.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
---
class_name: flet.RangeSlider
examples: ../../examples/controls/range_slider
example_images: ../examples/controls/range_slider/media
example_images: ../test-images/examples/material/golden/macos/range_slider
---

{{ class_summary(class_name) }}
{{ class_summary(class_name, example_images + "/image_for_docs.png", image_caption="Range Slider") }}

## Examples

Expand All @@ -25,4 +25,6 @@ example_images: ../examples/controls/range_slider/media
--8<-- "{{ examples }}/handling_change_events.py"
```

{{ image(example_images + "/handling_events.gif", alt="handling_events", width="80%") }}

{{ class_members(class_name) }}
6 changes: 3 additions & 3 deletions sdk/python/packages/flet/docs/controls/reorderablelistview.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
---
class_name: flet.ReorderableListView
examples: ../../examples/controls/reorderable_list_view
example_images: ../examples/controls/reorderable_list_view/media
example_images: ../test-images/examples/material/golden/macos/reorderable_list_view
---

{{ class_summary(class_name) }}
{{ class_summary(class_name, example_images + "/image_for_docs.png", image_caption="Reorderable list view") }}

## Examples

Expand All @@ -16,7 +16,7 @@ example_images: ../examples/controls/reorderable_list_view/media
--8<-- "{{ examples }}/horizontal_and_vertical.py"
```

{{ image(example_images + "/horizontal_and_vertical.gif", alt="horizontal-and-vertical", width="80%") }}
{{ image(example_images + "/horizontal_and_vertical.png", alt="horizontal-and-vertical", width="80%") }}


### Custom drag handle
Expand Down
7 changes: 4 additions & 3 deletions sdk/python/packages/flet/docs/controls/responsiverow.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
---
class_name: flet.ResponsiveRow
examples: ../../examples/controls/responsive_row
example_images: ../examples/controls/responsive_row/media
example_images: ../test-images/examples/core/golden/macos/responsive_row
---

{{ class_summary(class_name) }}
{{ class_summary(class_name, example_images + "/image_for_docs.png", image_caption="Responsive row") }}

## Examples

Expand All @@ -16,7 +16,7 @@ example_images: ../examples/controls/responsive_row/media
--8<-- "{{ examples }}/basic.py"
```

{{ image(example_images + "/basic.gif", alt="basic", width="80%") }}
{{ image(example_images + "/responsive_row_basic.gif", alt="basic", width="80%") }}


### Custom breakpoints
Expand All @@ -25,5 +25,6 @@ example_images: ../examples/controls/responsive_row/media
--8<-- "{{ examples }}/custom_breakpoint.py"
```

{{ image(example_images + "/responsive_row_custom_breakpoint.gif", alt="basic", width="80%") }}

{{ class_members(class_name) }}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
import pytest

import flet as ft
import flet.testing as ftt

from examples.controls.responsive_row import basic, custom_breakpoint


@pytest.mark.asyncio(loop_scope="function")
async def test_image_for_docs(flet_app_function: ftt.FletTestApp, request):
flet_app_function.page.theme_mode = ft.ThemeMode.LIGHT
await flet_app_function.assert_control_screenshot(
request.node.name,
ft.ResponsiveRow(
controls=[
ft.Button(
f"Button {i}",
color=ft.Colors.BLUE_GREY_300,
col={
ft.ResponsiveRowBreakpoint.XS: 12,
ft.ResponsiveRowBreakpoint.MD: 6,
ft.ResponsiveRowBreakpoint.LG: 3,
},
)
for i in range(1, 6)
],
),
)


@pytest.mark.parametrize(
"flet_app_function",
[{"flet_app_main": basic.main}],
indirect=True,
)
@pytest.mark.asyncio(loop_scope="function")
async def test_basic(flet_app_function: ftt.FletTestApp):
flet_app_function.page.enable_screenshots = True
flet_app_function.resize_page(1000, 500)
flet_app_function.page.update()
for _ in range(5):
await flet_app_function.tester.pump(100)
flet_app_function.assert_screenshot(
"responsive1",
await flet_app_function.page.take_screenshot(
pixel_ratio=flet_app_function.screenshots_pixel_ratio,
delay=ft.Duration(seconds=1),
),
)
flet_app_function.resize_page(800, 500)
flet_app_function.page.update()
for _ in range(5):
await flet_app_function.tester.pump(100)
flet_app_function.assert_screenshot(
"responsive2",
await flet_app_function.page.take_screenshot(
pixel_ratio=flet_app_function.screenshots_pixel_ratio,
delay=ft.Duration(seconds=1),
),
)
flet_app_function.resize_page(200, 500)
flet_app_function.page.update()
for _ in range(5):
await flet_app_function.tester.pump(100)
flet_app_function.assert_screenshot(
"responsive3",
await flet_app_function.page.take_screenshot(
pixel_ratio=flet_app_function.screenshots_pixel_ratio,
delay=ft.Duration(seconds=1),
),
)
flet_app_function.create_gif(
["responsive1", "responsive2", "responsive3"],
"responsive_row_basic",
duration=1600,
disposal=ftt.DisposalMode.BACKGROUND,
)


@pytest.mark.parametrize(
"flet_app_function",
[{"flet_app_main": custom_breakpoint.main}],
indirect=True,
)
@pytest.mark.asyncio(loop_scope="function")
async def test_custom_breakpoint(flet_app_function: ftt.FletTestApp):
flet_app_function.page.enable_screenshots = True
flet_app_function.resize_page(1000, 800)
flet_app_function.page.update()
for _ in range(5):
await flet_app_function.tester.pump(100)
flet_app_function.assert_screenshot(
"responsive_custom_1",
await flet_app_function.page.take_screenshot(
pixel_ratio=flet_app_function.screenshots_pixel_ratio
),
)
flet_app_function.resize_page(650, 800)
flet_app_function.page.update()
for _ in range(5):
await flet_app_function.tester.pump(100)
flet_app_function.assert_screenshot(
"responsive_custom_2",
await flet_app_function.page.take_screenshot(
pixel_ratio=flet_app_function.screenshots_pixel_ratio
),
)
flet_app_function.resize_page(200, 800)
flet_app_function.page.update()
for _ in range(5):
await flet_app_function.tester.pump(100)
flet_app_function.assert_screenshot(
"responsive_custom_3",
await flet_app_function.page.take_screenshot(
pixel_ratio=flet_app_function.screenshots_pixel_ratio
),
)
flet_app_function.create_gif(
["responsive_custom_1", "responsive_custom_2", "responsive_custom_3"],
"responsive_row_custom_breakpoint",
duration=1600,
disposal=ftt.DisposalMode.BACKGROUND,
)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading