flutter_json_view

在 Flutter 小部件中显示 JSON 模型

调试时查看模型的一个很棒的解决方案

example_mov example1 example3

入门

添加依赖

dependencies:
  flutter_json_view: ^0.2.1

导入包

import 'package:flutter_json_view/flutter_json_view.dart';

易于使用

在你的代码中添加以下构造函数之一

字符串构造函数

JsonView.string('{"key":"value"}'),

资源文件构造函数

JsonView.asset('assets/data.json'),

Map 构造函数

JsonView.map({"key":"value"}),

自定义

?该包的创建是为了能够自定义你的 json 视图

drawing
JsonView.string(
    '{"key":"value"}',
    theme: JsonViewTheme(
      keyStyle: TextStyle(
        color: Colors.black54,
        fontSize: 16,
        fontWeight: FontWeight.w600,
      ),
      doubleStyle: TextStyle(
        color: Colors.green,
        fontSize: 16,
      ),
      intStyle: TextStyle(
        color: Colors.green,
        fontSize: 16,
      ),
      stringStyle: TextStyle(
        color: Colors.green,
        fontSize: 16,
      ),
      boolStyle: TextStyle(
        color: Colors.green,
        fontSize: 16,
      ),
      closeIcon: Icon(
        Icons.close,
        color: Colors.green,
        size: 20,
      ),
      openIcon: Icon(
        Icons.add,
        color: Colors.green,
        size: 20,
      ),
      separator: Padding(
        padding: EdgeInsets.symmetric(horizontal: 8.0),
        child: Icon(
          Icons.arrow_right_alt_outlined,
          size: 20,
          color: Colors.green,
        ),
      ),
    ),
  ),

更多示例请查看 这里

如需获取 Flutter 入门帮助,请参阅我们的
在线文档,其中提供教程,
示例、移动开发指南和完整的 API 参考。

GitHub

https://github.com/Frezyx/flutter_json_view