update json format

master
小赖 4 years ago
parent b82684dc15
commit f48027324b

@ -76,6 +76,13 @@ packages:
description: flutter description: flutter
source: sdk source: sdk
version: "0.0.0" version: "0.0.0"
flutter_highlight:
dependency: transitive
description:
name: flutter_highlight
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.6.0"
flutter_test: flutter_test:
dependency: "direct dev" dependency: "direct dev"
description: flutter description: flutter
@ -88,6 +95,13 @@ packages:
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "3.24.0" version: "3.24.0"
highlight:
dependency: transitive
description:
name: highlight
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.6.0"
http_parser: http_parser:
dependency: transitive dependency: transitive
description: description:
@ -123,6 +137,13 @@ packages:
relative: true relative: true
source: path source: path
version: "0.0.1" version: "0.0.1"
pretty_json:
dependency: transitive
description:
name: pretty_json
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.1.0"
sky_engine: sky_engine:
dependency: transitive dependency: transitive
description: flutter description: flutter

@ -1,8 +1,10 @@
import 'package:dio/dio.dart'; import 'package:dio/dio.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_highlight/flutter_highlight.dart';
import 'package:power_logger/src/view/box_view.dart'; import 'package:power_logger/src/view/box_view.dart';
import 'package:power_logger/src/view/table_view.dart'; import 'package:power_logger/src/view/table_view.dart';
import 'package:power_logger/src/view/title_view.dart'; import 'package:power_logger/src/view/title_view.dart';
import 'package:pretty_json/pretty_json.dart';
class DioResponseView extends StatefulWidget { class DioResponseView extends StatefulWidget {
final Response data; final Response data;
@ -51,6 +53,16 @@ class _DioResponseViewState extends State<DioResponseView> {
); );
} }
_buildData() {
return BoxView(
title: Text('Params'),
child: HighlightView(
prettyJson(widget.data.data.toString()),
language: 'json',
),
);
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
@ -75,6 +87,7 @@ class _DioResponseViewState extends State<DioResponseView> {
TitleView(title: Text('Response')), TitleView(title: Text('Response')),
_buildMap(widget.data.headers.map), _buildMap(widget.data.headers.map),
_buildStatus(), _buildStatus(),
_buildData(),
], ],
), ),
); );

@ -6,7 +6,7 @@ class TableView extends StatelessWidget {
Widget _buildTableTitle(String title) { Widget _buildTableTitle(String title) {
return Padding( return Padding(
padding: EdgeInsets.all(5), padding: EdgeInsets.all(5),
child: Text(title), child: SelectableText(title),
); );
} }

@ -69,11 +69,25 @@ packages:
description: flutter description: flutter
source: sdk source: sdk
version: "0.0.0" version: "0.0.0"
flutter_highlight:
dependency: "direct main"
description:
name: flutter_highlight
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.6.0"
flutter_test: flutter_test:
dependency: "direct dev" dependency: "direct dev"
description: flutter description: flutter
source: sdk source: sdk
version: "0.0.0" version: "0.0.0"
highlight:
dependency: transitive
description:
name: highlight
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.6.0"
http_parser: http_parser:
dependency: transitive dependency: transitive
description: description:
@ -102,6 +116,13 @@ packages:
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.8.0-nullsafety.1" version: "1.8.0-nullsafety.1"
pretty_json:
dependency: "direct main"
description:
name: pretty_json
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.1.0"
sky_engine: sky_engine:
dependency: transitive dependency: transitive
description: flutter description: flutter

@ -12,6 +12,8 @@ dependencies:
sdk: flutter sdk: flutter
dio: ^3.0.10 dio: ^3.0.10
animations: ^1.1.2 animations: ^1.1.2
pretty_json: ^1.1.0
flutter_highlight: ^0.6.0
dev_dependencies: dev_dependencies:
flutter_test: flutter_test:

Loading…
Cancel
Save