updateElasticCount method
Given a new elastic count, check if the new value will have impact on the total size of the grid and update it.
To update the elastic count we need to make sure that:
- its diferent from the previous one;
- its bigger than the table's size and that the previous elastic count was already affecting the table's size;
If this conditions aren't met, the elastic count update won't have any impact on the UX and therefore can be skipped.
Implementation
void updateElasticCount(int newElasticCount) {
if (newElasticCount == value.elasticCount) {
return;
}
if (newElasticCount <= value.count && value.elasticCount <= value.count) {
return;
}
value = value.copyWith(elasticCount: newElasticCount);
}