TF-2717 Use defaultTargetPlatform to easily write tests for widget

This commit is contained in:
dab246
2024-04-03 09:29:33 +07:00
committed by Dat H. Pham
parent 8dcd771e78
commit 90ab1283d1
+6 -8
View File
@@ -1,17 +1,15 @@
import 'dart:io';
import 'package:core/utils/app_logger.dart';
import 'package:core/utils/web_renderer/canvas_kit.dart';
import 'package:flutter/foundation.dart';
abstract class PlatformInfo {
static const bool isWeb = kIsWeb;
static bool get isLinux => !kIsWeb && Platform.isLinux;
static bool get isWindows => !kIsWeb && Platform.isWindows;
static bool get isMacOS => !kIsWeb && Platform.isMacOS;
static bool get isFuchsia => !kIsWeb && Platform.isFuchsia;
static bool get isIOS => !kIsWeb && Platform.isIOS;
static bool get isAndroid => !kIsWeb && Platform.isAndroid;
static bool get isLinux => !kIsWeb && defaultTargetPlatform == TargetPlatform.linux;
static bool get isWindows => !kIsWeb && defaultTargetPlatform == TargetPlatform.windows;
static bool get isMacOS => !kIsWeb && defaultTargetPlatform == TargetPlatform.macOS;
static bool get isFuchsia => !kIsWeb && defaultTargetPlatform == TargetPlatform.fuchsia;
static bool get isIOS => !kIsWeb && defaultTargetPlatform == TargetPlatform.iOS;
static bool get isAndroid => !kIsWeb && defaultTargetPlatform == TargetPlatform.android;
static bool get isMobile => isAndroid || isIOS;
static bool get isDesktop => isLinux || isWindows || isMacOS;
static bool get isCanvasKit => isRendererCanvasKit;