From e33d20f9bb773624449cd1d925c5bb55c0f3c7dc Mon Sep 17 00:00:00 2001 From: luckysmg <2539699336@qq.com> Date: Fri, 3 Feb 2023 19:08:17 +0800 Subject: [PATCH 1/3] ++ --- shell/platform/darwin/ios/framework/Source/FlutterView.mm | 1 + 1 file changed, 1 insertion(+) diff --git a/shell/platform/darwin/ios/framework/Source/FlutterView.mm b/shell/platform/darwin/ios/framework/Source/FlutterView.mm index 7c188be87109d..810ab76c86ebb 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterView.mm +++ b/shell/platform/darwin/ios/framework/Source/FlutterView.mm @@ -47,6 +47,7 @@ - (instancetype)initWithDelegate:(id)delegate opaque: if (self) { _delegate = delegate; self.layer.opaque = opaque; + self.backgroundColor = UIColor.clearColor; } return self; From 158cbf4a0753d61c0154ea38f5286240a32ad259 Mon Sep 17 00:00:00 2001 From: luckysmg <2539699336@qq.com> Date: Fri, 3 Feb 2023 23:26:19 +0800 Subject: [PATCH 2/3] Add tests --- .../platform/darwin/ios/framework/Source/FlutterViewTest.mm | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/shell/platform/darwin/ios/framework/Source/FlutterViewTest.mm b/shell/platform/darwin/ios/framework/Source/FlutterViewTest.mm index c14bee16a6104..d264933b0bf43 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterViewTest.mm +++ b/shell/platform/darwin/ios/framework/Source/FlutterViewTest.mm @@ -49,4 +49,10 @@ - (void)testFlutterViewEnableSemanticsWhenIsAccessibilityElementIsCalled { XCTAssertTrue(delegate.callbackCalled); } +- (void)testFlutterViewBackgroundColorIsNotNil { + FakeDelegate* delegate = [[FakeDelegate alloc] init]; + FlutterView* view = [[FlutterView alloc] initWithDelegate:delegate opaque:NO]; + XCTAssertNotNil(view.backgroundColor); +} + @end From b2155bb00e2af9a47ae42107d2fc86a45d575b43 Mon Sep 17 00:00:00 2001 From: luckysmg <2539699336@qq.com> Date: Sat, 4 Feb 2023 08:05:15 +0800 Subject: [PATCH 3/3] ++ --- shell/platform/darwin/ios/framework/Source/FlutterView.mm | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/shell/platform/darwin/ios/framework/Source/FlutterView.mm b/shell/platform/darwin/ios/framework/Source/FlutterView.mm index 810ab76c86ebb..dcab55d404c34 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterView.mm +++ b/shell/platform/darwin/ios/framework/Source/FlutterView.mm @@ -47,6 +47,11 @@ - (instancetype)initWithDelegate:(id)delegate opaque: if (self) { _delegate = delegate; self.layer.opaque = opaque; + + // This line is necessary. CoreAnimation(or UIKit) may take this to do + // something to compute the final frame presented on screen, if we don't set this, + // it will make it take long time for us to take next CAMetalDrawable and will + // cause constant junk during rendering. self.backgroundColor = UIColor.clearColor; }