Skip to content

Commit 605826a

Browse files
committed
add responsive row example tests and images
1 parent 62f0e01 commit 605826a

File tree

5 files changed

+29
-6
lines changed

5 files changed

+29
-6
lines changed

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ def main(page: ft.Page):
55
def handle_page_resize(e: ft.PageResizeEvent):
66
pw.value = f"{page.width} px"
77
pw.update()
8+
page.update()
89

910
page.on_resize = handle_page_resize
1011

@@ -75,7 +76,7 @@ def handle_page_resize(e: ft.PageResizeEvent):
7576
),
7677
pw,
7778
)
78-
handle_page_resize(None)
7979

8080

81-
ft.run(main)
81+
if __name__ == "__main__":
82+
ft.run(main)

sdk/python/examples/controls/responsive_row/custom_breakpoint.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,4 +99,5 @@ def update_status(_=None):
9999
update_status()
100100

101101

102-
ft.run(main)
102+
if __name__ == "__main__":
103+
ft.run(main)

sdk/python/packages/flet/docs/controls/responsiverow.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
---
22
class_name: flet.ResponsiveRow
33
examples: ../../examples/controls/responsive_row
4-
example_images: ../examples/controls/responsive_row/media
4+
example_images: ../test-images/examples/core/golden/macos/responsive_row/
55
---
66

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

99
## Examples
1010

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

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

2121

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

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

2930
{{ class_members(class_name) }}

sdk/python/packages/flet/src/flet/controls/core/responsive_row.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,24 @@ class ResponsiveRow(LayoutControl, AdaptiveControl):
2626
2727
Similar to `expand` property, every control has [`col`][flet.Control.]
2828
property which allows specifying how many columns a control should span.
29+
30+
```python
31+
ft.ResponsiveRow(
32+
controls=[
33+
ft.Button(
34+
f"Button {i}",
35+
color=ft.Colors.BLUE_GREY_300,
36+
col={
37+
ft.ResponsiveRowBreakpoint.XS: 12,
38+
ft.ResponsiveRowBreakpoint.MD: 6,
39+
ft.ResponsiveRowBreakpoint.LG: 3,
40+
},
41+
)
42+
for i in range(1, 6)
43+
],
44+
)
45+
```
46+
2947
"""
3048

3149
controls: list[Control] = field(default_factory=list)

sdk/python/packages/flet/src/flet/testing/flet_test_app.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -425,6 +425,7 @@ def create_gif(
425425
*,
426426
duration: int = 1000,
427427
loop: int = 0,
428+
disposal: int = 0
428429
) -> Path:
429430
"""Create an animated GIF from a sequence of image files.
430431
@@ -489,6 +490,7 @@ def create_gif(
489490
duration=duration,
490491
loop=loop,
491492
optimize=True,
493+
disposal=2
492494
)
493495
finally:
494496
for frame in frames:

0 commit comments

Comments
 (0)