{"id":13548983,"url":"https://github.com/apgapg/json_table","last_synced_at":"2025-04-05T17:07:09.175Z","repository":{"id":52220496,"uuid":"189538522","full_name":"apgapg/json_table","owner":"apgapg","description":"Flutter package: Json Table Widget to create table from json array","archived":false,"fork":false,"pushed_at":"2024-04-14T08:03:56.000Z","size":4090,"stargazers_count":207,"open_issues_count":26,"forks_count":58,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-03-29T16:06:07.319Z","etag":null,"topics":["dart","flutter","flutter-package","flutter-table","json","json-table","library","package","pub","table"],"latest_commit_sha":null,"homepage":"https://pub.dev/packages/json_table","language":"Dart","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/apgapg.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":null,"patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"custom":["paypal.me/ayushpgupta"]}},"created_at":"2019-05-31T06:17:17.000Z","updated_at":"2025-02-15T18:10:21.000Z","dependencies_parsed_at":"2024-03-16T20:25:55.513Z","dependency_job_id":"afaf6955-e4f8-4a5c-8519-926fefa251c4","html_url":"https://github.com/apgapg/json_table","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apgapg%2Fjson_table","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apgapg%2Fjson_table/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apgapg%2Fjson_table/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apgapg%2Fjson_table/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/apgapg","download_url":"https://codeload.github.com/apgapg/json_table/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247369952,"owners_count":20927928,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dart","flutter","flutter-package","flutter-table","json","json-table","library","package","pub","table"],"created_at":"2024-08-01T12:01:16.868Z","updated_at":"2025-04-05T17:07:09.146Z","avatar_url":"https://github.com/apgapg.png","language":"Dart","funding_links":["paypal.me/ayushpgupta"],"categories":["Dart"],"sub_categories":[],"readme":"# Json Table Widget [![GitHub stars](https://img.shields.io/github/stars/apgapg/json_table.svg?style=social)](https://github.com/apgapg/json_table) [![Twitter Follow](https://img.shields.io/twitter/url/https/@ayushpgupta.svg?style=social)](https://twitter.com/ayushpgupta) ![GitHub last commit](https://img.shields.io/github/last-commit/apgapg/json_table.svg) [![Website shields.io](https://img.shields.io/website-up-down-green-red/http/shields.io.svg)](https://play.google.com/store/apps/details?id=com.coddu.flutterprofile)[![Open Source Love](https://badges.frapsoft.com/os/v2/open-source.svg?v=103)](https://github.com/apgapg/json_table)\n\nJoin us on Discord: https://discord.gg/7byeCn7MGF\n\n## 💙 Proudly Sponsored by [FieldAssist](https://github.com/FieldAssist)\n\n\u003cp align=\"center\"\u003e\n\u003ctable\u003e    \n    \u003ctbody\u003e\n        \u003ctr\u003e\n            \u003ctd align=\"center\"\u003e\n                \u003ca href=\"https://www.fieldassist.in/\" target=\"_blank\"\u003e\u003cimg width=\"250px\" src=\"https://www.fieldassist.in/wp-content/uploads/2016/11/Copy-of-Untitled-1.png\"/\u003e\u003c/a\u003e\u003cbr/\u003e\u003cspan\u003e\u003ca href=\"https://www.fieldassist.in/request-demo\" target=\"_blank\"\u003eRequest a Demo\u003c/a\u003e\u003c/span\u003e\n            \u003c/td\u003e            \n        \u003c/tr\u003e\n    \u003c/tbody\u003e\n\u003c/table\u003e\n\u003c/p\u003e\n\nThis Flutter package provides a Json Table Widget for directly showing table from a json(Map). Supports Column toggle also.\n\nLive Demo: [https://apgapg.github.io/json_table/](https://apgapg.github.io/json_table/)\n\nLive Data Testing: [https://apgapg.github.io/json_table/#/customData](https://apgapg.github.io/json_table/#/customData)\n\n### Features\n- The table constructed isn't the flutter's native DataTable.\n- The table is manually coded hence serves a great learning purpose on how to create simple tables manually in flutter\n- Supports vertical \u0026 horizontal scroll\n- Supports custom columns includes default value, column name, value builder\n- Supports nested data showing\n- Supports pagination\n- Supports row select color, callback\n  \n  \n\n\u003cimg src=\"https://raw.githubusercontent.com/apgapg/json_table/master/src/s1.gif\"  height = \"400\" alt=\"JsonTable\"\u003e \u003cimg src=\"https://raw.githubusercontent.com/apgapg/json_table/master/src/s2.gif\"  height = \"400\" alt=\"JsonTable\"\u003e \u003cimg src=\"https://raw.githubusercontent.com/apgapg/json_table/master/src/s3.gif\"  height = \"400\" alt=\"JsonTable\"\u003e \u003cimg src=\"https://raw.githubusercontent.com/apgapg/json_table/master/src/ss1.png\"  height = \"400\" alt=\"JsonTable\"\u003e \u003cimg src=\"https://raw.githubusercontent.com/apgapg/json_table/master/src/ss4.png\"  height = \"400\" alt=\"JsonTable\"\u003e \u003cimg src=\"https://raw.githubusercontent.com/apgapg/json_table/master/src/ss6.png\"  height = \"400\" alt=\"JsonTable\"\u003e\n\n\n# 💻 Installation\nIn the `dependencies:` section of your `pubspec.yaml`, add the following line:\n\n[![Version](https://img.shields.io/pub/v/json_table.svg)](https://pub.dartlang.org/packages/json_table)\n\n```yaml\ndependencies:\n  json_table: \u003clatest version\u003e\n```\n\n# ❔ Usage\n\n### Import this class\n\n```dart\nimport 'package:json_table/json_table.dart';\n```\n\n### - Vanilla Implementation\n```dart\n//Decode your json string\nfinal String jsonSample='[{\"id\":1},{\"id\":2}]';\nvar json = jsonDecode(jsonSample);\n\n//Simply pass this json to JsonTable\nchild: JsonTable(json)\n```\n\n### - Implementation with HEADER and CELL widget builders\n```dart\nJsonTable(\n   json,\n   tableHeaderBuilder: (String header) {\n     return Container(\n       padding: EdgeInsets.symmetric(horizontal: 8.0, vertical: 4.0),\n       decoration: BoxDecoration(border: Border.all(width: 0.5),color: Colors.grey[300]),\n       child: Text(\n         header,\n         textAlign: TextAlign.center,\n         style: Theme.of(context).textTheme.display1.copyWith(fontWeight: FontWeight.w700, fontSize: 14.0,color: Colors.black87),\n       ),\n     );\n   },\n   tableCellBuilder: (value) {\n     return Container(\n       padding: EdgeInsets.symmetric(horizontal: 4.0, vertical: 2.0),\n       decoration: BoxDecoration(border: Border.all(width: 0.5, color: Colors.grey.withOpacity(0.5))),\n       child: Text(\n         value,\n         textAlign: TextAlign.center,\n         style: Theme.of(context).textTheme.display1.copyWith(fontSize: 14.0, color: Colors.grey[900]),\n       ),\n     );\n   },\n )\n```\n\nHead over to example code: [simple_table.dart](https://github.com/apgapg/json_table/blob/master/example/lib/pages/simple_table.dart)\n\n### - Implementation with custom COLUMNS list   \n\n- Pass custom column list to control what columns are displayed in table\n- The list item must be constructed using JsonTableColumn class\n- JsonTableColumn provides 4 parameters, namely,\n```dart\nJsonTableColumn(\"age\", label: \"Eligible to Vote\", valueBuilder: eligibleToVote, defaultValue:\"NA\")\n```\n- First parameter is the field/key to pick from the data\n- label: The column header label to be displayed\n- defaultValue: To be used when data or key is null\n- valueBuilder: To get the formatted value like date etc\n\n\u003cimg src=\"https://raw.githubusercontent.com/apgapg/json_table/master/src/ss1.png\"  height = \"400\" alt=\"JsonTable\"\u003e \n      \n```dart\n//Decode your json string\nfinal String jsonSample='[{\"name\":\"Ram\",\"email\":\"ram@gmail.com\",\"age\":23,\"DOB\":\"1990-12-01\"},'\n                              '{\"name\":\"Shyam\",\"email\":\"shyam23@gmail.com\",\"age\":18,\"DOB\":\"1995-07-01\"},'\n                              '{\"name\":\"John\",\"email\":\"john@gmail.com\",\"age\":10,\"DOB\":\"2000-02-24\"},'\n                              '{\"name\":\"Ram\",\"age\":12,\"DOB\":\"2000-02-01\"}]';\nvar json = jsonDecode(jsonSample);\n//Create your column list\nvar columns = [\n      JsonTableColumn(\"name\", label: \"Name\"),\n      JsonTableColumn(\"age\", label: \"Age\"),\n      JsonTableColumn(\"DOB\", label: \"Date of Birth\", valueBuilder: formatDOB),\n      JsonTableColumn(\"age\", label: \"Eligible to Vote\", valueBuilder: eligibleToVote),\n      JsonTableColumn(\"email\", label: \"E-mail\", defaultValue: \"NA\"),\n    ];\n//Simply pass this column list to JsonTable\nchild: JsonTable(json,columns: columns)\n\n//Example of valueBuilder\nString eligibleToVote(value) {\n    if (value \u003e= 18) {\n      return \"Yes\";\n    } else\n      return \"No\";\n}\n```\n\nHead over to example code: [custom_column_table.dart](https://github.com/apgapg/json_table/blob/master/example/lib/pages/custom_column_table.dart)\n\n### - Implementation with nested data list   \n\nSuppose your json object has nested data like email as shown below:\n```dart\n{\"name\":\"Ram\",\"email\":{\"1\":\"ram@gmail.com\"},\"age\":23,\"DOB\":\"1990-12-01\"}\n```\n- Just use email.1 instead of email as key\n```dart\nJsonTableColumn(\"email.1\", label: \"Email\", defaultValue:\"NA\")\n```\n\n\u003cimg src=\"https://raw.githubusercontent.com/apgapg/json_table/master/src/ss3.png\"  height = \"400\" alt=\"JsonTable\"\u003e \n      \n```dart\n//Decode your json string\nfinal String jsonSample='[{\"name\":\"Ram\",\"email\":{\"1\":\"ram@gmail.com\"},\"age\":23,\"DOB\":\"1990-12-01\"},'\n                               '{\"name\":\"Shyam\",\"email\":{\"1\":\"shyam23@gmail.com\"},\"age\":18,\"DOB\":\"1995-07-01\"},'\n                               '{\"name\":\"John\",\"email\":{\"1\":\"john@gmail.com\"},\"age\":10,\"DOB\":\"2000-02-24\"}]';\nvar json = jsonDecode(jsonSample);\n//Create your column list\nvar columns = [\n      JsonTableColumn(\"name\", label: \"Name\"),\n      JsonTableColumn(\"age\", label: \"Age\"),\n      JsonTableColumn(\"DOB\", label: \"Date of Birth\", valueBuilder: formatDOB),\n      JsonTableColumn(\"age\", label: \"Eligible to Vote\", valueBuilder: eligibleToVote),\n      JsonTableColumn(\"email.1\", label: \"E-mail\", defaultValue: \"NA\"),\n    ];\n//Simply pass this column list to JsonTable\nchild: JsonTable(json,columns: columns)\n```\n\nHead over to example code: [custom_column_nested_table.dart](https://github.com/apgapg/json_table/blob/master/example/lib/pages/custom_column_nested_table.dart)\n\n### Column toggle\n\nOption for toggling column(s) also. User can customise which columns are to be shown\n\n```dart\n showColumnToggle: true\n```\n\n\u003cimg src=\"https://raw.githubusercontent.com/apgapg/json_table/master/src/ss5.png\"  height = \"400\" alt=\"JsonTable\"\u003e \n\n### Row Highlighting\n\nAdd row highlighting with custom color support\n\n\u003cimg src=\"https://raw.githubusercontent.com/apgapg/json_table/master/src/ss4.png\"  height = \"400\" alt=\"JsonTable\"\u003e \n\n```dart\nallowRowHighlight: true,\nrowHighlightColor: Colors.yellow[500].withOpacity(0.7),\n```\n\n### Row Select Callback\n\nGet the index and data map of a particular selected row. \nNote index might return incorrect value in case of pagination\n\n```dart\nonRowSelect: (index, map) {\n    print(index);\n    print(map);\n  },\n```\n\n### Pagination\n\nJust provide an int value to `paginationRowCount` parameter\n\n\u003cimg src=\"https://raw.githubusercontent.com/apgapg/json_table/master/src/ss6.png\"  height = \"400\" alt=\"JsonTable\"\u003e \n\n```dart\npaginationRowCount: 4,\n```\n\n## TODO\n- [X] Custom header list parameter. This will help to show only those keys as mentioned in header list\n- [X] Add support for keys missing in json object\n- [X] Add support for auto formatting of date\n- [X] Extracting column headers logic must be change. Not to depend on first object\n- [X] Nested data showing support\n- [X] Row highlight support\n- [X] Row select callback\n- [X] Wrap filters in expansion tile\n- [X] Pagination support\n- [ ] Add option to change header row to vertical row on left\n\n# ⭐ My Flutter Packages\n- [pie_chart](https://pub.dartlang.org/packages/pie_chart)  [![GitHub stars](https://img.shields.io/github/stars/apgapg/pie_chart.svg?style=social)](https://github.com/apgapg/pie_chart)  Flutter Pie Chart with cool animation.\n- [avatar_glow](https://pub.dartlang.org/packages/avatar_glow)  [![GitHub stars](https://img.shields.io/github/stars/apgapg/avatar_glow.svg?style=social)](https://github.com/apgapg/avatar_glow)  Flutter Avatar Glow Widget with glowing animation.\n- [search_widget](https://pub.dartlang.org/packages/search_widget)  [![GitHub stars](https://img.shields.io/github/stars/apgapg/search_widget.svg?style=social)](https://github.com/apgapg/search_widget)  Flutter Search Widget for selecting an option from list.\n- [animating_location_pin](https://pub.dev/packages/animating_location_pin)  [![GitHub stars](https://img.shields.io/github/stars/apgapg/animating_location_pin.svg?style=social)](https://github.com/apgapg/animating_location_pin)  Flutter Animating Location Pin Widget providing Animating Location Pin Widget which can be used while fetching device location.\n                                                                                                                                                                                                                             \n# ⭐ My Flutter Apps\n- [flutter_profile](https://github.com/apgapg/flutter_profile)  [![GitHub stars](https://img.shields.io/github/stars/apgapg/flutter_profile.svg?style=social)](https://github.com/apgapg/flutter_profile)  Showcase My Portfolio: Ayush P Gupta on Playstore.\n- [flutter_sankalan](https://github.com/apgapg/flutter_sankalan)  [![GitHub stars](https://img.shields.io/github/stars/apgapg/flutter_sankalan.svg?style=social)](https://github.com/apgapg/flutter_sankalan)  Flutter App which allows reading/uploading short stories.\n\n# 👍 Contribution\n1. Fork it\n2. Create your feature branch (git checkout -b my-new-feature)\n3. Commit your changes (git commit -m 'Add some feature')\n4. Push to the branch (git push origin my-new-feature)\n5. Create new Pull Request\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fapgapg%2Fjson_table","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fapgapg%2Fjson_table","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fapgapg%2Fjson_table/lists"}