backup.
This commit is contained in:
@@ -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{
|
||||
|
||||
Reference in New Issue
Block a user