mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
Update docs specifying addPlatformView offset param is not used (#21331)
for Android and iOS and remove offset from scenario_app test for iOS and Android.
This commit is contained in:
parent
9b140e5825
commit
515f339838
@ -715,8 +715,6 @@ class SceneBuilder extends NativeFieldWrapperClass2 {
|
||||
|
||||
/// Adds a platform view (e.g an iOS UIView) to the scene.
|
||||
///
|
||||
/// Only supported on iOS, this is currently a no-op on other platforms.
|
||||
///
|
||||
/// On iOS this layer splits the current output surface into two surfaces, one for the scene nodes
|
||||
/// preceding the platform view, and one for the scene nodes following the platform view.
|
||||
///
|
||||
@ -729,6 +727,8 @@ class SceneBuilder extends NativeFieldWrapperClass2 {
|
||||
/// With a platform view in the scene, Quartz has to composite the two Flutter surfaces and the
|
||||
/// embedded UIView. In addition to that, on iOS versions greater than 9, the Flutter frames are
|
||||
/// synchronized with the UIView frames adding additional performance overhead.
|
||||
///
|
||||
/// The `offset` argument is not used for iOS and Android.
|
||||
void addPlatformView(
|
||||
int viewId, {
|
||||
Offset offset = Offset.zero,
|
||||
|
||||
@ -707,21 +707,15 @@ mixin _BasePlatformViewScenarioMixin on Scenario {
|
||||
SceneBuilder sceneBuilder,
|
||||
int viewId,
|
||||
double width,
|
||||
double height, {
|
||||
Offset overlayOffset,
|
||||
}) {
|
||||
overlayOffset ??= const Offset(50, 50);
|
||||
double height,
|
||||
) {
|
||||
if (Platform.isIOS) {
|
||||
sceneBuilder.addPlatformView(viewId, offset: overlayOffset, width: width, height: height);
|
||||
sceneBuilder.addPlatformView(viewId, width: width, height: height);
|
||||
} else if (Platform.isAndroid) {
|
||||
if (usesAndroidHybridComposition) {
|
||||
// Hybrid composition does not support `offset`.
|
||||
// https://github.com/flutter/flutter/issues/60630
|
||||
sceneBuilder.pushOffset(overlayOffset.dx, overlayOffset.dy);
|
||||
sceneBuilder.addPlatformView(viewId, width: width, height: height);
|
||||
sceneBuilder.pop();
|
||||
} else if (_textureId != null) {
|
||||
sceneBuilder.addTexture(_textureId, offset: overlayOffset, width: width, height: height);
|
||||
sceneBuilder.addTexture(_textureId, width: width, height: height);
|
||||
}
|
||||
} else {
|
||||
throw UnsupportedError('Platform ${Platform.operatingSystem} is not supported');
|
||||
@ -740,7 +734,6 @@ mixin _BasePlatformViewScenarioMixin on Scenario {
|
||||
viewId,
|
||||
500,
|
||||
500,
|
||||
overlayOffset: overlayOffset,
|
||||
);
|
||||
final PictureRecorder recorder = PictureRecorder();
|
||||
final Canvas canvas = Canvas(recorder);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user