This commit is contained in:
2020-12-28 00:19:04 -05:00
parent 86c845b49b
commit c378a6203c
33 changed files with 833 additions and 200 deletions

View File

@@ -12,6 +12,7 @@ import 'package:hive/hive.dart';
import 'package:intl/intl.dart';
import 'package:url_launcher/url_launcher.dart';
import 'package:universal_io/io.dart';
import '../constants.dart';
import 'util_web.dart' if (dart.library.io) 'util_io.dart';
import '../routes.dart';
@@ -267,6 +268,47 @@ class Utils {
onError(error);
});
}
static String getOs({bool checkWeb = false}) {
if (checkWeb && kIsWeb) {
return 'web';
}
if (Platform.isAndroid) {
return 'android';
}
if (Platform.isIOS) {
return 'ios';
}
if (Platform.isLinux) {
return 'ubuntu';
}
if (Platform.isMacOS) {
return 'mac';
}
if (Platform.isWindows) {
return 'windows';
}
return 'web';
}
static int getOsFontHex(String os) {
if (os == 'mac') {
return Constants.FONT_APPLE;
}
if (os == 'windows') {
return Constants.FONT_WINDOWS;
}
if (os == 'ubuntu') {
return Constants.FONT_UBUNTU;
}
if (os == 'android') {
return Constants.FONT_ANDROID;
}
if (os == 'ios') {
return Constants.FONT_IOS;
}
return Constants.FONT_TOPTONS;
}
}
class RuntimeError extends Error{