fix logger parse

master
小赖 4 years ago
parent e459d76a97
commit 74c57d7741

@ -6,13 +6,8 @@ import 'package:power_logger/src/parser/unfocus_parser.dart';
class LoggerDataParser { class LoggerDataParser {
static Widget builder(dynamic data) { static Widget builder(dynamic data) {
switch (data.runtimeType) { if (data is DioError) return DioErrorBuilder(data: data);
case DioError: if (data is Response) return DioResponseBuilder(data: data);
return DioErrorBuilder(data: data); return UnfocusParser(data: data);
case Response:
return DioResponseBuilder(data: data);
default:
return UnfocusParser(data: data);
}
} }
} }

@ -1,13 +1,8 @@
import 'dart:convert';
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:flutter_highlight/themes/github.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;
@ -63,6 +58,15 @@ class _DioResponseViewState extends State<DioResponseView> {
); );
} }
_buildSingleText(String title, String data) {
return data == null || data.length == 0
? SizedBox()
: BoxView(
title: Text('Params'),
child: SelectableText(data.toString()),
);
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(

Loading…
Cancel
Save