All Projects → apgapg → Json_table

apgapg / Json_table

Licence: mit
Flutter package: Json Table Widget to create table from json array

Programming Languages

dart
5743 projects

Projects that are alternatives of or similar to Json table

Criterion
Microbenchmarking for Modern C++
Stars: ✭ 140 (-21.35%)
Mutual labels:  json, library, table
Accord
Data validation library for Rust
Stars: ✭ 72 (-59.55%)
Mutual labels:  json, library
Andes
Python toolbox / library for power system transient dynamics simulation with symbolic modeling and numerical analysis 🔥
Stars: ✭ 68 (-61.8%)
Mutual labels:  library, package
Logger json
JSON console backend for Elixir Logger.
Stars: ✭ 108 (-39.33%)
Mutual labels:  json, package
Laravel Bootstrap Table List
Bootstrap table list generator for Laravel.
Stars: ✭ 16 (-91.01%)
Mutual labels:  package, table
Html Table Cli
Create interactive tables from JSON on the command-line
Stars: ✭ 23 (-87.08%)
Mutual labels:  json, table
Rando Php
RandoPhp is a open source library that implements random generators (Integer, Char, Byte, Sequences, Boolean) and take random sample from arrays
Stars: ✭ 107 (-39.89%)
Mutual labels:  library, package
Pmhttp
Swift/Obj-C HTTP framework with a focus on REST and JSON
Stars: ✭ 509 (+185.96%)
Mutual labels:  json, library
Tosin
Initialize a npm package with everything included, from CI to documentation website
Stars: ✭ 142 (-20.22%)
Mutual labels:  library, package
Scobot
SCORM API for Content. JavaScript library, QUnit tests and examples.
Stars: ✭ 128 (-28.09%)
Mutual labels:  json, package
Sheetjs
📗 SheetJS Community Edition -- Spreadsheet Data Toolkit
Stars: ✭ 28,479 (+15899.44%)
Mutual labels:  json, table
Json Api
Implementation of JSON API in PHP 7
Stars: ✭ 171 (-3.93%)
Mutual labels:  json, library
Terminaltables
Generate simple tables in terminals from a nested list of strings.
Stars: ✭ 685 (+284.83%)
Mutual labels:  library, table
Tabulate
Table Maker for Modern C++
Stars: ✭ 862 (+384.27%)
Mutual labels:  library, table
Jikan
Unofficial MyAnimeList PHP+REST API which provides functions other than the official API
Stars: ✭ 531 (+198.31%)
Mutual labels:  json, library
Internettools
XPath/XQuery 3.1 interpreter for Pascal with compatibility modes for XPath 2.0/XQuery 1.0/3.0, custom and JSONiq extensions, XML/HTML parsers and classes for HTTP/S requests
Stars: ✭ 82 (-53.93%)
Mutual labels:  json, library
Pytablewriter
pytablewriter is a Python library to write a table in various formats: CSV / Elasticsearch / HTML / JavaScript / JSON / LaTeX / LDJSON / LTSV / Markdown / MediaWiki / NumPy / Excel / Pandas / Python / reStructuredText / SQLite / TOML / TSV.
Stars: ✭ 422 (+137.08%)
Mutual labels:  json, table
Qsimpleupdater
Updater system for Qt applications
Stars: ✭ 429 (+141.01%)
Mutual labels:  json, library
Repurrrsive
Recursive lists to use in teaching and examples, because there is no iris data for lists.
Stars: ✭ 112 (-37.08%)
Mutual labels:  json, package
Laravel Paket
Composer GUI. Manage Laravel dependencies from web interface without switching to command line!
Stars: ✭ 143 (-19.66%)
Mutual labels:  library, package

Json Table Widget GitHub stars Twitter Follow GitHub last commit Website shields.ioOpen Source Love

This Flutter package provides a Json Table Widget for directly showing table from a json(Map). Supports Column toggle also.

Live Demo: https://apgapg.github.io/json_table/

Live Data Testing: https://apgapg.github.io/json_table/#/customData

Features

  • The table constructed isn't the flutter's native DataTable.
  • The table is manually coded hence serves a great learning purpose on how to create simple tables manually in flutter
  • Supports vertical & horizontal scroll
  • Supports custom columns includes default value, column name, value builder
  • Supports nested data showing
  • Supports pagination
  • Supports row select color, callback

JsonTable JsonTable JsonTable JsonTable JsonTable JsonTable

💻 Installation

In the dependencies: section of your pubspec.yaml, add the following line:

Version

dependencies:
  json_table: <latest version>

❔ Usage

Import this class

import 'package:json_table/json_table.dart';

- Vanilla Implementation

//Decode your json string
final String jsonSample='[{"id":1},{"id":2}]';
var json = jsonDecode(jsonSample);

//Simply pass this json to JsonTable
child: JsonTable(json)

- Implementation with HEADER and CELL widget builders

