From 519f91bdd62351c8dbce8a3b47ebc407d2ceb9ea Mon Sep 17 00:00:00 2001 From: Renan araujo Date: Sun, 25 Aug 2024 22:53:48 +0100 Subject: [PATCH] feat: add macos impeller flag --- flutter/mesh/README.md | 6 +++++- flutter/mesh/lib/src/widgets/omesh_rect_paint.dart | 12 +++++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/flutter/mesh/README.md b/flutter/mesh/README.md index f61c189..87b8357 100644 --- a/flutter/mesh/README.md +++ b/flutter/mesh/README.md @@ -401,7 +401,11 @@ enableOMeshImpellerCompatibility = false; ### Impeller on macOS -Impeller is [not enabled by default on macOS](https://docs.flutter.dev/perf/impeller#macos), regardless of whether you opt-in or out of it, O'Mesh should be compatible with it. +Impeller is [not enabled by default on macOS](https://docs.flutter.dev/perf/impeller#macos), **If you are opting into it**, make sure you enabled the following flag before your `runApp` call: + +```dart +enableOMeshImpellerCompatibilityOnMacOS = true; +``` ### Impeller on Android diff --git a/flutter/mesh/lib/src/widgets/omesh_rect_paint.dart b/flutter/mesh/lib/src/widgets/omesh_rect_paint.dart index ca9bf75..911f7d0 100644 --- a/flutter/mesh/lib/src/widgets/omesh_rect_paint.dart +++ b/flutter/mesh/lib/src/widgets/omesh_rect_paint.dart @@ -22,6 +22,14 @@ import 'package:mesh/mesh.dart'; /// ou are opting in on Impeller on Android. bool enableOMeshImpellerCompatibility = true; +/// When [enableOMeshImpellerCompatibility] is true, this flag will enable +/// Impeller compatibility on macOS. +/// +/// False by default. +/// +/// Set to true if you are opting in on Impeller on macOS. +bool enableOMeshImpellerCompatibilityOnMacOS = false; + /// When [enableOMeshImpellerCompatibility] is true, this flag will enable /// Impeller compatibility on Android. /// @@ -42,12 +50,14 @@ bool get _enableImpellerCompatibility { return false; } + // Impeller on iOS is always supported if (defaultTargetPlatform == TargetPlatform.iOS) { return true; } + // Impeller on macOS is only supported if the feature is enabled if (defaultTargetPlatform == TargetPlatform.macOS) { - return true; + return enableOMeshImpellerCompatibilityOnMacOS; } // Impeller on android is only supported if the feature is enabled