Skip to content

Commit 68b4344

Browse files
Owen/control docs p4 (#5757)
* add snackbar example tests and images * add shader mask example tests and images * fix failing shadermask tests/iamges * add selection area example tests and images * remove commented test * fix shader mask image location and add code snippet * add SegmentedButton example tests and images * fix missing images, centered code snippet, add code snippets to slider, snackbar, verticaldivider
1 parent 95f1172 commit 68b4344

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+388
-49
lines changed

sdk/python/examples/controls/chip/filter_chips.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,12 @@ def handle_amenity_selection(e: ft.Event[ft.Chip]):
88
amenities = ["Washer / Dryer", "Ramp access", "Dogs OK", "Cats OK", "Smoke-free"]
99

1010
page.add(
11-
ft.Row(controls=[ft.Icon(ft.Icons.HOTEL_CLASS), ft.Text("Amenities")]),
11+
ft.Row(
12+
controls=[
13+
ft.Icon(ft.Icons.HOTEL_CLASS),
14+
ft.Text("Amenities"),
15+
]
16+
),
1217
ft.Row(
1318
controls=[
1419
ft.Chip(

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def main(page: ft.Page):
3737
ft.Row(
3838
expand=True,
3939
controls=[
40-
rail,
40+
ft.SelectionArea(content=rail),
4141
ft.VerticalDivider(width=1),
4242
ft.Column(
4343
alignment=ft.MainAxisAlignment.START,

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

Whitespace-only changes.

sdk/python/examples/controls/segmented_button/basic.py renamed to sdk/python/examples/controls/segmented_button/single_multiple_selection.py

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,61 +9,62 @@ def handle_selection_change(e: ft.Event[ft.SegmentedButton]):
99
ft.SegmentedButton(
1010
on_change=handle_selection_change,
1111
selected_icon=ft.Icon(ft.Icons.CHECK_SHARP),
12-
selected=["1"],
12+
selected=["1", "4"],
1313
allow_empty_selection=True,
1414
allow_multiple_selection=True,
1515
segments=[
1616
ft.Segment(
1717
value="1",
18-
label=ft.Text("1"),
18+
label=ft.Text("One"),
1919
icon=ft.Icon(ft.Icons.LOOKS_ONE),
2020
),
2121
ft.Segment(
2222
value="2",
23-
label=ft.Text("2"),
23+
label=ft.Text("Two"),
2424
icon=ft.Icon(ft.Icons.LOOKS_TWO),
2525
),
2626
ft.Segment(
2727
value="3",
28-
label=ft.Text("3"),
28+
label=ft.Text("Three"),
2929
icon=ft.Icon(ft.Icons.LOOKS_3),
3030
),
3131
ft.Segment(
3232
value="4",
33-
label=ft.Text("4"),
33+
label=ft.Text("Four"),
3434
icon=ft.Icon(ft.Icons.LOOKS_4),
3535
),
3636
],
3737
),
3838
ft.SegmentedButton(
3939
on_change=handle_selection_change,
40-
selected_icon=ft.Icon(ft.Icons.ONETWOTHREE),
40+
selected_icon=ft.Icon(ft.Icons.CHECK_SHARP),
4141
selected=["2"],
4242
allow_multiple_selection=False,
4343
segments=[
4444
ft.Segment(
4545
value="1",
46-
label=ft.Text("1"),
46+
label=ft.Text("One"),
4747
icon=ft.Icon(ft.Icons.LOOKS_ONE),
4848
),
4949
ft.Segment(
5050
value="2",
51-
label=ft.Text("2"),
51+
label=ft.Text("Two"),
5252
icon=ft.Icon(ft.Icons.LOOKS_TWO),
5353
),
5454
ft.Segment(
5555
value="3",
56-
label=ft.Text("3"),
56+
label=ft.Text("Three"),
5757
icon=ft.Icon(ft.Icons.LOOKS_3),
5858
),
5959
ft.Segment(
6060
value="4",
61-
label=ft.Text("4"),
61+
label=ft.Text("Four"),
6262
icon=ft.Icon(ft.Icons.LOOKS_4),
6363
),
6464
],
6565
),
6666
)
6767

6868

69-
ft.run(main)
69+
if __name__ == "__main__":
70+
ft.run(main)

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

Whitespace-only changes.

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

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,27 @@ def main(page: ft.Page):
1515
ft.SelectionArea(
1616
content=ft.Column(
1717
controls=[
18-
ft.Text("Selectable text", color=ft.Colors.GREEN, style=TEXT_STYLE),
18+
ft.Text(
19+
"Selectable text",
20+
color=ft.Colors.GREEN,
21+
style=TEXT_STYLE,
22+
key="selectable",
23+
),
1924
ft.Text("Also selectable", color=ft.Colors.GREEN, style=TEXT_STYLE),
2025
]
2126
)
2227
)
2328
)
2429

25-
page.add(ft.Text("Not selectable", color=ft.Colors.RED, style=TEXT_STYLE))
30+
page.add(
31+
ft.Text(
32+
"Not selectable",
33+
color=ft.Colors.RED,
34+
style=TEXT_STYLE,
35+
key="non-selectable",
36+
)
37+
)
2638

2739

28-
ft.run(main)
40+
if __name__ == "__main__":
41+
ft.run(main)

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

Whitespace-only changes.

sdk/python/examples/controls/shader_mask/fade_out_image_bottom.py

Lines changed: 5 additions & 2 deletions
Large diffs are not rendered by default.

sdk/python/examples/controls/shader_mask/linear_and_radial_gradients.py

Lines changed: 8 additions & 5 deletions
Large diffs are not rendered by default.

sdk/python/examples/controls/shader_mask/pink_radial_glow.py

Lines changed: 4 additions & 3 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)