class
UI::ListView
- UI::ListView
- UI::View
- Reference
- Object
Overview
A scrollable list of items with optional sections.
Defined in:
ui/views/list_view.crConstructors
-
.flat(items : Array(View), style : ListStyle = ListStyle::Plain) : ListView
Convenience: create a flat list from an array of views
- .new(sections : Array(Section) = [] of Section, style : ListStyle = ListStyle::Plain, layout : ListLayout = ListLayout::List, columns : Int32 = 3)
Instance Method Summary
-
#accept(visitor : PlatformVisitor)
Accept a platform visitor for rendering dispatch.
-
#columns : Int32
Number of columns when layout == ListLayout::Grid.
-
#columns=(columns : Int32)
Number of columns when layout == ListLayout::Grid.
-
#item_count : Int32
Total number of items across all sections
-
#item_spacing : Float64
Gap between grid cells in points (both horizontal and vertical).
-
#item_spacing=(item_spacing : Float64)
Gap between grid cells in points (both horizontal and vertical).
-
#layout : ListLayout
Layout mode: List (vertical rows) or Grid (multi-column grid).
-
#layout=(layout : ListLayout)
Layout mode: List (vertical rows) or Grid (multi-column grid).
-
#on_item_tap : Proc(Int32, Int32, Nil) | Nil
Callback when an item is tapped (receives section index, item index)
-
#on_item_tap=(on_item_tap : Proc(Int32, Int32, Nil) | Nil)
Callback when an item is tapped (receives section index, item index)
-
#sections : Array(Section)
List sections (use a single section for flat lists)
-
#sections=(sections : Array(Section))
List sections (use a single section for flat lists)
-
#shows_separators : Bool
Whether to show separators between items
-
#shows_separators=(shows_separators : Bool)
Whether to show separators between items
-
#style : ListStyle
Visual style
-
#style=(style : ListStyle)
Visual style
Instance methods inherited from class UI::View
accept(visitor : PlatformVisitor)
accept,
accessibility_label : String | Nil
accessibility_label,
accessibility_label=(accessibility_label : String | Nil)
accessibility_label=,
background : Color | Nil
background,
background=(background : Color | Nil)
background=,
blur_radius : Float64
blur_radius,
blur_radius=(blur_radius : Float64)
blur_radius=,
border_color : Color | Nil
border_color,
border_color=(border_color : Color | Nil)
border_color=,
border_width : Float64
border_width,
border_width=(border_width : Float64)
border_width=,
clip_to_bounds : Bool
clip_to_bounds,
clip_to_bounds=(clip_to_bounds : Bool)
clip_to_bounds=,
container_query(name : String) : self
container_query,
container_query_name : String | Nil
container_query_name,
container_query_name=(container_query_name : String | Nil)
container_query_name=,
corner_radius : Float64
corner_radius,
corner_radius=(corner_radius : Float64)
corner_radius=,
fill_screen! : self
fill_screen!,
fluid_height(min : String | Number, ideal : String | Number, max : String | Number) : selffluid_height : UI::Fluid | Nil fluid_height, fluid_height=(fluid_height : UI::Fluid | Nil) fluid_height=, fluid_width(min : String | Number, ideal : String | Number, max : String | Number) : self
fluid_width : UI::Fluid | Nil fluid_width, fluid_width=(fluid_width : UI::Fluid | Nil) fluid_width=, hidden : Bool hidden, hidden=(hidden : Bool) hidden=, id : String | Nil id, id=(id : String | Nil) id=, maximum_height : Float64 | Nil maximum_height, maximum_height=(maximum_height : Float64 | Nil) maximum_height=, maximum_width : Float64 | Nil maximum_width, maximum_width=(maximum_width : Float64 | Nil) maximum_width=, minimum_height : Float64 | Nil minimum_height, minimum_height=(minimum_height : Float64 | Nil) minimum_height=, minimum_width : Float64 | Nil minimum_width, minimum_width=(minimum_width : Float64 | Nil) minimum_width=, opacity : Float64 opacity, opacity=(opacity : Float64) opacity=, padding : EdgeInsets padding, padding=(padding : EdgeInsets) padding=, root_fill : Bool root_fill, root_fill=(root_fill : Bool) root_fill=, shadow_color : Color | Nil shadow_color, shadow_color=(shadow_color : Color | Nil) shadow_color=, shadow_offset_x : Float64 shadow_offset_x, shadow_offset_x=(shadow_offset_x : Float64) shadow_offset_x=, shadow_offset_y : Float64 shadow_offset_y, shadow_offset_y=(shadow_offset_y : Float64) shadow_offset_y=, shadow_radius : Float64 shadow_radius, shadow_radius=(shadow_radius : Float64) shadow_radius=, swiftkit_state_handle : Pointer(Void) | Nil swiftkit_state_handle, swiftkit_state_handle=(swiftkit_state_handle : Pointer(Void) | Nil) swiftkit_state_handle=, test_id : String | Nil test_id, test_id=(test_id : String | Nil) test_id=
Constructor Detail
Convenience: create a flat list from an array of views
Instance Method Detail
Accept a platform visitor for rendering dispatch.
Each concrete view type calls visitor.visit(self).
Number of columns when layout == ListLayout::Grid. Ignored in List layout mode. Typical HIG photo grids use 2–4 columns.
Number of columns when layout == ListLayout::Grid. Ignored in List layout mode. Typical HIG photo grids use 2–4 columns.
Gap between grid cells in points (both horizontal and vertical). Ignored in List layout mode.
Gap between grid cells in points (both horizontal and vertical). Ignored in List layout mode.
Layout mode: List (vertical rows) or Grid (multi-column grid). Grid maps to NSCollectionView on macOS and UICollectionView on iOS. Default is List for backward compatibility.
Layout mode: List (vertical rows) or Grid (multi-column grid). Grid maps to NSCollectionView on macOS and UICollectionView on iOS. Default is List for backward compatibility.
Callback when an item is tapped (receives section index, item index)
Callback when an item is tapped (receives section index, item index)
List sections (use a single section for flat lists)