How to implement GirdListView #3441
Replies: 2 comments 1 reply
-
Thanks for your question. (Note: I've moved this issue to Discussions as it's better suited for general questions and community interactions. This helps keep our issue tracker focused on bug reports and feature requests.) The way to do this kind of grid is to manually compute the position of your elements within the for loop. An example of this can be found in the memory tutorial: slint/examples/memory/memory.slint Lines 103 to 107 in 8284674 |
Beta Was this translation helpful? Give feedback.
-
Hi ! I think you might wanna use the component in my repo : https://github.com/syf20020816/SurrealismUI SURCollectionSURCollection is a grid storage box, but in reality it is not based on grid layout. It achieves a flexible grid through a combination of dual for loops and horizontal and vertical layouts Clicking on the pop-up layer again will close it exampleimport {SURButton,SURCollection} from "../../index.slint";
import {Themes,Icons} from "../../themes/index.slint";
component TestCollection inherits Window {
height: 560px;
width: 900px;
SURCollection{
card-height: 300px;
card-width: 300px;
column-num: 3;
font-size : 16px;
theme: Dark;
data: [
[
{id:0,name:"box1",source:@image-url("./collection_imgs/box1.svg")},
{id:1,name:"box2",source:@image-url("./collection_imgs/box2.svg")},
{id:2,name:"box3",source:@image-url("./collection_imgs/box3.svg")}
],
[
{id:3,name:"box4",source:@image-url("./collection_imgs/box4.svg")},
],
[
{id:4,name:"box6",source:@image-url("./collection_imgs/box6.svg")},
{id:5,name:"box7",source:@image-url("./collection_imgs/box7.svg")},
]
];
clicked(item)=>{
debug(item.name);
debug(item.id);
}
}
} |
Beta Was this translation helpful? Give feedback.
-
Similar to the effect of photo album palace grid, for example, there are 4 pictures in each row, and the data is processed by a for loop. I have not found any relevant implementation cases.
Beta Was this translation helpful? Give feedback.
All reactions