forked from wanghongenpin/proxypin
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
修复详情请求重写填充域名错误问题,请求编辑重发响应体查看增加多种格式,详情Body体增加快速解码入口
- Loading branch information
1 parent
b748aa6
commit 26857ec
Showing
21 changed files
with
253 additions
and
149 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import 'dart:convert'; | ||
import 'dart:io'; | ||
|
||
import 'package:desktop_multi_window/desktop_multi_window.dart'; | ||
import 'package:flutter/material.dart'; | ||
import 'package:network_proxy/ui/component/encoder.dart'; | ||
import 'package:network_proxy/utils/platform.dart'; | ||
import 'package:window_manager/window_manager.dart'; | ||
|
||
encodeWindow(EncoderType type, BuildContext context, [String? text]) async { | ||
if (Platforms.isMobile()) { | ||
Navigator.of(context).push(MaterialPageRoute(builder: (context) => EncoderWidget(type: type, text: text))); | ||
return; | ||
} | ||
|
||
var ratio = 1.0; | ||
if (Platform.isWindows) { | ||
ratio = WindowManager.instance.getDevicePixelRatio(); | ||
} | ||
|
||
final window = await DesktopMultiWindow.createWindow(jsonEncode( | ||
{'name': 'EncoderWidget', 'type': type.name, 'text': text}, | ||
)); | ||
window.setTitle('编码'); | ||
window | ||
..setFrame(const Offset(80, 80) & Size(900 * ratio, 600 * ratio)) | ||
..center() | ||
..show(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,30 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:flutter/material.dart'; | ||
|
||
class StateComponent extends StatefulWidget { | ||
class KeepAliveWrapper extends StatefulWidget { | ||
const KeepAliveWrapper({Key? key, this.keepAlive = true, required this.child}) : super(key: key); | ||
final bool keepAlive; | ||
final Widget child; | ||
final Function? onChange; | ||
|
||
const StateComponent(this.child, {Key? key, this.onChange }) : super(key: key); | ||
|
||
@override | ||
State<StatefulWidget> createState() { | ||
return _StateComponentState(); | ||
} | ||
State<KeepAliveWrapper> createState() => _KeepAliveWrapperState(); | ||
} | ||
|
||
class _StateComponentState extends State<StateComponent> { | ||
void changeState() { | ||
setState(() {}); | ||
if (widget.onChange != null) { | ||
widget.onChange!(); | ||
} | ||
} | ||
class _KeepAliveWrapperState extends State<KeepAliveWrapper> with AutomaticKeepAliveClientMixin { | ||
@override | ||
Widget build(BuildContext context) { | ||
super.build(context); | ||
return widget.child; | ||
} | ||
|
||
@override | ||
void didUpdateWidget(covariant KeepAliveWrapper oldWidget) { | ||
if (oldWidget.keepAlive != widget.keepAlive) { | ||
// keepAlive 状态需要更新,实现在 AutomaticKeepAliveClientMixin 中 | ||
updateKeepAlive(); | ||
} | ||
super.didUpdateWidget(oldWidget); | ||
} | ||
|
||
@override | ||
bool get wantKeepAlive => widget.keepAlive; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.