Skip to content

Commit ee2389e

Browse files
committed
add example
1 parent 4b7f711 commit ee2389e

4 files changed

Lines changed: 105 additions & 9 deletions

File tree

client/pubspec.lock

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -157,10 +157,10 @@ packages:
157157
dependency: transitive
158158
description:
159159
name: characters
160-
sha256: f71061c654a3380576a52b451dd5532377954cf9dbd272a78fc8479606670803
160+
sha256: faf38497bda5ead2a8c7615f4f7939df04333478bf32e4173fcb06d428b5716b
161161
url: "https://pub.dev"
162162
source: hosted
163-
version: "1.4.0"
163+
version: "1.4.1"
164164
charcode:
165165
dependency: transitive
166166
description:
@@ -359,7 +359,7 @@ packages:
359359
path: "../packages/flet"
360360
relative: true
361361
source: path
362-
version: "0.82.2"
362+
version: "0.85.0"
363363
flet_ads:
364364
dependency: "direct main"
365365
description:
@@ -911,18 +911,18 @@ packages:
911911
dependency: transitive
912912
description:
913913
name: matcher
914-
sha256: dc58c723c3c24bf8d3e2d3ad3f2f9d7bd9cf43ec6feaa64181775e60190153f2
914+
sha256: dc0b7dc7651697ea4ff3e69ef44b0407ea32c487a39fff6a4004fa585e901861
915915
url: "https://pub.dev"
916916
source: hosted
917-
version: "0.12.17"
917+
version: "0.12.19"
918918
material_color_utilities:
919919
dependency: transitive
920920
description:
921921
name: material_color_utilities
922-
sha256: f7142bb1154231d7ea5f96bc7bde4bda2a0945d2806bb11670e30b850d56bdec
922+
sha256: "9c337007e82b1889149c82ed242ed1cb24a66044e30979c44912381e9be4c48b"
923923
url: "https://pub.dev"
924924
source: hosted
925-
version: "0.11.1"
925+
version: "0.13.0"
926926
media_kit:
927927
dependency: transitive
928928
description:
@@ -1628,10 +1628,10 @@ packages:
16281628
dependency: transitive
16291629
description:
16301630
name: test_api
1631-
sha256: ab2726c1a94d3176a45960b6234466ec367179b87dd74f1611adb1f3b5fb9d55
1631+
sha256: "8161c84903fd860b26bfdefb7963b3f0b68fee7adea0f59ef805ecca346f0c7a"
16321632
url: "https://pub.dev"
16331633
source: hosted
1634-
version: "0.7.7"
1634+
version: "0.7.10"
16351635
torch_light:
16361636
dependency: transitive
16371637
description:
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
import flet as ft
2+
3+
4+
def build_card(index: int, color: ft.Colors) -> ft.Container:
5+
return ft.Container(
6+
bgcolor=color,
7+
border_radius=8,
8+
padding=16,
9+
content=ft.Column(
10+
spacing=10,
11+
controls=[
12+
ft.Text(f"Card {index}", size=22, weight=ft.FontWeight.BOLD),
13+
ft.Text("Line 1"),
14+
ft.Text("Line 2"),
15+
ft.Text("Line 3"),
16+
ft.Text("Line 4"),
17+
ft.Text("Line 5"),
18+
],
19+
),
20+
)
21+
22+
23+
def main(page: ft.Page):
24+
page.add(
25+
ft.SafeArea(
26+
expand=True,
27+
content=ft.Column(
28+
expand=True,
29+
spacing=12,
30+
controls=[
31+
ft.Text(
32+
"Resize the window height. The header stays visible while "
33+
"the responsive content scrolls."
34+
),
35+
ft.ResponsiveRow(
36+
expand=True,
37+
scroll=ft.ScrollMode.AUTO,
38+
spacing=16,
39+
run_spacing=16,
40+
controls=[
41+
ft.Container(
42+
col={
43+
ft.ResponsiveRowBreakpoint.XS: 12,
44+
ft.ResponsiveRowBreakpoint.MD: 6,
45+
ft.ResponsiveRowBreakpoint.LG: 4,
46+
},
47+
content=build_card(
48+
i,
49+
[
50+
ft.Colors.BLUE_50,
51+
ft.Colors.GREEN_50,
52+
ft.Colors.AMBER_50,
53+
][i % 3],
54+
),
55+
)
56+
for i in range(1, 10)
57+
],
58+
),
59+
],
60+
),
61+
)
62+
)
63+
64+
65+
if __name__ == "__main__":
66+
ft.run(main)
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
[project]
2+
name = "responsive-row-scrollable"
3+
version = "1.0.0"
4+
description = "Keeps header content fixed while a tall ResponsiveRow of cards scrolls vertically."
5+
requires-python = ">=3.10"
6+
keywords = ["responsive row", "scroll", "layout", "cards", "adaptive columns"]
7+
authors = [{ name = "Flet team", email = "hello@flet.dev" }]
8+
dependencies = ["flet"]
9+
10+
[dependency-groups]
11+
dev = ["flet-cli", "flet-desktop", "flet-web"]
12+
13+
[tool.flet.gallery]
14+
categories = ["Layout/ResponsiveRow"]
15+
16+
[tool.flet.metadata]
17+
title = "Scrollable"
18+
controls = ["SafeArea", "Column", "ResponsiveRow", "Container", "Text"]
19+
layout_pattern = "responsive-grid"
20+
complexity = "basic"
21+
features = ["scrollable content", "responsive columns", "fixed header"]
22+
23+
[tool.flet]
24+
org = "dev.flet"
25+
company = "Flet"
26+
copyright = "Copyright (C) 2023-2026 by Flet"

website/docs/controls/responsiverow.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,8 @@ import {ClassMembers, ClassSummary, CodeExample, Image} from '@site/src/componen
2525

2626
<Image src={frontMatter.example_images + '/custom_breakpoint.gif'} width="70%" />
2727

28+
### Scrollable content
29+
30+
<CodeExample path={frontMatter.examples + '/scrollable/main.py'} language="python" />
31+
2832
<ClassMembers name={frontMatter.class_name} />

0 commit comments

Comments
 (0)