Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add macos impeller flag #17

Merged
merged 1 commit into from
Aug 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion flutter/mesh/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
12 changes: 11 additions & 1 deletion flutter/mesh/lib/src/widgets/omesh_rect_paint.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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.
///
Expand All @@ -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
Expand Down