Initial commit

This commit is contained in:
wgh19
2024-05-13 09:36:23 +08:00
commit b095643cbc
160 changed files with 9956 additions and 0 deletions

41
lib/foundation/app.dart Normal file
View File

@@ -0,0 +1,41 @@
import 'dart:io';
import 'dart:ui';
import 'package:fluent_ui/fluent_ui.dart';
import 'package:path_provider/path_provider.dart';
export "widget_utils.dart";
export "state_controller.dart";
export "navigation.dart";
class _App {
bool get isAndroid => Platform.isAndroid;
bool get isIOS => Platform.isIOS;
bool get isWindows => Platform.isWindows;
bool get isLinux => Platform.isLinux;
bool get isMacOS => Platform.isMacOS;
bool get isDesktop =>
Platform.isWindows || Platform.isLinux || Platform.isMacOS;
bool get isMobile => Platform.isAndroid || Platform.isIOS;
Locale get locale {
Locale deviceLocale = PlatformDispatcher.instance.locale;
if (deviceLocale.languageCode == "zh" && deviceLocale.scriptCode == "Hant") {
deviceLocale = const Locale("zh", "TW");
}
return deviceLocale;
}
late String dataPath;
late String cachePath;
init() async{
cachePath = (await getApplicationCacheDirectory()).path;
dataPath = (await getApplicationSupportDirectory()).path;
}
final rootNavigatorKey = GlobalKey<NavigatorState>();
}
// ignore: non_constant_identifier_names
final App = _App();