diff --git a/lib/ui/component/proxy_port_setting.dart b/lib/ui/component/proxy_port_setting.dart index ebf2012..cacb3e0 100644 --- a/lib/ui/component/proxy_port_setting.dart +++ b/lib/ui/component/proxy_port_setting.dart @@ -30,7 +30,14 @@ class _PortState extends State { portFocus.addListener(() async { //失去焦点 if (!portFocus.hasFocus && textController.text != widget.proxyServer.port.toString()) { - widget.proxyServer.configuration.port = int.parse(textController.text); + final port = int.tryParse(textController.text) ?? -1; + if (port < 0 || port > 65535) { + textController.text = widget.proxyServer.port.toString(); + FlutterToastr.show("Port out of range 0-65535", context, duration: 3); + return; + } + + widget.proxyServer.configuration.port = port; if (widget.proxyServer.isRunning) { String message = localizations.proxyPortRepeat(widget.proxyServer.port); diff --git a/macos/Flutter/GeneratedPluginRegistrant.swift b/macos/Flutter/GeneratedPluginRegistrant.swift index dbdc78c..76534dc 100644 --- a/macos/Flutter/GeneratedPluginRegistrant.swift +++ b/macos/Flutter/GeneratedPluginRegistrant.swift @@ -10,6 +10,7 @@ import device_info_plus import file_picker import flutter_desktop_context_menu import flutter_js +import path_provider_foundation import proxy_manager import screen_retriever_macos import share_plus @@ -24,6 +25,7 @@ func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { FilePickerPlugin.register(with: registry.registrar(forPlugin: "FilePickerPlugin")) FlutterDesktopContextMenuPlugin.register(with: registry.registrar(forPlugin: "FlutterDesktopContextMenuPlugin")) FlutterJsPlugin.register(with: registry.registrar(forPlugin: "FlutterJsPlugin")) + PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin")) ProxyManagerPlugin.register(with: registry.registrar(forPlugin: "ProxyManagerPlugin")) ScreenRetrieverMacosPlugin.register(with: registry.registrar(forPlugin: "ScreenRetrieverMacosPlugin")) SharePlusMacosPlugin.register(with: registry.registrar(forPlugin: "SharePlusMacosPlugin"))