Skip to content

Commit a42139f

Browse files
committed
Window destroy on android and iOS
1 parent 5fb877b commit a42139f

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

packages/flet/lib/src/utils/desktop.dart

+10-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
1+
import 'dart:io';
2+
13
import 'package:flet/src/utils/platform.dart';
24
import 'package:flutter/foundation.dart';
5+
import 'package:flutter/services.dart';
36
import 'package:flutter/widgets.dart';
47
import 'package:window_manager/window_manager.dart';
58
import 'package:window_to_front/window_to_front.dart';
@@ -246,9 +249,15 @@ Future blurWindow() async {
246249
}
247250

248251
Future destroyWindow() async {
249-
if (isDesktopPlatform()) {
252+
if (isDesktopPlatform() || isMobilePlatform()) {
250253
debugPrint("destroyWindow()");
254+
}
255+
if (isDesktopPlatform()) {
251256
await windowManager.destroy();
257+
} else if (defaultTargetPlatform == TargetPlatform.iOS) {
258+
exit(0);
259+
} else if (defaultTargetPlatform == TargetPlatform.android) {
260+
SystemNavigator.pop();
252261
}
253262
}
254263

0 commit comments

Comments
 (0)