desktop request list sort #(370)

This commit is contained in:
wanghongenpin
2025-01-18 21:34:41 +08:00
parent 263115c092
commit 22c801ca36
9 changed files with 72 additions and 35 deletions

View File

@@ -156,23 +156,25 @@ class _DesktopHomePagePageState extends State<DesktopHomePage> implements EventL
? '提示默认不会开启HTTPS抓包请安装证书后再开启HTTPS抓包。\n'
'点击HTTPS抓包(加锁图标),选择安装根证书,按照提示操作即可。\n\n'
'1. 新增socks5代理支持, 可在设置中关闭;\n'
'2. 响应新增图片保存\n'
'3. 请求重写新增json格式化\n'
'4. 修复安卓首次在画中画开启VPN闪退\n'
'5. 修复Illegal IPv6 address问题\n'
'6. 修复Windows历史导入安卓har历史文件崩溃问题;\n'
'7. 修复复制python请求头不全问题;\n'
'8. 修复二维码保存的背景颜色问题;\n'
'2. 请求列表增加按时间排序\n'
'3. 响应新增图片保存\n'
'4. 请求重写新增json格式化\n'
'5. 修复安卓首次在画中画开启VPN闪退\n'
'6. 修复Illegal IPv6 address问题;\n'
'7. 修复Windows历史导入安卓har历史文件崩溃问题;\n'
'8. 修复复制python请求头不全问题;\n'
'9. 修复二维码保存的背景颜色问题;\n'
: 'TipsBy default, HTTPS packet capture will not be enabled. Please install the certificate before enabling HTTPS packet capture。\n'
'Click HTTPS Capture packets(Lock icon)Choose to install the root certificate and follow the prompts to proceed。\n\n'
'1. Added support for socks5 proxy, which can be turned off in settings\n'
'2. Response to saving newly added images\n'
'3. Request rewriting to add json format\n'
'4. Fixed the issue when opening VPN in Picture-in-Picture mode on Android for the first time\n'
'5. Fix Illegal IPv6 address issue\n'
'6. Fix Windows history import Android har history file crash issue\n'
'7. Fix the problem of incomplete copy of python request header\n'
'8. Fixed the background color issue when saving QR code\n'
'2. Add request list sorted by time\n'
'3. Response to saving newly added images\n'
'4. Request rewriting to add json format\n'
'5. Fixed the issue when opening VPN in Picture-in-Picture mode on Android for the first time\n'
'6. Fix Illegal IPv6 address issue\n'
'7. Fix Windows history import Android har history file crash issue\n'
'8. Fix the problem of incomplete copy of python request header\n'
'9. Fixed the background color issue when saving QR code\n'
'',
style: const TextStyle(fontSize: 14))));
});

View File

@@ -141,7 +141,7 @@ class DesktopRequestListState extends State<DesktopRequestListWidget> with Autom
},
child: IconText(
icon: const Icon(Icons.sort, size: 16),
text: sortDesc ? localizations.timeDesc : localizations.timeAsc,
text: sortDesc ? localizations.timeAsc : localizations.timeDesc,
textStyle: const TextStyle(fontSize: 13))),
];
});

View File

@@ -105,7 +105,7 @@ class RequestSequenceState extends State<RequestSequence> with AutomaticKeepAliv
return RequestWidget(
key: ValueKey(view.elementAt(index).requestId),
view.elementAt(index),
index: view.length - index,
index: sortDesc ? view.length - index : index,
trailing: appIcon(view.elementAt(index)),
proxyServer: widget.proxyServer,
displayDomain: widget.displayDomain,
@@ -202,7 +202,7 @@ class RequestSequenceState extends State<RequestSequence> with AutomaticKeepAliv
sort(bool desc) {
sortDesc = desc;
setState(() {
view = Queue.of(view.toList().reversed);
view = Queue.of(view.toList().reversed);
});
}
}

View File

@@ -27,6 +27,8 @@ import 'package:proxypin/ui/mobile/widgets/remote_device.dart';
/// +号菜单
class MoreMenu extends StatelessWidget {
static bool sortDesc = true;
final ProxyServer proxyServer;
final ValueNotifier<RemoteModel> remoteDevice;
@@ -107,6 +109,19 @@ class MoreMenu extends StatelessWidget {
MobileApp.requestStateKey.currentState?.export(context, 'ProxyPin$name');
},
)),
PopupMenuItem(
height: 32,
child: ListTile(
dense: true,
leading: const Icon(Icons.sort, size: 16),
title: Text(sortDesc ? localizations.timeAsc : localizations.timeDesc),
onTap: () async {
await Navigator.maybePop(context);
sortDesc = !sortDesc;
MobileApp.requestStateKey.currentState?.sort(sortDesc);
},
)),
];
},
);

View File

