35 lines
600 B
Dart
35 lines
600 B
Dart
import 'dart:io';
|
|
|
|
import 'package:fl_clash/plugins/app.dart';
|
|
import 'package:flutter/services.dart';
|
|
|
|
import 'window.dart';
|
|
|
|
class System {
|
|
static System? _instance;
|
|
|
|
System._internal();
|
|
|
|
factory System() {
|
|
_instance ??= System._internal();
|
|
return _instance!;
|
|
}
|
|
|
|
bool get isDesktop =>
|
|
Platform.isWindows || Platform.isMacOS || Platform.isLinux;
|
|
|
|
back() async {
|
|
await app?.moveTaskToBack();
|
|
await window?.hide();
|
|
}
|
|
|
|
exit() async {
|
|
if (Platform.isAndroid) {
|
|
await SystemNavigator.pop();
|
|
}
|
|
await window?.close();
|
|
}
|
|
}
|
|
|
|
final system = System();
|