Giter Site home page Giter Site logo

getuget / sticky-headers-table Goto Github PK

View Code? Open in Web Editor NEW

This project forked from alexbacich/sticky-headers-table

1.0 0.0 0.0 1.52 MB

Table with sticky headers

License: BSD 2-Clause "Simplified" License

Dart 98.22% Kotlin 0.39% Swift 1.27% Objective-C 0.12%

sticky-headers-table's Introduction

table_sticky_headers

This package for Flutter allows you to display two-dimension table with both sticky headers.

Key of this package is sticky headers. You can scroll table any direction and headers (top and left) will always stay. Cells themselves are fully customizable as you can fill them with Widgets.

To work with table you need to fill it with data. It has three builders for generating title column (List), title row (List) and content itself (List.

Simplest UseCase. You have two-dimensional array of Strings. Builder takes value from array and generates Text widget:

contentCellBuilder: (i, j) => Text(data[i][j]),

For more advanced usage - decorate Text with other widgets like borders, cell colors, etc. Check decorated_example.dart to see it in action. You can also wrap cell with tap listeners and add custom behavior on tap. Check tap_handler_example.dart.

The cell dimensions can be customized using the cellDimensions property of StickyHeadersTable. Use:

  • CellDimensions.base: Default fixed values.
  • CellDimensions.uniform: Same dimensions for each cell.
  • CellDimensions.fixed: Custom fixed width and height for each content cell.
  • CellDimensions.variableColumnWidth: Different width for each column.
  • CellDimensions.variableRowHeight: Different height for each row.
  • CellDimensions.variableColumnWidthAndRowHeight: Different width for each column and different height for each row.

The alignment of the cell contents can be customized using the cellAlignments property of StickyHeadersTable. Use:

  • CellAlignments.base: Default alignment value (Alignment.center).
  • CellAlignments.uniform: Same alignment for each cell.
  • CellAlignments.fixed: Same alignment for each content cell, but different alignment for the sticky column, row and legend.
  • CellAlignments.variableColumnAlignment: Different alignment for each column.
  • CellAlignments.variableRowAlignment: Different alignment for each row.
  • CellAlignments.variable: Different alignment for every cell.

Feature requests and PRs are welcome.

Examples

Widget usage example:

// titleColumn - List<String> (title column)
// titleColumn - List<String> (title row)
// titleColumn - List<List<String>> (data)

StickyHeadersTable(
          columnsLength: titleColumn.length,
          rowsLength: titleRow.length,
          columnsTitleBuilder: (i) => Text(titleColumn[i]),
          rowsTitleBuilder: (i) => Text(titleRow[i]),
          contentCellBuilder: (i, j) => Text(data[i][j]),
          legendCell: Text('Sticky Legend'),
        ),

Visit examples to see it in details

Support

Please file issues and feature requests.

Getting Started

This project is a starting point for a Dart package, a library module containing code that can be shared easily across multiple Flutter or Dart projects.

For help getting started with Flutter, view our online documentation, which offers tutorials, samples, guidance on mobile development, and a full API reference.

sticky-headers-table's People

Contributors

alexbaramilis avatar alexbacich avatar

Stargazers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.