letsar / overflow_view

A widget displaying children in a line until there is not enough space and showing a the number of children not rendered.
MIT License
173 stars 23 forks source link

Implement wrapped items #9

Open thanhle1547 opened 2 years ago

thanhle1547 commented 2 years ago

Hey @letsar, I implemented the #2 enhancement request (Wrapped items). The example is also updated.

The picture below is an example that demonstrates how to control maximum number of rows/columns via parameters maxRun and maxItemPerRun.

overflow_view pr enhancement request 2

Mayb3Nots commented 2 years ago

Thank you for the PR. Exactly what I was looking for. However will be cool if it is possible to calculate the height and width without specifying the maxRun

thanhle1547 commented 2 years ago

Now you don't need to specify the maxRun @Mayb3Nots

Mayb3Nots commented 2 years ago

Now you don't need to specify the maxRun @Mayb3Nots

Wow it seems like the RenderBox already does the calculation and the maxRun wasn't required in the first place? Ive tried to understand how it works under the hood but its very complicated with tons of math 😂. I wonder how did you come to learn to implement so low-level widgets? I also have a question about performance, since from what I can tell we do calculations on intrinsic height and width so will it be costly in terms of performance if the children's are complicated and in huge amounts of numbers? Thanks again you inspire me to learn more about flutter low level framework.

thanhle1547 commented 2 years ago

it seems like the RenderBox already does the calculation and the maxRun wasn't required in the first place?

The maxRun is used to check whether to continue layout other children.

how did you come to learn to implement so low-level widgets?

I start coding! 😁 (Besides taking time to study Flutter source code & read API docs).

do calculations on intrinsic height and width so will it be costly in terms of performance if the children's are complicated and in huge amounts of numbers?

This video gives some explanations which specifically help with your question.

Keep going 🚀

Mayb3Nots commented 1 year ago

Hi @thanhle1547, thanks again for your hard work. However while using your PR when there is 15 item in the children's I'm getting an error RangeError (index): Invalid value: Valid value range is empty: -1 in line 905. Any advice?