Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions packages/flet/lib/src/controls/list_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,11 @@ class _ListViewControlState extends State<ListViewControl> {
widget.control.getBool("build_controls_on_demand", true)!;
var firstItemPrototype =
widget.control.getBool("first_item_prototype", false)!;
var prototypeItem = firstItemPrototype
? widget.control.buildWidget("prototype_item")
: null;
var controls = widget.control.children("controls");
var prototypeItem = widget.control.buildWidget("prototype_item") ??
(firstItemPrototype && controls.isNotEmpty
? ControlWidget(control: controls.first)
: null);

Widget listView = LayoutBuilder(
builder: (BuildContext context, BoxConstraints constraints) {
Expand Down
12 changes: 12 additions & 0 deletions sdk/python/packages/flet/src/flet/controls/core/list_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ class ListView(LayoutControl, ScrollableControl, AdaptiveControl):
"""
A fixed height or width (when [`horizontal`][(c).] is `True`)
of an item to optimize rendering.

Note: This property has effect only when [`build_controls_on_demand`][(c).]
is `True` or [`spacing`][(c).] is `0`.
Comment on lines 57 to 60
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

"Note:" must be alone one one line.

Note:
    text here...

"""

first_item_prototype: bool = False
Expand All @@ -63,6 +66,15 @@ class ListView(LayoutControl, ScrollableControl, AdaptiveControl):
i.e. their `height` or `width` will be the same as the first item.
"""

prototype_item: Optional[Control] = None
"""
A control to be used as a "prototype" for all items,
i.e. their `height` or `width` will be the same as the `prototype_item`.

Note: This property has effect only when [`build_controls_on_demand`][(c).]
is `True` or [`spacing`][(c).] is `0`.
"""

divider_thickness: Number = 0
"""
If greater than `0` then `Divider` is used as a spacing between list view items.
Expand Down
Loading