Skip to content

Conversation

@aakash-pamnani
Copy link
Contributor

@aakash-pamnani aakash-pamnani commented Aug 16, 2023

Fixed empty rows at the last page in paginated data table

BEFORE:
Before

AFTER:
After

Issues resolves : #80421

Pre-launch Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I read and followed the Flutter Style Guide, including Features we expect every widget to implement.
  • I signed the CLA.
  • I listed at least one issue that this PR fixes in the description above.
  • I updated/added relevant documentation (doc comments with ///).
  • I added new tests to check the change I am making, or this PR is test-exempt.
  • All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel on Discord.

@flutter-dashboard
Copy link

It looks like this pull request may not have tests. Please make sure to add tests before merging. If you need an exemption to this rule, contact Hixie on the #hackers channel in Chat (don't just cc him here, he won't see it! He's on Discord!).

If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix?

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing.

@github-actions github-actions bot added framework flutter/packages/flutter repository. See also f: labels. f: material design flutter/packages/flutter/material repository. labels Aug 16, 2023
Copy link
Contributor

@HansMuller HansMuller left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will need a test.

@Hixie - once a test is added, can you review this one?

@MarkOSullivan94
Copy link
Contributor

Also noticed this when making use of PaginatedDataTable. Would be good to see this fixed and merged into main.

If @aakash-pamnani is busy can someone else cherry-pick their commit and then a follow up commit to ensure it's tested so this can be merged?

@aakash-pamnani
Copy link
Contributor Author

aakash-pamnani commented Sep 1, 2023

I have added the test for SizedBox height at last page.

Copy link
Contributor

@Piinks Piinks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @aakash-pamnani thanks for contributing!
This looks like a breaking change, can you alter it so it is not breaking?
Some users may prefer the default empty rows, and looking at the code it appears to be very intentional in its design. I think it's a good idea to give folks the option though. Can you update this to maintain the current default, and add a parameter folks can set to opt-in to this new behavior?

@Piinks
Copy link
Contributor

Piinks commented Sep 11, 2023

It also looks like there are a lot of failing tests here, can you take a look? Thank you!

@aakash-pamnani
Copy link
Contributor Author

Hi @Piinks thanks for reviewing the PR, I will make the required changes soon.

And the test are failing after the last merge will also look into that.

/// {@macro flutter.material.dataTable.headingRowColor}
final MaterialStateProperty<Color?>? headingRowColor;

/// If true, the last page will not show empty rows.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens if it is false? What is the default value? These should be documented.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/// A boolean variable that controls the visibility of empty rows on the last page
/// of a paginated data table.
///
/// The default value is `true`, which means empty rows will be visible on the
/// last page of the paginated data table. When set to `false`, empty rows will
/// not be visible on the last page.
///
bool? showEmptyRows;

Will this work?

Copy link
Contributor

@Piinks Piinks Oct 10, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about:

/// Controls the visibility of empty rows on the last page of a
/// [PaginatedDataTable].
///
/// Defaults to `true`, which means empty rows will be populated on the /// last page of the table if there is not enough content.
/// When set to `false`, empty rows will not be created.
final bool showEmptyRows;

Also, I don't think this value should be nullable. What would a null case be, and its behavior?

this.controller,
this.primary,
this.headingRowColor,
this.hideEmptyLastPageRows = false,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm.. naming is hard. Having a negating name default to false can be confusing for users.

What about ..

  • showEmptyRows
  • displayEmptyRows
  • populateEmptyRows
  • includeBlanksRows

I think having a default value of true along with a name to match would be nice. :)

Copy link
Contributor

@Piinks Piinks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Flutter_LGTM
Thank you for the contribution!

Copy link
Member

@cbracken cbracken left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm!

@aakash-pamnani
Copy link
Contributor Author

Flutter_LGTM Thank you for the contribution!

Welcome,
And ThankYou for your help and support.

@Piinks Piinks added the autosubmit Merge PR when tree becomes green via auto submit App label Oct 18, 2023
@auto-submit auto-submit bot merged commit 941897f into flutter:master Oct 18, 2023
auto-submit bot pushed a commit to flutter/packages that referenced this pull request Oct 19, 2023
Manual roll Flutter from 6eea6e2 to 189196d (44 revisions)

Manual roll requested by [email protected]

flutter/flutter@6eea6e2...189196d

