custom_table_pagination
A customizable table widget for Flutter with responsive design, pagination, scrollbars, and column sorting. It allows you to display data in a table layout while providing flexibility for column widths, sorting, and pagination.
Features
- Responsive table layout
- Horizontal and vertical scrollbars
- Column sorting with customizable sort icon
- Pagination support
- Customizable row height, column spacing, and border radius
- Supports dynamic data with generic type
<T>
Installation
Add this to your pubspec.yaml:
dependencies:
custom_table_pagination:
git:
url: https://github.com/Ngetsophun/custom_table_pagination.git
dependencies:
custom_table_pagination: ^0.0.2
## Example
The following example shows how to use `snackbar_alert`:
```dart
import 'package:flutter/material.dart';
import 'package:custom_table_pagination/custom_table_pagination.dart';
class MyTablePage extends StatelessWidget {
final List<Map<String, String>> data = [
{"name": "Alice", "age": "25", "city": "Phnom Penh"},
{"name": "Bob", "age": "30", "city": "Siem Reap"},
];
@override
Widget build(BuildContext context) {
return Scaffold(
body: CustomTablePaginationScrollbar<Map<String, String>>(
titleHeader: ["Name", "Age", "City", "Action"],
columnFlex: [2, 1, 2, -1],
data: data,
listItem: (item) => [
Text(item["name"]!),
Text(item["age"]!),
Text(item["city"]!),
IconButton(onPressed: () {}, icon: Icon(Icons.edit)),
],
page: 1,
perPages: 10,
rowHeight: 50,
),
);
}
}