Skip to content

Commit f9ad106

Browse files
author
liuchuancong
committed
添加windwows关闭安装
1 parent a93433d commit f9ad106

2 files changed

Lines changed: 12 additions & 1 deletion

File tree

lib/common/widgets/download_apk_dialog.dart

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ import 'package:flutter/material.dart';
66
import 'package:path/path.dart' as path;
77
import 'package:open_filex/open_filex.dart';
88
import 'package:path_provider/path_provider.dart';
9+
import 'package:window_manager/window_manager.dart';
10+
import 'package:pure_live/common/global/platform_utils.dart';
911

1012
// download_apk_dialog.dart
1113

@@ -81,6 +83,14 @@ class _DownloadApkDialogState extends State<DownloadApkDialog> {
8183

8284
// 安装 APK
8385
final result = await OpenFilex.open(file.path);
86+
if (PlatformUtils.isDesktopNotMac) {
87+
if (await windowManager.isPreventClose()) {
88+
await windowManager.setPreventClose(false);
89+
}
90+
WidgetsBinding.instance.addPostFrameCallback((_) {
91+
exit(0);
92+
});
93+
}
8494
if (result.type != ResultType.done) {
8595
Get.snackbar('安装失败', result.message);
8696
}

windows/packaging/exe/inno_setup.iss

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ SolidCompression=yes
1515
SetupIconFile={{SETUP_ICON_FILE}}
1616
WizardStyle=modern
1717
PrivilegesRequired={{PRIVILEGES_REQUIRED}}
18-
18+
CloseApplications=yes
19+
CloseApplicationsFilter=*.exe
1920
[Languages]
2021
{% for locale in LOCALES %}
2122
{% if locale == 'en' %}Name: "english"; MessagesFile: "compiler:Default.isl"{% endif %}

0 commit comments

Comments
 (0)