2023-10-18 [email protected] Roll Flutter Engine from ab86c53c19cd to 6caee3236d37 (2 revisions) (flutter/flutter#136834)
2023-10-18 98614782+auto-submit[bot]@users.noreply.github.com Reverts "[Reland] Skip injecting Bonjour settings when port publication is disabled" (flutter/flutter#136839)
2023-10-18 [email protected] Convert menus to use OverlayPortal (flutter/flutter#130534)
2023-10-18 [email protected] [Reland] Skip injecting Bonjour settings when port publication is disabled (flutter/flutter#136751)
2023-10-18 [email protected] Roll Flutter Engine from 0eff5d191856 to ab86c53c19cd (1 revision) (flutter/flutter#136832)
2023-10-18 [email protected] Fixes ability to call nextFocus() on a node to focus its descendant (flutter/flutter#136773)
2023-10-18 [email protected] Roll Flutter Engine from b778a07f8ae9 to 0eff5d191856 (6 revisions) (flutter/flutter#136829)
2023-10-18 [email protected] Implement GApplication:shutdown so a Flutter developer knows where to put code that should occur on application shutdown. (flutter/flutter#136780)
2023-10-18 [email protected] Roll Flutter Engine from 7f37c9b181af to b778a07f8ae9 (1 revision) (flutter/flutter#136818)
2023-10-18 [email protected] Fix `Slider` `onChanged` callback order & never calls `onChangeStart` on  `SliderInteraction.slideOnly` allowed interaction (flutter/flutter#136720)
2023-10-18 [email protected] Roll Flutter Engine from 78026b4003fe to 7f37c9b181af (1 revision) (flutter/flutter#136817)
2023-10-18 [email protected] [Feat] Stroke color for Slider value indicator (flutter/flutter#135986)
2023-10-18 [email protected] Fixed : Empty Rows shown at last page in Paginated data table (flutter/flutter#132646)
2023-10-18 [email protected] Roll Flutter Engine from 46923fd39032 to 78026b4003fe (1 revision) (flutter/flutter#136814)
2023-10-18 [email protected] Roll Packages from d439062 to 14aa69e (1 revision) (flutter/flutter#136813)
2023-10-18 [email protected] Don't build native assets in `flutter build bundle` (flutter/flutter#136641)
2023-10-18 [email protected] Roll Flutter Engine from c9c9684e03a3 to 46923fd39032 (1 revision) (flutter/flutter#136795)
2023-10-18 [email protected] Roll Flutter Engine from 0c1c29271e8b to c9c9684e03a3 (1 revision) (flutter/flutter#136792)
2023-10-18 [email protected] Roll Flutter Engine from 1de09d13e708 to 0c1c29271e8b (3 revisions) (flutter/flutter#136789)
2023-10-18 [email protected] Roll Flutter Engine from 6fc36e61a99a to 1de09d13e708 (1 revision) (flutter/flutter#136785)
2023-10-18 [email protected] Roll Flutter Engine from 3f818efff3c5 to 6fc36e61a99a (1 revision) (flutter/flutter#136781)
2023-10-18 [email protected] Roll Flutter Engine from 2eef9b43cfb4 to 3f818efff3c5 (3 revisions) (flutter/flutter#136777)
2023-10-18 [email protected] Roll Flutter Engine from 5df7af34a718 to 2eef9b43cfb4 (4 revisions) (flutter/flutter#136774)
2023-10-18 [email protected] Flutter preview device (flutter/flutter#135639)
2023-10-18 [email protected] Add findChildIndexCallback examples (flutter/flutter#133469)
2023-10-18 [email protected] Adds API for performing semantics actions in tests (flutter/flutter#132598)
2023-10-18 [email protected] Roll Flutter Engine from e57b5bac4244 to 5df7af34a718 (2 revisions) (flutter/flutter#136772)
2023-10-17 [email protected] Roll Flutter Engine from f9f937e51080 to e57b5bac4244 (3 revisions) (flutter/flutter#136768)
2023-10-17 [email protected] clean up `--dart-define-from-file` option tests (flutter/flutter#135980)
2023-10-17 [email protected] GoldenFileComparators should dispose created Image objects.  (flutter/flutter#136716)
2023-10-17 [email protected] make integration_test_driver_extended.dart support writeResponseData--(done) (flutter/flutter#128382)
2023-10-17 49699333+dependabot[bot]@users.noreply.github.com Bump actions/checkout from 3.6.0 to 4.1.1 (flutter/flutter#136762)
2023-10-17 [email protected] Roll Flutter Engine from 289f29b1ad00 to f9f937e51080 (1 revision) (flutter/flutter#136755)
2023-10-17 [email protected] Roll Flutter Engine from 659e68a097b5 to 289f29b1ad00 (1 revision) (flutter/flutter#136752)
2023-10-17 [email protected] Support --web-header option for flutter run (flutter/flutter#136297)
2023-10-17 [email protected] Add Android 14 physical devices to firebase tests (flutter/flutter#136736)
2023-10-17 [email protected] Roll Flutter Engine from 62a90a91cee3 to 659e68a097b5 (3 revisions) (flutter/flutter#136746)
2023-10-17 98614782+auto-submit[bot]@users.noreply.github.com Reverts "Skip injecting Bonjour settings when port publication is disabled" (flutter/flutter#136750)
2023-10-17 [email protected] Revert "[SingleChildScrollView] Correct the offset pixels if it is out of range during layout" (flutter/flutter#136744)
2023-10-17 [email protected] Skip injecting Bonjour settings when port publication is disabled (flutter/flutter#136562)
2023-10-17 [email protected] Roll Flutter Engine from 3ecbe924a598 to 62a90a91cee3 (2 revisions) (flutter/flutter#136739)
2023-10-17 [email protected] Roll Flutter Engine from 0a4d8b99a95b to 3ecbe924a598 (3 revisions) (flutter/flutter#136732)
2023-10-17 [email protected] Reenable NexusLowRes API 29 (flutter/flutter#136686)
2023-10-17 [email protected] Reenable the nexus 6p tests (flutter/flutter#136689)
...
@M4st3rChief-S117
Copy link

Hello, I know this issue is closed, but I'm still encountering the problem regarding the empty rows at the end of the page.

  if (widget.showEmptyRows) {
    row ??= null;
  }

I found out that by setting the row in here to null then the last rows are not shown anymore.
Should this issue be reopened, or should I create a new one?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

autosubmit Merge PR when tree becomes green via auto submit App f: material design flutter/packages/flutter/material repository. framework flutter/packages/flutter repository. See also f: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

paginatedDataTable showing empty rows at the end if rowCount is less than rowsPerPage

6 participants