doonfrs / pluto_grid_plus

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.
https://pluto.weblaze.dev
MIT License
18 stars 18 forks source link

[Feature] Dynamic row height #53

Open vixez opened 1 month ago

vixez commented 1 month ago

Hello,

I had opened this feature request a long time ago in the original repo, but it never got implemented. So I was hoping there is a chance of having it implemented it now with the new maintainers.

My original request was:

Is it possible to have dynamic row height? Some of my rows use a renderer with a variable widget height. Since the height is currently fixed, the widgets are cut off.

Kind regards

doonfrs commented 1 month ago

Hi, @vixez Could you please open it again on the current repo. I will try to deploy it ASAP.

vixez commented 1 month ago

Hey @doonfrs, There was no code written for it, it was only a request if the author could add this functionality. But this was never implemented.

stan-at-work commented 1 month ago

Hey @doonfrs, There was no code written for it, it was only a request if the author could add this functionality. But this was never implemented.

This is my approach:

double rowHeight = 75;
final _pageLimit = 25;
final columnHeight = 75;
final footerHeight = 75;

if (widget.fixedRowHeight != null) {
  // Row height is fixed
  rowHeight = widget.fixedRowHeight!;
} else {
  // Row height is calculated
  rowHeight = (((constraints.maxHeight) - (widget.columnHeight + widget.footerHeight)) / _pageLimit) - 1.2;

  rowHeight = rowHeight.clamp(40, 75);
}