JsonTable(
   json,
   tableHeaderBuilder: (String header) {
     return Container(
       padding: EdgeInsets.symmetric(horizontal: 8.0, vertical: 4.0),
       decoration: BoxDecoration(border: Border.all(width: 0.5),color: Colors.grey[300]),
       child: Text(
         header,
         textAlign: TextAlign.center,
         style: Theme.of(context).textTheme.display1.copyWith(fontWeight: FontWeight.w700, fontSize: 14.0,color: Colors.black87),
       ),
     );
   },
   tableCellBuilder: (value) {
     return Container(
       padding: EdgeInsets.symmetric(horizontal: 4.0, vertical: 2.0),
       decoration: BoxDecoration(border: Border.all(width: 0.5, color: Colors.grey.withOpacity(0.5))),
       child: Text(
         value,
         textAlign: TextAlign.center,
         style: Theme.of(context).textTheme.display1.copyWith(fontSize: 14.0, color: Colors.grey[900]),
       ),
     );
   },
 )

Head over to example code: simple_table.dart

- Implementation with custom COLUMNS list

  • Pass custom column list to control what columns are displayed in table
  • The list item must be constructed using JsonTableColumn class
  • JsonTableColumn provides 4 parameters, namely,
JsonTableColumn("age", label: "Eligible to Vote", valueBuilder: eligibleToVote, defaultValue:"NA")
  • First parameter is the field/key to pick from the data
  • label: The column header label to be displayed
  • defaultValue: To be used when data or key is null
  • valueBuilder: To get the formatted value like date etc
JsonTable
//Decode your json string
final String jsonSample='[{"name":"Ram","email":"[email protected]","age":23,"DOB":"1990-12-01"},'
                              '{"name":"Shyam","email":"[email protected]","age":18,"DOB":"1995-07-01"},'
                              '{"name":"John","email":"[email protected]","age":10,"DOB":"2000-02-24"},'
                              '{"name":"Ram","age":12,"DOB":"2000-02-01"}]';
var json = jsonDecode(jsonSample);
//Create your column list
var columns = [
      JsonTableColumn("name", label: "Name"),
      JsonTableColumn("age", label: "Age"),
      JsonTableColumn("DOB", label: "Date of Birth", valueBuilder: formatDOB),
      JsonTableColumn("age", label: "Eligible to Vote", valueBuilder: eligibleToVote),
      JsonTableColumn("email", label: "E-mail", defaultValue: "NA"),
    ];
//Simply pass this column list to JsonTable
child: JsonTable(json,columns: columns)

//Example of valueBuilder
String eligibleToVote(value) {
    if (value >= 18) {
      return "Yes";
    } else
      return "No";
}

Head over to example code: custom_column_table.dart

- Implementation with nested data list

Suppose your json object has nested data like email as shown below:

{"name":"Ram","email":{"1":"[email protected]"},"age":23,"DOB":"1990-12-01"}
  • Just use email.1 instead of email as key
JsonTableColumn("email.1", label: "Email", defaultValue:"NA")
JsonTable
//Decode your json string
final String jsonSample='[{"name":"Ram","email":{"1":"[email protected]"},"age":23,"DOB":"1990-12-01"},'
                               '{"name":"Shyam","email":{"1":"[email protected]"},"age":18,"DOB":"1995-07-01"},'
                               '{"name":"John","email":{"1":"[email protected]"},"age":10,"DOB":"2000-02-24"}]';
var json = jsonDecode(jsonSample);
//Create your column list
var columns = [
      JsonTableColumn("name", label: "Name"),
      JsonTableColumn("age", label: "Age"),
      JsonTableColumn("DOB", label: "Date of Birth", valueBuilder: formatDOB),
      JsonTableColumn("age", label: "Eligible to Vote", valueBuilder: eligibleToVote),
      JsonTableColumn("email.1", label: "E-mail", defaultValue: "NA"),
    ];
//Simply pass this column list to JsonTable
child: JsonTable(json,columns: columns)

Head over to example code: custom_column_nested_table.dart

Column toggle

Option for toggling column(s) also. User can customise which columns are to be shown

 showColumnToggle: true
JsonTable

Row Highlighting

Add row highlighting with custom color support

JsonTable
allowRowHighlight: true,
rowHighlightColor: Colors.yellow[500].withOpacity(0.7),

Row Select Callback

Get the index and data map of a particular selected row. Note index might return incorrect value in case of pagination

onRowSelect: (index, map) {
    print(index);
    print(map);
  },

Pagination

Just provide an int value to paginationRowCount parameter

JsonTable
paginationRowCount: 4,

TODO

  • [X] Custom header list parameter. This will help to show only those keys as mentioned in header list
  • [X] Add support for keys missing in json object
  • [X] Add support for auto formatting of date
  • [X] Extracting column headers logic must be change. Not to depend on first object
  • [X] Nested data showing support
  • [X] Row highlight support
  • [X] Row select callback
  • [X] Wrap filters in expansion tile
  • [X] Pagination support
  • [ ] Add option to change header row to vertical row on left

⭐ My Flutter Packages

  • pie_chart GitHub stars Flutter Pie Chart with cool animation.
  • avatar_glow GitHub stars Flutter Avatar Glow Widget with glowing animation.
  • search_widget GitHub stars Flutter Search Widget for selecting an option from list.
  • animating_location_pin GitHub stars Flutter Animating Location Pin Widget providing Animating Location Pin Widget which can be used while fetching device location.

⭐ My Flutter Apps

👍 Contribution

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -m 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].