lazy_data_table 0.1.5

  • Readme
  • Changelog
  • Example
  • Installing
  • 78

lazy_data_table #

A Flutter widget data table that can be loaded lazily. The table also has a column header row and a row header column that will stay in view. (This widget is still in development, and may not work 100%)

This widget is based on table-sticky-headers made by Alex Bacich, so credits to him.

Features #

  • Scrollable when items overflow
  • Column header row stays in view
  • Row header column stays in view
  • Items are loaded lazily

img not loaded

Usage #

To use this widget, add lazy_data_table: ^0.1.5 to your dependencies in pubspec.yaml

dependencies:
  lazy_data_table: ^0.1.5

Then the package can be included in a file with:

import 'package:lazy_data_table/lazy_data_table.dart';

And then the LazyDataTable can be used as following:
(This example is used to create the table in the gif above)

LazyDataTable(
  rows: 100,
  columns: 100,
  tableDimensions: DataTableDimensions(
    cellHeight: 50,
    cellWidth: 100,
    columnHeaderHeight: 50,
    rowHeaderWidth: 75,
  ),
  tableTheme: DataTableTheme(
    columnHeaderBorder: Border.all(color: Colors.black38),
    rowHeaderBorder: Border.all(color: Colors.black38),
    cellBorder: Border.all(color: Colors.black12),
    cornerBorder: Border.all(color: Colors.black38),
    columnHeaderColor: Colors.white60,
    rowHeaderColor: Colors.white60,
    cellColor: Colors.white,
    cornerColor: Colors.white38,
  ),
  columnHeaderBuilder: (i) => Center(child: Text("Column: ${i + 1}")),
  rowHeaderBuilder: (i) => Center(child: Text("Row: ${i + 1}")),
  dataCellBuilder: (i, j) => Center(child: Text("Cell: $i, $j")),
  cornerWidget: Center(child: Text("Corner")),
),

Issues #

If you have any problems or even suggestions feel free leave them here

[0.1.5] #

  • Fixed bug that caused headers to scroll separately.
  • Expanded example.

[0.1.4] #

  • Changed NotificationListener to GestureDetector.
  • This allows for the ability to scroll in both directions at the same time.(diagonally)

[0.1.3] #

  • Added DataTableDimensions, which holds information about the dimensions of the table.
  • Added DataTableTheme, which holds information about the colors and borders of the table.
  • Added example gif to the README.

[0.1.2] #

  • Updated synchronized ScrollController to be more efficient.

[0.1.1] #

  • Column and row headers are now optional.

[0.0.1] #

  • Initial release

example/lib/main.dart

import 'package:flutter/material.dart';

import 'headerless_table.dart';
import 'simple_table.dart';

void main() {
  runApp(MaterialApp(
    title: 'Example',
    home: MyApp(),
  ));
}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: Text("Examples")),
      body: Center(
        child: Column(
          children: <Widget>[
            RaisedButton(
              child: Text("Simple table"),
              onPressed: () => Navigator.push(context,
                  MaterialPageRoute(builder: (context) => SimpleTable())),
            ),
            RaisedButton(
              child: Text("Header-less table"),
              onPressed: () => Navigator.push(context,
                  MaterialPageRoute(builder: (context) => HeaderlessTable())),
            ),
          ],
        ),
      ),
    );
  }
}

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  lazy_data_table: ^0.1.5

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:lazy_data_table/lazy_data_table.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
56
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
78
Learn more about scoring.

We analyzed this package on Jul 9, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.8.4
  • pana: 0.13.14
  • Flutter: 1.17.5

Analysis suggestions

Package not compatible with SDK dart

Because:

  • lazy_data_table that is a package requiring null.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.7.0 <3.0.0
flutter 0.0.0
Transitive dependencies
collection 1.14.12 1.14.13
meta 1.1.8 1.2.2
sky_engine 0.0.99
typed_data 1.1.6 1.2.0
vector_math 2.0.8 2.1.0-nullsafety
Dev dependencies
flutter_test