Open slovnicki opened 3 years ago
Sorry for late response.
I understand that you want to hide the hex at position.
In addition to what you have provide buildTile
function with transparent hex like this:
buildTile: (col, row) {
if (row * columns + col >= myItems.length) {
return HexagonWidgetBuilder(color: Colors.transparent);
}
return HexagonWidgetBuilder();
}
This was added in version 0.7
@orlikraf is this something you would like to be handled internally? (I can try to make a PR sometime this week)
For example, to provide a count
to HexagonOffsetGrid
and then have it call these builders just for count
times, removing the need for users to check if (row * columns + col >= count)
This could be useful. Feel free to create a PR and I will check is when I find time.
I wonder if HexagonOffsetGrid
should get additional named constructors that takes new builder function based on count
parameter or alternatively accepting an array of widget children which would nicely translate to count as well.
Hi any update on this? I'm looking for something like this which basically focus on total no hexagon.
I didn't have time to work on this.
@orlikraf At first glance, can we just add a nullable count
property, add it to all named constructors and then do
if (count != null && row * this.columns + col > count) {
return SizedBox.shrink();
}
I if have time next week I will try your suggestion.
Is it possible to have a
HexagonOffsetGrid
with, for example, 2 rows and 4 columns with a total of 7HexagonWidgets
?In my project, I'm faking the rest to fill the incomplete row, something like this: