mirror of
https://github.com/wanghongenpin/proxypin.git
synced 2026-01-25 18:32:32 +08:00
json text
This commit is contained in:
3
devtools_options.yaml
Normal file
3
devtools_options.yaml
Normal file
@@ -0,0 +1,3 @@
|
||||
description: This file stores settings for Dart & Flutter DevTools.
|
||||
documentation: https://docs.flutter.dev/tools/devtools/extensions#configure-extension-enablement-states
|
||||
extensions:
|
||||
@@ -16,7 +16,6 @@
|
||||
import 'dart:io';
|
||||
import 'dart:math';
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:proxypin/ui/component/json/theme.dart';
|
||||
|
||||
@@ -31,34 +30,23 @@ class JsonText extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
var jsnParser = JsnParser(json, colorTheme, indent);
|
||||
var future =
|
||||
compute((message) => message.getJsonTree(), jsnParser).catchError((error) => <Text>[Text(error.toString())]);
|
||||
var textList = jsnParser.getJsonTree();
|
||||
|
||||
return FutureBuilder(
|
||||
future: future,
|
||||
builder: (context, snapshot) {
|
||||
if (snapshot.connectionState == ConnectionState.done && snapshot.hasData) {
|
||||
var textList = snapshot.data as List<Text>;
|
||||
|
||||
Widget widget;
|
||||
if (textList.length < 2000) {
|
||||
widget = Column(crossAxisAlignment: CrossAxisAlignment.start, children: textList);
|
||||
} else {
|
||||
widget = SizedBox(
|
||||
width: double.infinity,
|
||||
height: MediaQuery.of(context).size.height - 160,
|
||||
child: ListView.builder(
|
||||
physics: const BouncingScrollPhysics(),
|
||||
controller: trackingScroll(),
|
||||
cacheExtent: 1000,
|
||||
itemBuilder: (context, index) => textList[index],
|
||||
itemCount: textList.length));
|
||||
}
|
||||
return SelectionArea(child: widget);
|
||||
}
|
||||
|
||||
return Container();
|
||||
});
|
||||
Widget widget;
|
||||
if (textList.length < 1500) {
|
||||
widget = Column(crossAxisAlignment: CrossAxisAlignment.start, children: textList);
|
||||
} else {
|
||||
widget = SizedBox(
|
||||
width: double.infinity,
|
||||
height: MediaQuery.of(context).size.height - 160,
|
||||
child: ListView.builder(
|
||||
physics: const BouncingScrollPhysics(),
|
||||
controller: trackingScroll(),
|
||||
cacheExtent: 1000,
|
||||
itemBuilder: (context, index) => textList[index],
|
||||
itemCount: textList.length));
|
||||
}
|
||||
return SelectionArea(child: widget);
|
||||
}
|
||||
|
||||
///滚动条
|
||||
|
||||
@@ -161,8 +161,8 @@ class RequestSequenceState extends State<RequestSequence> with AutomaticKeepAliv
|
||||
itemBuilder: (context, index) {
|
||||
final requestId = view.elementAt(index).requestId;
|
||||
|
||||
// 确保每个 requestId 对应唯一的 GlobalKey
|
||||
final key = indexes.putIfAbsent(requestId, () => GlobalKey<RequestRowState>());
|
||||
final key = GlobalKey<RequestRowState>();
|
||||
indexes[requestId] = key;
|
||||
|
||||
return RequestRow(
|
||||
index: sortDesc ? view.length - index : index,
|
||||
@@ -173,6 +173,7 @@ class RequestSequenceState extends State<RequestSequence> with AutomaticKeepAliv
|
||||
onRemove: (request) {
|
||||
setState(() {
|
||||
view.remove(request);
|
||||
indexes.remove(requestId);
|
||||
});
|
||||
widget.onRemove?.call([request]);
|
||||
});
|
||||
|
||||
@@ -2,7 +2,7 @@ name: proxypin
|
||||
description: ProxyPin
|
||||
publish_to: 'none' # Remove this line if you wish to publish to pub.dev
|
||||
|
||||
version: 1.1.8+18
|
||||
version: 1.1.9+19
|
||||
|
||||
environment:
|
||||
sdk: '>=3.0.2 <4.0.0'
|
||||
|
||||
Reference in New Issue
Block a user