remote device

This commit is contained in:
wanghongenpin
2025-05-28 21:05:04 +08:00
parent 02bf457b44
commit 111b35f50c
5 changed files with 13 additions and 7 deletions

View File

@@ -102,7 +102,7 @@ class _ToolbarState extends State<Toolbar> {
tooltip: localizations.mobileConnect,
icon: const Icon(Icons.phone_iphone, size: 22),
onPressed: () async {
final ips = await localIps();
final ips = await localIps(readCache: false);
phoneConnect(ips, widget.proxyServer.port);
}),
const Expanded(child: SizedBox()), //自动扩展挤压

View File

@@ -92,7 +92,7 @@ class _SocketLaunchState extends State<SocketLaunch> with WindowListener, Widget
}
Future<void> appExit() async {
await widget.proxyServer.stop();
widget.proxyServer.stop();
started = false;
await windowManager.destroy();
exit(0);

View File

@@ -441,6 +441,8 @@ class RequestPageState extends State<RequestPage> {
if (retry > 3) {
if (context.mounted) {
ScaffoldMessenger.of(context).removeCurrentSnackBar();
ScaffoldMessenger.of(context).showSnackBar(SnackBar(
content: Text(localizations.remoteConnectDisconnect),
action: SnackBarAction(

View File

@@ -123,7 +123,10 @@ class _RemoteDevicePageState extends State<RemoteDevicePage> {
leading: const Icon(Icons.qr_code_scanner_outlined),
dense: true,
title: Text(localizations.scanCode),
onTap: () => connectRemote(context))),
onTap: () {
Navigator.maybePop(context);
connectRemote();
})),
CustomPopupMenuItem(
height: 32,
child: ListTile(
@@ -351,7 +354,7 @@ class _RemoteDevicePageState extends State<RemoteDevicePage> {
}
///扫码连接
connectRemote(BuildContext context) async {
connectRemote() async {
AppLocalizations localizations = AppLocalizations.of(context)!;
String? scanRes = await QrCodeScanner.scan(context);
if (scanRes == null) return;
@@ -372,9 +375,10 @@ class _RemoteDevicePageState extends State<RemoteDevicePage> {
var port = uri.queryParameters['port'];
doConnect(host!, int.parse(port!));
return;
}
if (context.mounted) {
if (mounted) {
FlutterToastr.show(localizations.invalidQRCode, context);
}
}

View File

@@ -36,8 +36,8 @@ Future<InternetAddress> localAddress() async {
List<String>? ipList;
/// 获取本机所有ip
Future<List<String>> localIps() async {
if (ipList != null) {
Future<List<String>> localIps({bool readCache = true}) async {
if (readCache && ipList != null) {
return ipList!;
}