advanced_table 1.0.0 copy "advanced_table: ^1.0.0" to clipboard
advanced_table: ^1.0.0 copied to clipboard

A table widget providing advanced functionality and easier use by allowing the generic display of objects in their JSON representation.

example/main.dart

import 'package:advanced_table/src/advanced_table.dart';
import 'package:advanced_table/src/column_definition.dart';
import 'package:flutter/material.dart';

void main() {
  runApp(const ExampleApp());
}

class ExampleApp extends StatefulWidget {
  const ExampleApp({super.key});

  @override
  State<ExampleApp> createState() => _ExampleAppState();
}

class _ExampleAppState extends State<ExampleApp> {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Example',
      home: Scaffold(
        body: AdvancedTable<Person>(columnDefinitions: [
          ColumnDefinition<int>(
            valueKey: 'age',
            title: 'Age',
          ),
          ColumnDefinition<String>(
            valueKey: 'firstName',
            title: 'First name',
          ),
          ColumnDefinition<String>(
            valueKey: 'lastName',
            title: 'Last name',
          ),
          ColumnDefinition<Gender>(
            valueKey: 'gender',
            title: 'Gender',
          ),
          ColumnDefinition<List<String>?>(
            valueKey: 'food',
            title: 'Favourite Food',
          ),
        ], data: <Person>[
          Person(
              age: 17,
              firstName: 'Hallo',
              lastName: 'Welt',
              gender: Gender.male,
              food: null),
          Person(
              age: 17,
              firstName: 'Hallo',
              lastName: 'Welt',
              gender: Gender.male,
              food: List.of(['this', 'that'])),
          Person(
              age: 17,
              firstName: 'Hallo',
              lastName: 'Welt',
              gender: Gender.male,
              food: List.of(['this', 'that'])),
          Person(
              age: 17,
              firstName: 'Hallo',
              lastName: 'Welt',
              gender: Gender.male,
              food: List.of(['this', 'that']))
        ]),
      ),
    );
  }
}

class Person {
  int age;
  String firstName;
  String lastName;
  Gender gender;
  List<String>? food;

  Person({
    required this.age,
    required this.firstName,
    required this.lastName,
    required this.gender,
    required this.food,
  });

  Map<String, dynamic> toJson() => {
        'age': age,
        'firstName': firstName,
        'lastName': lastName,
        'gender': gender,
        'food': food,
      };
}

enum Gender {
  male,
  female,
  diverse,
}
2
likes
150
points
30
downloads

Publisher

unverified uploader

Weekly Downloads

A table widget providing advanced functionality and easier use by allowing the generic display of objects in their JSON representation.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter

More

Packages that depend on advanced_table