Skip to content

Frustrations with DataTable #151005

Closed

Description

@nate-thegrate

google search pages

There was a lot of pagination back in the good old days, but modern apps have transitioned to use infinite scrolling.


ListTile

Flutter list tiles are fantastic—instead of just a single class, the material library also supplies AboutListTile, CheckboxListTile, RadioListTile, and SwitchListTile, each with their own onTap configuration.


DataTable

Conversely, it's impossible to set an onTap callback for a DataRow.

There's an onLongPress option, but the only way to have a callback for a tap is to use onSelectChanged, which automatically adds a column of checkboxes. And there's no option to wrap with an InkWell or GestureDetector, since DataRow isn't a widget.


I'm currently working with a nonprofit to make a Flutter app. My friend @ChaAbby went to the effort of implementing a DataTable, only to discover that its performance drops off quickly as it grows in length. We'll have to either scrap it and switch to a CustomScrollView, or use the paginated version and work with a user interface that belongs in the previous decade.



Every widget in the Material library applies to a Material 3 component, with one exception.
If we end up implementing something along the lines of #143499 for older widgets, it should also apply to DataTable.

Activity

  1. added
    p: material_uimaterial_ui package in flutter/packages
    c: performanceRelates to speed or footprint issues (see "perf:" labels)
    f: scrollingViewports, list views, slivers, etc.
    perf: speedPerformance issues related to (mostly rendering) speed
    team-designOwned by Design Languages team
    on Jun 28, 2024
  2. Piinks commented on Jul 3, 2024

    @Piinks
    Contributor

    @nate-thegrate is there a specific feature or bug that this issue is covering? I am not sure what PR we could raise to resolve it as it is. :)

    implementing a DataTable, only to discover that its performance drops off quickly as it grows in length.

    This is because the DataTable is not designed for scrolling. It is a box widget as opposed to a sliver, and will lay out all of its content rather than optimizing for what is currently visible. The TableView widget in the two_dimensional_scrollables package could help. It can scroll in 2D, but you can also use it to build a lazy 1D scrolling table.

    Every widget in the Material library applies to a Material 3 component, with one exception.

    What is the exception? There are multiple material widgets that existed before M3 and have not been updated since they are not part of the M3 spec.

  3. nate-thegrate commented on Jul 3, 2024

    @nate-thegrate
    ContributorAuthor

    At one point, I decided to read through the full widget index, and my conclusion was that DataTable was the only class that does not apply to either the Material or Cupertino design systems.

    This issue was intended more along the lines of the dart-lang request template, i.e. describing a problem without any proposal for a solution. Perhaps I'll be able to refer to it a few months down the line.

    Thanks for taking the time to read it over; I'm good with marking this as P3 if that's good with you.

  4. added
    P3Issues that are less important to the Flutter project
    triaged-designTriaged by Design Languages team
    on Jul 3, 2024
  5. Piinks commented on Jul 3, 2024

    @Piinks
    Contributor

    and my conclusion was that DataTable was the only class that does not apply to either the Material or Cupertino design systems.

    It is not. DataTable implements the original Material Design.

    describing a problem

    I am still not sure what the problem is though. Can you explain?

  6. removed
    P3Issues that are less important to the Flutter project
    triaged-designTriaged by Design Languages team
    on Jul 3, 2024
  7. nate-thegrate commented on Jul 3, 2024

    @nate-thegrate
    ContributorAuthor

    DataTable implements the original Material Design.

    That's a good point; I apologize for misspeaking earlier. I think it would be more accurate to say "out of all the widgets in the Material library, DataTable is, by a significant margin, the most different from any Material 3 component."


    My problems with DataTable are entirely subjective: on multiple occasions I've tried adding one to an app and found the lack of customizability very frustrating.

    Instead of a border, columns are separated using 56-pixel-wide blank space by default. That, combined with its lack of scrolling optimization, makes it stick out to me as a widget that isn't suitable for mobile apps.


    Thanks for letting me know about the TableView widget; it appears to address all of DataTable's shortcomings, so I'm excited to learn more about it.

    At this point, it's clear to me that a GitHub issue was not the appropriate place to vent these frustrations; I probably should have shared this on Reddit or Discord instead.

  8. nate-thegrate commented on Jul 5, 2024

    @nate-thegrate
    ContributorAuthor

    I am not sure what PR we could raise to resolve it as it is.

    Just thought of something!

  9. github-actions commented on Jul 22, 2024

    @github-actions

    This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

  10. locked as resolved and limited conversation to collaborators on Jul 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    c: performanceRelates to speed or footprint issues (see "perf:" labels)f: scrollingViewports, list views, slivers, etc.p: material_uimaterial_ui package in flutter/packagesperf: speedPerformance issues related to (mostly rendering) speedteam-designOwned by Design Languages team

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions