data_table_2
3.0.0, released 3 months ago by saplin.blogspot.com
In-place substitute for Flutter's DataTable and PaginatedDataTable with sticky headers.
What it does
Provides DataTable2, PaginatedDataTable2, and AsyncPaginatedDataTable2 widgets as drop-in substitutes for stock Flutter tables. Adds support for fixed/sticky headers and columns, fixed column widths, scrollbars, and asynchronous data sources.
AI-written summary of version 3.0.0, based on the package's README and metadata. Report an inaccuracy
Use it when
- You need fixed or sticky header and column support in Flutter tables.
- You want a drop-in replacement for stock DataTable and PaginatedDataTable widgets.
- You need to display large or asynchronous datasets efficiently with paginated or async table variants.
Skip it when
- You need cell content auto-sizing based on contents.
- You require expanding/collapsing rows, cell merging (colspan/rowspan), or manual column/row resizing.
- You are using stock Material imports without the material_ui package dependency for version 3.x.
Strengths
- Supports sticky top rows and left columns.
- API mimics stock Flutter DataTable and PaginatedDataTable for easy migration.
- Includes async paginated data source support and flexible column width controls.
Weaknesses
- Does not support auto-sizing cells to fit contents or row expanding/collapsing.
- Requires the standalone material_ui package in version 3.x, which can conflict with standard Flutter Material imports.
- Hover effects on rows do not highlight the entire row when left columns are fixed.
Setup
- Kind
- Flutter widgets
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 2
Add material_ui and data_table_2 to pubspec.yaml and update Material imports to use material_ui.
Padding(
padding: const EdgeInsets.all(16),
child: DataTable2(
columnSpacing: 12,
horizontalMargin: 12,
minWidth: 600,
columns: [
DataColumn2(
label: Text('Column A'),
size: ColumnSize.L,
),
DataColumn(
label: Text('Column B'),
),
],
rows: List<DataRow>.generate(
10,
(index) => DataRow(cells: [
DataCell(Text('A$index')),
DataCell(Text('B$index')),
]))),
)Alternatives
Packages that do the same job and could replace data_table_2.
- flutter_sticky_header
Flutter sliver implementation of sticky headers for CustomScrollView.
91Compare - flutter_expandable_table
A Flutter widget for creating an expandable table with fixed headers and first columns.
82Compare - alphabet_list_view
A ListView with sticky headers and an iOS-like clickable sidebar.
76Compare - easy_sticky_header
An easy-to-use and powerful sticky header for any widget that supports scrolling.
30Compare
Works with
Packages commonly used together with data_table_2: ones it builds on, ones built on it, and its own family.