colored_json 1.1.2

SDKflutter
Platformandroidioswindowslinuxmacosweb

A package that converts JSON string into a customizable flutter widget.

Colored JSON

Convert JSON string into customizable widget.

Getting Started

ColoredJson is a stateless widget that produces a structured view of JSON string provided. It can be used like any other flutter widget. It's fully customizable where you can set different colors to different datatypes including colon, comma and brackets. Set indent length. Use text style of your choice. You can also change the background color.

Defaut ViewCustomised View 1Customised View 2
Default ViewCustomized View 1Customized View 2

Usage

  • Pass a JSON string to the data parameter of ColoredJson Widget

Simple Usage

const String responseBody = '''
{
  'id' : 1,
  'name' : 'Colored Json',
  'isFlutterAwesome' : true,
}
''';

ColoredJson(
 data: responseBody,
)

Full Usage

final dartMap = {
  "id": 24,
  "name": "Manthan Khandale",
  "score": 7.6,
  "socials": null,
  "hobbies": [
    "Music",
    "Filmmaking",
  ],
  "isFlutterCool": true,
};

ColoredJson(
 data: jsonEncode(dartMap),
 indentLength: 5,
 keyColor: Colors.green,
 backgroundColor: Colors.black,
 boolColor: Colors.white,
 nullColor: Colors.redAccent,
 stringColor: Colors.cyan,
 curlyBracketColor: Colors.yellow,
 doubleColor: Colors.deepOrange,
 squareBracketColor: Colors.amber,
 commaColor: Colors.yellow,
 colonColor: Colors.purple,
 intColor: Colors.lime,
 textStyle: const TextStyle(
  fontSize: 20,
  letterSpacing: 2,
  ),
 )
ParameterInfo
data (required)A JSON string to be formatted
keyColorColor of Json Key
intColorColor of integer type value
doubleColorColor of decimal type value
stringColorColor of string type value
boolColorColor of boolean type value
nullColorColor of null type value
curlyBracketColorColor of curly brackets {}
squareBracketColorColor of square brackets []
commaColorColor of comma ( , )
colonColorColor of colon ( : )
backgroundColorBackground color of widget
textStyleTextstyle of texts in the widget
indentLengthIndent length

Upcoming Tasks

  • Code shrink feature
  • Add Inner Spacing parameter
  • Add tests