remove pretty_json dep ,update snack api

master
小赖 4 years ago
parent e07ea9aaa8
commit db34dbeb40

@ -165,13 +165,6 @@ packages:
relative: true relative: true
source: path source: path
version: "0.1.3" version: "0.1.3"
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

@ -0,0 +1,7 @@
import 'dart:convert';
String prettyJson(dynamic json, {int indent = 2}) {
var spaces = ' ' * indent;
var encoder = JsonEncoder.withIndent(spaces);
return encoder.convert(json);
}

@ -5,11 +5,11 @@ 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/flutter_highlight.dart';
import 'package:flutter_highlight/themes/atom-one-light.dart'; import 'package:flutter_highlight/themes/atom-one-light.dart';
import 'package:power_logger/external_lib/pretty_json.dart';
import 'package:power_logger/src/parser/dio_parser/dio_parser.dart'; import 'package:power_logger/src/parser/dio_parser/dio_parser.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';
// enum // enum

@ -35,15 +35,14 @@ class _InfoViewState extends State<InfoView>
elevation: 2, elevation: 2,
onPressed: () {}, onPressed: () {},
onLongPress: () { onLongPress: () {
Scaffold.of(context).hideCurrentSnackBar(); ScaffoldMessenger.of(context).hideCurrentSnackBar();
Clipboard.setData(ClipboardData(text: subTitle)); Clipboard.setData(ClipboardData(text: subTitle));
Scaffold.of(context).showSnackBar(SnackBar( ScaffoldMessenger.of(context).showSnackBar(SnackBar(
content: Text('已复制'), content: Text('已复制'),
action: SnackBarAction( action: SnackBarAction(
label: '确定', label: '确定',
onPressed: () { onPressed: () =>
Scaffold.of(context).hideCurrentSnackBar(); ScaffoldMessenger.of(context).hideCurrentSnackBar(),
},
), ),
)); ));
}, },
@ -76,15 +75,14 @@ class _InfoViewState extends State<InfoView>
title: Text(title), title: Text(title),
subtitle: Text(subTitle ?? ''), subtitle: Text(subTitle ?? ''),
onLongPress: () { onLongPress: () {
Scaffold.of(context).hideCurrentSnackBar(); ScaffoldMessenger.of(context).hideCurrentSnackBar();
Clipboard.setData(ClipboardData(text: subTitle)); Clipboard.setData(ClipboardData(text: subTitle));
Scaffold.of(context).showSnackBar(SnackBar( ScaffoldMessenger.of(context).showSnackBar(SnackBar(
content: Text('已复制'), content: Text('已复制'),
action: SnackBarAction( action: SnackBarAction(
label: '确定', label: '确定',
onPressed: () { onPressed: () =>
Scaffold.of(context).hideCurrentSnackBar(); ScaffoldMessenger.of(context).hideCurrentSnackBar(),
},
), ),
)); ));
}, },

@ -144,13 +144,6 @@ packages:
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "2.0.0" version: "2.0.0"
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

@ -11,7 +11,6 @@ dependencies:
flutter: flutter:
sdk: flutter sdk: flutter
dio: ^4.0.0-prev3 dio: ^4.0.0-prev3
pretty_json: ^1.1.0
flutter_highlight: ^0.7.0 flutter_highlight: ^0.7.0
device_info: ^2.0.0 device_info: ^2.0.0
package_info: ^2.0.0 package_info: ^2.0.0

Loading…
Cancel
Save