TF-2537 Fix app crash when user trying attach file to composer in web app

Signed-off-by: dab246 <tdvu@linagora.com>
This commit is contained in:
dab246
2024-02-21 08:31:40 +07:00
committed by Dat H. Pham
parent 20fe348672
commit 7e96d09f52
9 changed files with 96 additions and 52 deletions
+2 -1
View File
@@ -1,6 +1,7 @@
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 {
@@ -13,7 +14,7 @@ abstract class PlatformInfo {
static bool get isAndroid => !kIsWeb && Platform.isAndroid;
static bool get isMobile => isAndroid || isIOS;
static bool get isDesktop => isLinux || isWindows || isMacOS;
static bool get isWebMobile => kIsWeb && (defaultTargetPlatform == TargetPlatform.iOS || defaultTargetPlatform == TargetPlatform.android);
static bool get isCanvasKit => isRendererCanvasKit;
static String get platformNameOS {
var platformName = '';
@@ -0,0 +1 @@
export 'canvas_kit_stub.dart' if (dart.library.html) 'canvas_kit_web.dart';
@@ -0,0 +1,4 @@
/// Whether the CanvasKit renderer is being used on web.
///
/// Always returns `false` on non-web.
bool get isRendererCanvasKit => false;
@@ -0,0 +1,6 @@
import 'dart:js' as js;
/// Whether the CanvasKit renderer is being used on web.
///
/// Always returns `false` on non-web.
bool get isRendererCanvasKit => js.context['flutterCanvasKit'] != null;