@@ -261,23 +261,25 @@ class MobileHomeState extends State<MobileHomePage> implements EventListener, Li
String content = isCN
? '提示默认不会开启HTTPS抓包请安装证书后再开启HTTPS抓包。\n\n'
'1. 新增socks5代理支持, 可在设置中关闭;\n'
'2. 响应新增图片保存\n'
'3. 请求重写新增json格式化\n'
'4. 修复安卓首次在画中画开启VPN闪退\n'
'5. 修复Illegal IPv6 address问题\n'
'6. 修复Windows历史导入安卓har历史文件崩溃问题;\n'
'7. 修复复制python请求头不全问题;\n'
'8. 修复二维码保存的背景颜色问题;\n'
'2. 请求列表增加按时间排序\n'
'3. 响应新增图片保存\n'
'4. 请求重写新增json格式化\n'
'5. 修复安卓首次在画中画开启VPN闪退\n'
'6. 修复Illegal IPv6 address问题;\n'
'7. 修复Windows历史导入安卓har历史文件崩溃问题;\n'
'8. 修复复制python请求头不全问题;\n'
'9. 修复二维码保存的背景颜色问题;\n'
: 'TipsBy default, HTTPS packet capture will not be enabled. Please install the certificate before enabling HTTPS packet capture。\n\n'
'Click HTTPS Capture packets(Lock icon)Choose to install the root certificate and follow the prompts to proceed。\n\n'
'1. Added support for socks5 proxy, which can be turned off in settings\n'
'2. Response to saving newly added images\n'
'3. Request rewriting to add json format\n'
'4. Fixed the issue when opening VPN in Picture-in-Picture mode on Android for the first time\n'
'5. Fix Illegal IPv6 address issue\n'
'6. Fix Windows history import Android har history file crash issue\n'
'7. Fix the problem of incomplete copy of python request header\n'
'8. Fixed the background color issue when saving QR code\n'
'2. Add request list sorted by time\n'
'3. Response to saving newly added images\n'
'4. Request rewriting to add json format\n'
'5. Fixed the issue when opening VPN in Picture-in-Picture mode on Android for the first time\n'
'6. Fix Illegal IPv6 address issue\n'
'7. Fix Windows history import Android har history file crash issue\n'
'8. Fix the problem of incomplete copy of python request header\n'
'9. Fixed the background color issue when saving QR code\n'
'';
showAlertDialog(isCN ? '更新内容V1.1.7' : "Update content V1.1.7", content, () {
widget.appConfiguration.upgradeNoticeV17 = false;

View File

@@ -68,6 +68,8 @@ class DomainListState extends State<DomainList> with AutomaticKeepAliveClientMix
bool changing = false;
bool sortDesc = true;
AppLocalizations get localizations => AppLocalizations.of(context)!;
@override
@@ -163,6 +165,11 @@ class DomainListState extends State<DomainList> with AutomaticKeepAliveClientMix
changeState();
}
///排序
sort(bool desc) {
sortDesc = desc;
}
bool filter(HostAndPort hostAndPort) {
if (searchText?.isNotEmpty == true) {
return hostAndPort.domain.toLowerCase().contains(searchText!);
@@ -222,12 +229,15 @@ class DomainListState extends State<DomainList> with AutomaticKeepAliveClientMix
onTap: () {
Navigator.push(context, MaterialPageRoute(builder: (context) {
showHostAndPort = view.elementAt(index);
var list = containerMap[view.elementAt(index)];
return Scaffold(
appBar: AppBar(title: Text(view.elementAt(index).domain, style: const TextStyle(fontSize: 16))),
body: RequestSequence(
key: requestSequenceKey,
displayDomain: false,
container: ListenableList(containerMap[view.elementAt(index)]),
container: ListenableList(sortDesc ? list : list?.reversed.toList()),
sortDesc: sortDesc,
onRemove: widget.onRemove,
proxyServer: widget.proxyServer));
}));

View File

@@ -164,6 +164,12 @@ class RequestListState extends State<RequestListWidget> {
fileNameOverrides: [fileName],
sharePositionOrigin: box == null ? null : box.localToGlobal(Offset.zero) & box.size);
}
sort(bool sortDesc) {
requestSequenceKey.currentState?.sort(sortDesc);
domainListKey.currentState?.sort(sortDesc);
}
}
class DoubleClickHandle {

View File

@@ -14,10 +14,11 @@ class RequestSequence extends StatefulWidget {
final ListenableList<HttpRequest> container;
final ProxyServer proxyServer;
final bool displayDomain;
final bool? sortDesc;
final Function(List<HttpRequest>)? onRemove;
const RequestSequence(
{super.key, required this.container, required this.proxyServer, this.displayDomain = true, this.onRemove});
{super.key, required this.container, required this.proxyServer, this.displayDomain = true, this.onRemove, this.sortDesc});
@override
State<StatefulWidget> createState() {
@@ -44,6 +45,7 @@ class RequestSequenceState extends State<RequestSequence> with AutomaticKeepAliv
@override
initState() {
super.initState();
sortDesc = widget.sortDesc ?? true;
view.addAll(widget.container.source.reversed);
highlightListener = () {
//回调时机在高亮设置页面dispose之后。所以需要在下一帧刷新否则会报错
@@ -153,7 +155,7 @@ class RequestSequenceState extends State<RequestSequence> with AutomaticKeepAliv
itemCount: view.length,
itemBuilder: (context, index) {
return RequestRow(
index: view.length - index,
index: sortDesc ? view.length - index : index,
key: indexes[view.elementAt(index).requestId] ??= GlobalKey(),
request: view.elementAt(index),
proxyServer: widget.proxyServer,

View File

@@ -34,7 +34,7 @@ dependencies:
url: https://github.com/wanghongenpin/flutter-code-editor.git
ref: secure-keyboard
flutter_desktop_context_menu: ^0.2.0
device_info_plus: ^11.2.0
device_info_plus: ^11.2.1
shared_preferences: ^2.3.5
image_pickers: ^2.0.5+2
url_launcher: ^6.3.1