Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 89d6e7d

Browse files
author
a-wallen
committed
Make backgroundColor a property on FVC
1 parent 79e32f3 commit 89d6e7d

3 files changed

Lines changed: 5 additions & 4 deletions

File tree

shell/platform/darwin/macos/framework/Headers/FlutterViewController.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ FLUTTER_DARWIN_EXPORT
9191
* // If the `FlutterView`'s color is not set via `FlutterViewController.setBackgroundColor`
9292
* // it's default will be black.
9393
* self.backgroundColor = NSColor.clear
94-
* flutterViewController.setBackgroundColor(NSColor.white)
94+
* flutterViewController.backgroundColor = NSColor.clear
9595
*
9696
* let windowFrame = self.frame
9797
* self.contentViewController = flutterViewController
@@ -104,6 +104,6 @@ FLUTTER_DARWIN_EXPORT
104104
* }
105105
* ```
106106
*/
107-
- (void)setBackgroundColor:(nonnull NSColor*)color;
107+
@property(readwrite, nonatomic, nullable) NSColor* backgroundColor;
108108

109109
@end

shell/platform/darwin/macos/framework/Source/FlutterEngineTest.mm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ @interface FlutterEngine (Test)
145145
[viewController loadView];
146146
viewController.flutterView.frame = CGRectMake(0, 0, 800, 600);
147147
[engine setViewController:viewController];
148-
[viewController setBackgroundColor:[NSColor whiteColor]];
148+
viewController.flutterView.backgroundColor = [NSColor whiteColor];
149149

150150
// Latch to ensure the entire layer tree has been generated and presented.
151151
fml::AutoResetWaitableEvent latch;

shell/platform/darwin/macos/framework/Source/FlutterViewController.mm

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -422,7 +422,8 @@ - (void)setMouseTrackingMode:(FlutterMouseTrackingMode)mode {
422422
}
423423

424424
- (void)setBackgroundColor:(NSColor*)color {
425-
[(FlutterViewWrapper*)[self view] setBackgroundColor:color];
425+
_backgroundColor = color;
426+
[(FlutterViewWrapper*)[self view] setBackgroundColor:_backgroundColor];
426427
}
427428

428429
- (void)onPreEngineRestart {

0 commit comments

Comments
 (0)