Skip to content

Commit 18eb781

Browse files
committed
Replace Container dividers with Divider components
Updated ItemView and GroupView to use ft.Divider and ft.VerticalDivider instead of styled ft.Container for visual dividers. This improves clarity and leverages built-in divider components for better maintainability and appearance.
1 parent f9cd14e commit 18eb781

1 file changed

Lines changed: 17 additions & 15 deletions

File tree

sdk/python/examples/apps/declarative/drag_and_drop_ordering.py

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -91,11 +91,11 @@ def ItemView(item: Item, **kwargs):
9191
spacing=2,
9292
horizontal_alignment=ft.CrossAxisAlignment.CENTER,
9393
controls=[
94-
ft.Container(
95-
bgcolor=ft.Colors.BLACK38,
96-
border_radius=ft.BorderRadius.all(30),
94+
ft.Divider(
95+
color=ft.Colors.BLACK38,
96+
thickness=2,
9797
height=2,
98-
width=180,
98+
radius=2,
9999
opacity=1.0 if item.is_item_over else 0.0,
100100
),
101101
ft.Draggable(
@@ -110,10 +110,9 @@ def ItemView(item: Item, **kwargs):
110110
on_accept=lambda e: item.move_item_at(e.src.data, item),
111111
on_leave=lambda: item.set_is_item_over(False),
112112
content=ft.Card(
113-
elevation=1,
114113
content=ft.Container(
115-
width=200,
116114
padding=7,
115+
width=200,
117116
content=ft.Row(
118117
alignment=ft.MainAxisAlignment.START,
119118
controls=[
@@ -133,12 +132,15 @@ def ItemView(item: Item, **kwargs):
133132
def GroupView(group: Group, move_group, **kwargs):
134133
return ft.Row(
135134
spacing=4,
135+
intrinsic_height=True,
136136
controls=[
137-
ft.Container(
138-
bgcolor=ft.Colors.BLACK54,
139-
border_radius=ft.BorderRadius.all(30),
137+
ft.VerticalDivider(
138+
color=ft.Colors.BLACK54,
140139
width=2,
141-
height=100,
140+
thickness=2,
141+
radius=2,
142+
leading_indent=15,
143+
trailing_indent=15,
142144
opacity=1.0 if group.is_group_over else 0.0,
143145
),
144146
ft.Draggable(
@@ -165,6 +167,7 @@ def GroupView(group: Group, move_group, **kwargs):
165167
border_radius=ft.BorderRadius.all(15),
166168
bgcolor=group.color,
167169
padding=ft.Padding.all(20),
170+
width=220,
168171
content=ft.Column(
169172
spacing=4,
170173
controls=[
@@ -174,7 +177,6 @@ def GroupView(group: Group, move_group, **kwargs):
174177
),
175178
ft.TextField(
176179
label="New item",
177-
width=200,
178180
bgcolor=ft.Colors.WHITE,
179181
value=group.new_item_text,
180182
on_change=lambda e: group.change_new_item_text(
@@ -195,11 +197,11 @@ def GroupView(group: Group, move_group, **kwargs):
195197
ItemView(item, key=item.id)
196198
for item in group.items
197199
],
198-
ft.Container(
199-
bgcolor=ft.Colors.BLACK38,
200-
border_radius=ft.BorderRadius.all(30),
200+
ft.Divider(
201+
color=ft.Colors.BLACK38,
202+
thickness=2,
201203
height=2,
202-
width=180,
204+
radius=2,
203205
opacity=1.0
204206
if group.is_item_over
205207
else 0.0,

0 commit comments

Comments
 (0)