-
Notifications
You must be signed in to change notification settings - Fork 6k
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
[web] JSConfig: Add multiViewEnabled value. #47939
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -267,17 +267,6 @@ class FlutterConfiguration { | |
'FLUTTER_WEB_CANVASKIT_FORCE_CPU_ONLY', | ||
); | ||
|
||
/// This is deprecated. The CanvasKit renderer will only ever create one | ||
/// WebGL context, obviating the problem this configuration was meant to | ||
/// solve originally. | ||
@Deprecated('Setting canvasKitMaximumSurfaces has no effect') | ||
int get canvasKitMaximumSurfaces => | ||
_configuration?.canvasKitMaximumSurfaces?.toInt() ?? _defaultCanvasKitMaximumSurfaces; | ||
static const int _defaultCanvasKitMaximumSurfaces = int.fromEnvironment( | ||
'FLUTTER_WEB_MAXIMUM_SURFACES', | ||
defaultValue: 8, | ||
); | ||
|
||
/// Set this flag to `true` to cause the engine to visualize the semantics tree | ||
/// on the screen for debugging. | ||
/// | ||
|
@@ -298,6 +287,16 @@ class FlutterConfiguration { | |
/// to render, or `null` if the user hasn't specified anything. | ||
DomElement? get hostElement => _configuration?.hostElement; | ||
|
||
/// Sets Flutter Web in "multi-view" mode. | ||
/// | ||
/// Multi-view mode allows apps to: | ||
/// | ||
/// * Start without a `hostElement`. | ||
/// * Add/remove views (`hostElements`) from JS while the application is running. | ||
/// * ... | ||
/// * PROFIT? | ||
bool get multiViewEnabled => _configuration?.multiViewEnabled ?? false; | ||
|
||
/// Returns a `nonce` to allowlist the inline styles that Flutter web needs. | ||
/// | ||
/// See: https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/nonce | ||
|
@@ -347,16 +346,16 @@ extension JsFlutterConfigurationExtension on JsFlutterConfiguration { | |
external JSBoolean? get _canvasKitForceCpuOnly; | ||
bool? get canvasKitForceCpuOnly => _canvasKitForceCpuOnly?.toDart; | ||
|
||
@JS('canvasKitMaximumSurfaces') | ||
external JSNumber? get _canvasKitMaximumSurfaces; | ||
double? get canvasKitMaximumSurfaces => _canvasKitMaximumSurfaces?.toDartDouble; | ||
|
||
@JS('debugShowSemanticsNodes') | ||
external JSBoolean? get _debugShowSemanticsNodes; | ||
bool? get debugShowSemanticsNodes => _debugShowSemanticsNodes?.toDart; | ||
|
||
external DomElement? get hostElement; | ||
|
||
@JS('multiViewEnabled') | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We can give any "external" (JS) name we want to this property, like "multiViewEnabledExperimental" or something scary like that. Do we need that, or do we just call it "multiViewEnabled"? @mdebbar? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it's fine to keep the name There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think I agree with this! |
||
external JSBoolean? get _multiViewEnabled; | ||
bool? get multiViewEnabled => _multiViewEnabled?.toDart; | ||
|
||
@JS('nonce') | ||
external JSString? get _nonce; | ||
String? get nonce => _nonce?.toDart; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎉