easy_table 2.0.0 easy_table: ^2.0.0 copied to clipboard
A full customized data table that builds the cells on demand. Focused on Web/Desktop Applications. Bidirectional scroll bars.
import 'package:easy_table/easy_table.dart';
import 'package:flutter/material.dart';
void main() {
runApp(const ExampleApp());
}
class Person {
Person(this.name, this.age);
final String name;
final int age;
}
class ExampleApp extends StatelessWidget {
const ExampleApp({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return const MaterialApp(
debugShowCheckedModeBanner: false,
title: 'EasyTable Example',
home: HomePage(),
);
}
}
class HomePage extends StatefulWidget {
const HomePage({Key? key}) : super(key: key);
@override
State<HomePage> createState() => _HomePageState();
}
class _HomePageState extends State<HomePage> {
EasyTableModel<Person>? _model;
@override
void initState() {
super.initState();
List<Person> rows = [
Person('Landon', 19),
Person('Sari', 22),
Person('Julian', 37),
Person('Carey', 39),
Person('Cadu', 43),
Person('Delmar', 72)
];
_model = EasyTableModel<Person>(rows: rows, columns: [
EasyTableColumn(name: 'Name', stringValue: (row) => row.name),
EasyTableColumn(name: 'Age', intValue: (row) => row.age)
]);
}
@override
Widget build(BuildContext context) {
return Scaffold(body: EasyTable<Person>(_model));
}
}