Flutter Engine
The Flutter Engine
Instance Methods | Class Methods | Properties | List of all members
PlatformViewFilter Class Reference

#import <FlutterPlatformViews_Internal.h>

Inheritance diagram for PlatformViewFilter:

Instance Methods

(instancetype) - NS_UNAVAILABLE
 
(instancetype) - initWithFrame:blurRadius:visualEffectView:
 
(void) - updateVisualEffectView: [implementation]
 

Class Methods

(void) + resetPreparation
 
(void) + prepareOnce: [implementation]
 
(BOOL+ isUIVisualEffectViewImplementationValid [implementation]
 

Properties

CGRect frame
 
CGFloat blurRadius
 
UIVisualEffectView * backdropFilterView
 
BOOL backdropFilterViewConfigured [implementation]
 

Detailed Description

Definition at line 80 of file FlutterPlatformViews_Internal.h.

Method Documentation

◆ initWithFrame:blurRadius:visualEffectView:

- (instancetype) initWithFrame: (CGRect)  frame
blurRadius: (CGFloat)  blurRadius
visualEffectView: (UIVisualEffectView*)  NS_DESIGNATED_INITIALIZER 

Definition at line 95 of file FlutterPlatformViews_Internal.mm.

97 :(CGRect)frame
98 blurRadius:(CGFloat)blurRadius
99 visualEffectView:(UIVisualEffectView*)visualEffectView {
100 if (self = [super init]) {
101 _frame = frame;
102 _blurRadius = blurRadius;
103 [PlatformViewFilter prepareOnce:visualEffectView];
105 FML_DLOG(ERROR) << "Apple's API for UIVisualEffectView changed. Update the implementation to "
106 "access the gaussianBlur CAFilter.";
107 return nil;
108 }
109 _backdropFilterView = visualEffectView;
110 _backdropFilterViewConfigured = NO;
111 }
112 return self;
113}
#define FML_DLOG(severity)
Definition: logging.h:102
void prepareOnce:(UIVisualEffectView *visualEffectView)
static bool init()
#define ERROR(message)
Definition: elf_loader.cc:260

◆ isUIVisualEffectViewImplementationValid

+ (BOOL) isUIVisualEffectViewImplementationValid
implementation

Definition at line 95 of file FlutterPlatformViews_Internal.mm.

144 {
146}
static NSInteger _indexOfVisualEffectSubview
static NSInteger _indexOfBackdropView
static NSObject * _gaussianBlurFilter

◆ NS_UNAVAILABLE

- (instancetype) NS_UNAVAILABLE

◆ prepareOnce:

+ (void) prepareOnce: (UIVisualEffectView*)  visualEffectView
implementation

Definition at line 95 of file FlutterPlatformViews_Internal.mm.

122 :(UIVisualEffectView*)visualEffectView {
123 if (_preparedOnce) {
124 return;
125 }
126 for (NSUInteger i = 0; i < visualEffectView.subviews.count; i++) {
127 UIView* view = visualEffectView.subviews[i];
128 if ([NSStringFromClass([view class]) hasSuffix:@"BackdropView"]) {
130 for (NSObject* filter in view.layer.filters) {
131 if ([[filter valueForKey:@"name"] isEqual:@"gaussianBlur"] &&
132 [[filter valueForKey:@"inputRadius"] isKindOfClass:[NSNumber class]]) {
133 _gaussianBlurFilter = filter;
134 break;
135 }
136 }
137 } else if ([NSStringFromClass([view class]) hasSuffix:@"VisualEffectSubview"]) {
139 }
140 }
141 _preparedOnce = YES;
142}
static BOOL _preparedOnce

◆ resetPreparation

+ (void) resetPreparation

Definition at line 95 of file FlutterPlatformViews_Internal.mm.

115 {
116 _preparedOnce = NO;
120}

◆ updateVisualEffectView:

- (void) updateVisualEffectView: (UIVisualEffectView*)  visualEffectView
implementation

Definition at line 95 of file FlutterPlatformViews_Internal.mm.

157 :(UIVisualEffectView*)visualEffectView {
158 NSObject* gaussianBlurFilter = [_gaussianBlurFilter copy];
159 FML_DCHECK(gaussianBlurFilter);
160 UIView* backdropView = visualEffectView.subviews[_indexOfBackdropView];
161 [gaussianBlurFilter setValue:@(_blurRadius) forKey:@"inputRadius"];
162 backdropView.layer.filters = @[ gaussianBlurFilter ];
163
164 UIView* visualEffectSubview = visualEffectView.subviews[_indexOfVisualEffectSubview];
165 visualEffectSubview.layer.backgroundColor = UIColor.clearColor.CGColor;
166 visualEffectView.frame = _frame;
167
168 self.backdropFilterView = visualEffectView;
169}
#define FML_DCHECK(condition)
Definition: logging.h:103

Property Documentation

◆ backdropFilterView

- (UIVisualEffectView *) backdropFilterView
readnonatomicassign

Definition at line 95 of file FlutterPlatformViews_Internal.h.

◆ backdropFilterViewConfigured

- (BOOL) backdropFilterViewConfigured
readwritenonatomicassignimplementation

Definition at line 79 of file FlutterPlatformViews_Internal.mm.

◆ blurRadius

- (CGFloat) blurRadius
readnonatomicassign

Definition at line 89 of file FlutterPlatformViews_Internal.h.

◆ frame

- (CGRect) frame
readnonatomicassign

Definition at line 84 of file FlutterPlatformViews_Internal.h.


The documentation for this class was generated from the following files: