From 12d42bc00055c2efa1a58cf51c45d761d5b2e611 Mon Sep 17 00:00:00 2001 From: wanghongenpin <178070584@qq.com> Date: Mon, 18 Sep 2023 19:14:49 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E6=A0=B7=E5=BC=8F=E4=BC=98?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/ui/component/utils.dart | 10 ++++--- lib/ui/desktop/left/domain.dart | 3 +- lib/ui/desktop/left/history.dart | 8 ++--- .../toolbar/setting/request_rewrite.dart | 30 +++++++++++-------- lib/ui/desktop/toolbar/setting/setting.dart | 4 +-- lib/ui/mobile/menu.dart | 3 +- windows/flutter/CMakeLists.txt | 7 ++++- 7 files changed, 39 insertions(+), 26 deletions(-) diff --git a/lib/ui/component/utils.dart b/lib/ui/component/utils.dart index 5a9dade..e745700 100644 --- a/lib/ui/component/utils.dart +++ b/lib/ui/component/utils.dart @@ -97,7 +97,8 @@ void unSelect(EditableTextState editableTextState) { ); } -Widget futureWidget(Future future, Widget Function(T data) toWidget) { +///Future +Widget futureWidget(Future future, Widget Function(T data) toWidget, {bool loading = false}) { return FutureBuilder( future: future, builder: (BuildContext context, AsyncSnapshot snapshot) { @@ -107,7 +108,8 @@ Widget futureWidget(Future future, Widget Function(T data) toWidget) { } return toWidget(snapshot.requireData); } - return const SizedBox(); + //加载效果 + return loading ? const Center(child: CircularProgressIndicator()) : const SizedBox(); }, ); } @@ -118,9 +120,9 @@ showContextMenu(BuildContext context, Offset offset, {required List with AutomaticKeepAliveClien Widget body = widget.shrinkWrap ? SingleChildScrollView(child: Column(children: list.toList())) - : ListView.builder(itemCount: list.length, cacheExtent: 1000, itemBuilder: (_, index) => list.elementAt(index)); + : ListView.builder(itemCount: list.length, itemBuilder: (_, index) => list.elementAt(index)); + return Scaffold( body: body, bottomNavigationBar: Search(onSearch: (val) { diff --git a/lib/ui/desktop/left/history.dart b/lib/ui/desktop/left/history.dart index 72cbd16..6e1723f 100644 --- a/lib/ui/desktop/left/history.dart +++ b/lib/ui/desktop/left/history.dart @@ -54,8 +54,9 @@ class HistoryPageWidget extends StatelessWidget { title: Text(arguments['title'], style: const TextStyle(fontSize: 14)), )), body: futureWidget(HistoryStorage.instance.then((value) => value.getRequests(arguments['name'])), (data) { + print("START ${DateTime.now()}"); return DomainWidget(panel: panel, proxyServer: proxyServer, list: data, shrinkWrap: false); - })); + }, loading: true)); } } @@ -132,7 +133,7 @@ class _HistoryState extends State<_HistoryWidget> implements EventListener { }); }, ), - onTap: () => ContextMenuController.removeAny()); + onTap: () {}); } //构建历史记录 @@ -159,10 +160,9 @@ class _HistoryState extends State<_HistoryWidget> implements EventListener { title: Text(name), subtitle: Text("记录数 ${item.requestLength} 文件 ${item.size}"), onTap: () { - ContextMenuController.removeAny(); Navigator.pushNamed(context, '/domain', arguments: {'title': '$name 记录数 ${item.requestLength}', 'name': name}) - .then((value) => Future.delayed(const Duration(seconds: 60), () => storage.removeCache(name))); + .whenComplete(() => Future.delayed(const Duration(seconds: 60), () => storage.removeCache(name))); })); } diff --git a/lib/ui/desktop/toolbar/setting/request_rewrite.dart b/lib/ui/desktop/toolbar/setting/request_rewrite.dart index c3a800e..8870cba 100644 --- a/lib/ui/desktop/toolbar/setting/request_rewrite.dart +++ b/lib/ui/desktop/toolbar/setting/request_rewrite.dart @@ -56,22 +56,22 @@ class _RequestRewriteState extends State { const SizedBox(height: 10), Row(children: [ FilledButton.icon( - icon: const Icon(Icons.add), + icon: const Icon(Icons.add, size: 18), onPressed: () { add(); }, - label: const Text("增加")), + label: const Text("增加", style: TextStyle(fontSize: 12))), const SizedBox(width: 10), OutlinedButton.icon( onPressed: () { var selectedIndex = requestRuleList.currentSelectedIndex(); add(selectedIndex); }, - icon: const Icon(Icons.edit), - label: const Text("编辑")), + icon: const Icon(Icons.edit, size: 18), + label: const Text("编辑", style: TextStyle(fontSize: 12))), TextButton.icon( - icon: const Icon(Icons.remove), - label: const Text("删除"), + icon: const Icon(Icons.remove, size: 18), + label: const Text("删除", style: TextStyle(fontSize: 12)), onPressed: () { var removeSelected = requestRuleList.removeSelected(); if (removeSelected.isEmpty) { @@ -86,7 +86,7 @@ class _RequestRewriteState extends State { }) ]), const SizedBox(height: 10), - const Text("选择框只是用来操作编辑和删除,规则启用状态在编辑页切换", style: TextStyle(fontSize: 12)), + const Text("选择框只是用来操作编辑和删除,规则启用状态在编辑页切换", style: TextStyle(fontSize: 11)), requestRuleList, ], ); @@ -144,7 +144,7 @@ class _RuleAddDialogState extends State { GlobalKey formKey = GlobalKey(); return AlertDialog( - title: const Text("添加请求重写规则", style: TextStyle(fontSize: 15, fontWeight: FontWeight.w600)), + title: const Text("添加请求重写规则", style: TextStyle(fontSize: 14, fontWeight: FontWeight.w500)), scrollable: true, content: Container( constraints: const BoxConstraints(minWidth: 350, minHeight: 460), @@ -235,6 +235,7 @@ class _RuleAddDialogState extends State { return InputDecoration( labelText: label, hintText: hintText, + labelStyle: const TextStyle(fontSize: 14), isDense: true, border: UnderlineInputBorder(borderSide: BorderSide(width: 0.3, color: color)), enabledBorder: UnderlineInputBorder(borderSide: BorderSide(width: 0.3, color: color)), @@ -323,7 +324,6 @@ class _RequestRuleListState extends State { child: SingleChildScrollView( child: DataTable( columnSpacing: 36, - dataRowMaxHeight: 100, border: TableBorder.symmetric(outside: BorderSide(width: 1, color: Theme.of(context).highlightColor)), columns: const [ DataColumn(label: Text('名称')), @@ -335,14 +335,18 @@ class _RequestRuleListState extends State { widget.requestRewrites.rules.length, (index) => DataRow( cells: [ - DataCell(Text(widget.requestRewrites.rules[index].name ?? "")), - DataCell(Text(widget.requestRewrites.rules[index].enabled ? "是" : "否")), + DataCell( + Text(widget.requestRewrites.rules[index].name ?? "", style: const TextStyle(fontSize: 14))), + DataCell(Text(widget.requestRewrites.rules[index].enabled ? "是" : "否", + style: const TextStyle(fontSize: 14))), DataCell(ConstrainedBox( constraints: const BoxConstraints(minWidth: 60, maxWidth: 280), child: Text( - '${widget.requestRewrites.rules[index].domain ?? ''}${widget.requestRewrites.rules[index].path}'), + '${widget.requestRewrites.rules[index].domain ?? ''}${widget.requestRewrites.rules[index].path}', + style: const TextStyle(fontSize: 14)), )), - DataCell(Text(widget.requestRewrites.rules[index].type.name)), + DataCell( + Text(widget.requestRewrites.rules[index].type.name, style: const TextStyle(fontSize: 14))), ], selected: currentSelectedIndex == index, onSelectChanged: (value) { diff --git a/lib/ui/desktop/toolbar/setting/setting.dart b/lib/ui/desktop/toolbar/setting/setting.dart index ef2475c..c844507 100644 --- a/lib/ui/desktop/toolbar/setting/setting.dart +++ b/lib/ui/desktop/toolbar/setting/setting.dart @@ -114,13 +114,13 @@ class _SettingState extends State { return AlertDialog( scrollable: true, title: Row(children: [ - const Text("请求重写"), + const Text("请求重写", style: TextStyle(fontSize: 14, fontWeight: FontWeight.w500)), Expanded( child: Align( alignment: Alignment.topRight, child: ElevatedButton.icon( icon: const Icon(Icons.close, size: 15), - label: const Text("关闭"), + label: const Text("关闭", style: TextStyle(fontSize: 14)), onPressed: () => Navigator.of(context).pop()))) ]), content: RequestRewrite(configuration: configuration), diff --git a/lib/ui/mobile/menu.dart b/lib/ui/mobile/menu.dart index a2ee389..98a5626 100644 --- a/lib/ui/mobile/menu.dart +++ b/lib/ui/mobile/menu.dart @@ -52,7 +52,7 @@ class DrawerWidget extends StatelessWidget { appBar: AppBar(title: const Text("工具箱", style: TextStyle(fontSize: 16)), centerTitle: true), body: const Toolbox()))), const Divider(thickness: 0.3), - PortWidget(proxyServer: proxyServer), + Padding(padding: const EdgeInsets.only(left: 15), child: PortWidget(proxyServer: proxyServer)), ListTile( title: const Text("HTTPS抓包"), trailing: const Icon(Icons.arrow_right), @@ -65,6 +65,7 @@ class DrawerWidget extends StatelessWidget { trailing: const Icon(Icons.arrow_right), onTap: () => navigator(context, AppWhitelist(proxyServer: proxyServer))), ListTile( + dense: true, title: const Text("域名白名单"), trailing: const Icon(Icons.arrow_right), onTap: () => navigator( diff --git a/windows/flutter/CMakeLists.txt b/windows/flutter/CMakeLists.txt index 930d207..903f489 100644 --- a/windows/flutter/CMakeLists.txt +++ b/windows/flutter/CMakeLists.txt @@ -10,6 +10,11 @@ include(${EPHEMERAL_DIR}/generated_config.cmake) # https://github.com/flutter/flutter/issues/57146. set(WRAPPER_ROOT "${EPHEMERAL_DIR}/cpp_client_wrapper") +# Set fallback configurations for older versions of the flutter tool. +if (NOT DEFINED FLUTTER_TARGET_PLATFORM) + set(FLUTTER_TARGET_PLATFORM "windows-x64") +endif() + # === Flutter Library === set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/flutter_windows.dll") @@ -92,7 +97,7 @@ add_custom_command( COMMAND ${CMAKE_COMMAND} -E env ${FLUTTER_TOOL_ENVIRONMENT} "${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.bat" - windows-x64 $ + ${FLUTTER_TARGET_PLATFORM} $ VERBATIM ) add_custom_target(flutter_assemble DEPENDS