32 lines
911 B
Dart
32 lines
911 B
Dart
import 'dart:io';
|
|
|
|
import 'package:flutter/material.dart';
|
|
import 'package:recording_tool/core/platform/app_platform_info.dart';
|
|
|
|
class DeviceUtils {
|
|
DeviceUtils._();
|
|
|
|
static double screenWidth(BuildContext context) =>
|
|
MediaQuery.sizeOf(context).width;
|
|
|
|
static double screenHeight(BuildContext context) =>
|
|
MediaQuery.sizeOf(context).height;
|
|
|
|
static double topSafePadding(BuildContext context) =>
|
|
MediaQuery.paddingOf(context).top;
|
|
|
|
static double bottomSafePadding(BuildContext context) =>
|
|
MediaQuery.paddingOf(context).bottom;
|
|
|
|
static Future<bool> isPhysicalDevice() async {
|
|
return (await AppPlatformInfo.deviceInfo()).isPhysicalDevice;
|
|
}
|
|
|
|
static Future<Map<String, String>> deviceInfo() async {
|
|
if (!Platform.isAndroid && !Platform.isIOS) {
|
|
return {'platform': Platform.operatingSystem};
|
|
}
|
|
return (await AppPlatformInfo.deviceInfo()).values;
|
|
}
|
|
}
|