Repository navigation
DataTable - make scrollable, set background colour and fix/freeze header row and first column #30770
Copy link
Copy link
Closed
flutter/packages
#4536Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work lista: qualityA truly polished experienceA truly polished experiencec: new featureNothing broken; request for a new capabilityNothing broken; request for a new capabilityc: proposalA detailed proposal for a change to FlutterA detailed proposal for a change to Fluttercustomer: crowdAffects or could affect many people, though not necessarily a specific customer.Affects or could affect many people, though not necessarily a specific customer.frameworkflutter/packages/flutter repository. See also f: labels.flutter/packages/flutter repository. See also f: labels.p: material_uimaterial_ui package in flutter/packagesmaterial_ui package in flutter/packagesteam-designOwned by Design Languages teamOwned by Design Languages teamtriaged-designTriaged by Design Languages teamTriaged by Design Languages team
Description
I've started developing in Flutter with webview, charts, tables, but I met some problems with tables.
- I use DataTable to represent data in a table.
There is a first problem. By default, it isn't scrollable if data is out of a screen. So I embedded in some Widgets (i.e. SingleChildScrollView, ListView), but it was scrollable only in one direction (vertical or horizontal). I searched something about it and I found a plugin for both directions (bidirectional_scroll_view 0.0.6). After compilation I received an error
Because app depends on bidirectional_scroll_view >=0.0.2 which
requires SDK version <2.1.0, version solving failed.
I'm using Dart SDK version: >=2.1.0 <3.0.0 in configuration.
Next, I found PaginatedDataTable which allows scrollable in both directions, but it is paginated table.
So anybody know is it possible to somehow scroll DataTable in both directions (vertical and horizontal)?
- The second question (more important): is it possible to set background colour in header (first) row and first column in a table? Or even in any cell in a table?
For DataColumn/DataCell I tried embed Text in Container and then set Container colour, but the background colour was only set for text, the rest of a cell was with default colour.
i.e.
DataColumn(label: Container(child: Text('2011'), color: Colors.grey,)),
- And is it possible to fixed/freeze header (first) row and first column. I mean the table is scrolled and first row/column is always visible on a screen. I couldn't find any solution ..
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work lista: qualityA truly polished experienceA truly polished experiencec: new featureNothing broken; request for a new capabilityNothing broken; request for a new capabilityc: proposalA detailed proposal for a change to FlutterA detailed proposal for a change to Fluttercustomer: crowdAffects or could affect many people, though not necessarily a specific customer.Affects or could affect many people, though not necessarily a specific customer.frameworkflutter/packages/flutter repository. See also f: labels.flutter/packages/flutter repository. See also f: labels.p: material_uimaterial_ui package in flutter/packagesmaterial_ui package in flutter/packagesteam-designOwned by Design Languages teamOwned by Design Languages teamtriaged-designTriaged by Design Languages teamTriaged by Design Languages team
Type
Projects
- StatusShow more project fieldsDone

Activity
Richard-Choooou commentedon Aug 13, 2019
Can not agree anymore, the third problem is most important for me.
you can use Table, TableRow, TableCell widget custom you table for the third problem, but their widgets look like can not define events.
harishshet222 commentedon Sep 20, 2019
is there any one who found solution for the 3rd problem, even I am facing the same. I want to freeze the first row and first column of row, so once scroll down those should be visible.
, or any other way to do so,
here what I am doing is, but here once get scrolled the first row also goes up
didavid61202 commentedon Sep 23, 2019
same here, the third problem is most important for me too.
really hope someone know if there's any way to implement it.
Goostavo commentedon Oct 24, 2019
There is an specific thread only about the third item (fix/freeze columns). #21165
Also. We are currently making an workaround on stackOverflow: StackOverflow Issue on fixing header/row
nikesh03 commentedon Feb 2, 2020
this might help https://pub.dev/packages/table_sticky_headers
pulstar commentedon Feb 9, 2020
You can try something like this, but the table_sticky_headers above is the best option, I think.
Viacheslav-Romanov commentedon Mar 17, 2020
Good points!
normidar commentedon May 5, 2020
This problem has been bothering me for a long time, why is it still unsolved after so long?
nikesh03 commentedon May 5, 2020
17 remaining items
joo commentedon Jul 20, 2023
[two_dimensional_scrollables] TableView (#4536)
github-actions commentedon Aug 31, 2023
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 -vand a minimal reproduction of the issue.[two_dimensional_scrollables] TableView (flutter#4536)
[two_dimensional_scrollables] TableView (flutter#4536)