data_table_2 icon indicating copy to clipboard operation
data_table_2 copied to clipboard

Fix off-by-one error in goToPageWithRow() [fixes #372]

Open devrelm opened this issue 6 months ago • 0 comments

Specifically, in _alignRowIndex():

https://github.com/maxim-saplin/data_table_2/blob/879f9baa25751dd928d2cc8511d95d519cd551bb/lib/src/paginated_data_table_2.dart#L596-L598

We'd expect that _alignRowIndex(9, 10) would return 0, but instead we get 10:

((rowIndex + 1) ~/ rowsPerPage) * rowsPerPage
= ((9 + 1) ~/ 10) * 10
= (10 ~/ 10) * 10
= 1 * 10
= 10

This PR changes this to just be (rowIndex ~/ rowsPerPage) * rowsPerPage.

This also upgrades intl in examples/pubspec.yaml to match the version in the root pubspec.yaml. I was unable to run tests locally otherwise.

devrelm avatar Aug 07 '25 18:08 devrelm