bosskmk / pluto_grid

PlutoGrid is a dataGrid for flutter that can be controlled by the keyboard on desktop and web. Of course, it works well on Android and IOS.

Home Page:https://pluto.weblaze.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[4.0.0] "Pseudo" Regression + Feature: even/odd row colors

henry2man opened this issue · comments

Using latest 4.0.0 I've found an issue related with color callbacks.

In 3.x.x I had a rowColorCallback utility that served me to show even & odd columns in different colors (using the well-known white-grey pattern). In this case I do not care about order because the only one thing I want to do is visually assist to the end-users.

Now with 4.0.0 I suspect the callback is not called anymore on column reorder and/or I'm doing something wrong. When the grid is loaded the callback works great but, on column reorder, the row color is "fixed" and not calculated anymore:

Normal grid:
Captura de Pantalla 2022-06-14 a las 11 54 42

Sorted grid:
Captura de Pantalla 2022-06-14 a las 11 55 06

Even if my code could be fixed I think that it could be really simple to add a oddColor property to PlutoGridConfiguration in order to achieve the same behavior without anything fancy.

For reference, this is my code:

static Color evenOddRowColorCallback(PlutoRowColorContext rowColorContext) =>
      rowColorContext.rowIdx % 2 == 0
          ? Colors.white
          : Colors.grey;

@henry2man
First of all, sorry for the late reply.
Lately, I've been concentrating on improving the performance, so the issue check is late.

Should the background color be shown as in the image of "Sorted grid"?
When I run the code you attached, "Normal grid" is displayed regardless of the alignment state.
Are you saying it should look like a "Sorted grid" image when sorted?

Adding the oddColor property is fine.

The purpose of this merely visual, in order to recreate this well known pattern, the same as this jQuery SO question: https://stackoverflow.com/questions/21906215/jqgrid-odd-even-row-color

Prior to 4.0.0 this simple callback worked fine but, as I said, probably current behaviour is more performant (the callback should be invoked once on every data refresh) so in order to achieve the even/odd effect we may add a Color? oddColor property to PlutoGridConfiguration

First of all, sorry for the late reply.

@bosskmk You do not need to apologize! We all do (or should) what we can to contribute. But this is not a paid service at the moment, so the wait is totally justified.

@henry2man

Consider adding oddColor in the next version. thank you.

PlutoGrid 5.0.0 has been deployed.
There are other changes from version 4, so please check the ChangeLog.
https://pub.dev/packages/pluto_grid/changelog#500---2022-7-11

The demo page has also been updated.
https://weblaze.dev/pluto_grid/build/web/#/

@bosskmk That's great! There are a lot of good changes. But, hey, please stop bumping major version every time :)!

pluto_grid_export is broken again, do we have any incompatible code for that?:

Because pluto_grid_export 1.0.2 depends on pluto_grid >=3.0.2 <5.0.0 and no versions of pluto_grid_export match >1.0.2 <2.0.0, pluto_grid_export ^1.0.2 requires pluto_grid >=3.0.2 <5.0.0... ( #464 (comment) )

@henry2man
Added PlutoGrid version of pluto_grid_export .
PlutoGridExport 1.0.3

And from now on, I will take care of the API changes for the lower version of PlutoGrid.

@henry2man
Thank you every time.

Closed as Fixed in 5.0.0