| Flutter iOS Embedder |

Instance Methods | Class Methods | List of all members
FlutterPlatformPlugin Class Reference

`#import <FlutterPlatformPlugin.h>`

Inheritance diagram for FlutterPlatformPlugin:

## Instance Methods
(instancetype) | - NS_UNAVAILABLE
(instancetype) | - initWithEngine:
(void) | - handleMethodCall:result:
(void) | - showShareViewController:
(void) | - searchWeb:
(void) | - showLookUpViewController:

## Class Methods
(instancetype) | + NS_UNAVAILABLE

## Detailed Description

Definition at line 11 of file FlutterPlatformPlugin.h.

## Method Documentation

## ◆ handleMethodCall:result:

- (void) handleMethodCall: |  | (FlutterMethodCall*) | call
result: |  | (FlutterResult) | result

Definition at line 87 of file FlutterPlatformPlugin.mm.

113 :(FlutterMethodCall*)call result:(FlutterResult)result {
114 NSString* method = call.method;
115 id args = call.arguments;
116 if ([method isEqualToString:@"SystemSound.play"]) {
117 [self playSystemSound:args];
118 result(nil);
119 } else if ([method isEqualToString:@"HapticFeedback.vibrate"]) {
120 [self vibrateHapticFeedback:args];
121 result(nil);
122 } else if ([method isEqualToString:@"SystemChrome.setPreferredOrientations"]) {
123 [self setSystemChromePreferredOrientations:args];
124 result(nil);
125 } else if ([method isEqualToString:@"SystemChrome.setApplicationSwitcherDescription"]) {
126 [self setSystemChromeApplicationSwitcherDescription:args];
127 result(nil);
128 } else if ([method isEqualToString:@"SystemChrome.setEnabledSystemUIOverlays"]) {
129 [self setSystemChromeEnabledSystemUIOverlays:args];
130 result(nil);
131 } else if ([method isEqualToString:@"SystemChrome.setEnabledSystemUIMode"]) {
132 [self setSystemChromeEnabledSystemUIMode:args];
133 result(nil);
134 } else if ([method isEqualToString:@"SystemChrome.restoreSystemUIOverlays"]) {
135 [self restoreSystemChromeSystemUIOverlays];
136 result(nil);
137 } else if ([method isEqualToString:@"SystemChrome.setSystemUIOverlayStyle"]) {
138 [self setSystemChromeSystemUIOverlayStyle:args];
139 result(nil);
140 } else if ([method isEqualToString:@"SystemNavigator.pop"]) {
141 NSNumber* isAnimated = args;
142 [self popSystemNavigator:isAnimated.boolValue];
143 result(nil);
144 } else if ([method isEqualToString:@"Clipboard.getData"]) {
145 result([self getClipboardData:args]);
146 } else if ([method isEqualToString:@"Clipboard.setData"]) {
147 [self setClipboardData:args];
148 result(nil);
149 } else if ([method isEqualToString:@"Clipboard.hasStrings"]) {
150 result([self clipboardHasStrings]);
151 } else if ([method isEqualToString:@"LiveText.isLiveTextInputAvailable"]) {
152 result(@([self isLiveTextInputAvailable]));
153 } else if ([method isEqualToString:@"SearchWeb.invoke"]) {
154 [self searchWeb:args];
155 result(nil);
156 } else if ([method isEqualToString:@"LookUp.invoke"]) {
157 [self showLookUpViewController:args];
158 result(nil);
159 } else if ([method isEqualToString:@"Share.invoke"]) {
160 [self showShareViewController:args];
161 result(nil);
162 } else if ([method isEqualToString:@"ContextMenu.showSystemContextMenu"]) {
163 [self showSystemContextMenu:args];
164 result(nil);
165 } else if ([method isEqualToString:@"ContextMenu.hideSystemContextMenu"]) {
166 [self hideSystemContextMenu];
167 result(nil);
168 } else {
169 result(FlutterMethodNotImplemented);
170 }
171 }
FlutterResult
void(^ FlutterResult)(id _Nullable result)
Definition: FlutterChannels.h:194
FlutterMethodNotImplemented
FLUTTER_DARWIN_EXPORT NSObject const * FlutterMethodNotImplemented
FlutterMethodCall
Definition: FlutterCodecs.h:221
FlutterMethodCall::method
NSString * method
Definition: FlutterCodecs.h:233
FlutterMethodCall::arguments
id arguments
Definition: FlutterCodecs.h:238

References engine.

## ◆ initWithEngine:

- (instancetype) initWithEngine: |  | (FlutterEngine*) | NS_DESIGNATED_INITIALIZER |

Definition at line 87 of file FlutterPlatformPlugin.mm.

92 :(FlutterEngine*)engine {
93 FML_DCHECK(engine) << "engine must be set";
94 self = [super init];
95
96 if (self) {
97 _engine = engine;
98 NSObject* infoValue = [[NSBundle mainBundle]
99 objectForInfoDictionaryKey:@"UIViewControllerBasedStatusBarAppearance"];
100 #if FLUTTER_RUNTIME_MODE == FLUTTER_RUNTIME_MODE_DEBUG
101 if (infoValue != nil && ![infoValue isKindOfClass:[NSNumber class]]) {
102 [FlutterLogger logError:@"The value of UIViewControllerBasedStatusBarAppearance in "
103 "Info.plist must be a Boolean type."];
104 }
105 #endif
106 _enableViewControllerBasedStatusBarAppearance =
107 (infoValue == nil || [(NSNumber*)infoValue boolValue]);
108 }
109
110 return self;
111 }
engine
id engine
Definition: FlutterTextInputPluginTest.mm:137
FlutterEngine
Definition: FlutterEngine.h:61

## ◆ NS_UNAVAILABLE [1/2]

+ (instancetype) NS_UNAVAILABLE |  |  |

## ◆ NS_UNAVAILABLE [2/2]

- (instancetype) NS_UNAVAILABLE |  |  |

## ◆ searchWeb:

- (void) searchWeb: |  | (NSString*) | searchTerm |

Definition at line 87 of file FlutterPlatformPlugin.mm.

229 :(NSString*)searchTerm {
230 UIApplication* flutterApplication = FlutterSharedApplication.application;
231 if (flutterApplication == nil) {
232 [FlutterLogger logWarning:@"SearchWeb.invoke is not availabe in app extension."];
233 return;
234 }
235
236 NSString* escapedText = [searchTerm
237 stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet
238 URLHostAllowedCharacterSet]];
239 NSString* searchURL = [NSString stringWithFormat:@"%@%@", kSearchURLPrefix, escapedText];
240
241 [flutterApplication openURL:[NSURL URLWithString:searchURL] options:@{} completionHandler:nil];
242 }
FlutterSharedApplication
Definition: FlutterSharedApplication.h:13
FlutterSharedApplication::application
UIApplication * application
Definition: FlutterSharedApplication.h:27

## ◆ showLookUpViewController:

- (void) showLookUpViewController: |  | (NSString*) | term |

Definition at line 87 of file FlutterPlatformPlugin.mm.

445 :(NSString*)term {
446 UIViewController* engineViewController = [self.engine viewController];
447 UIReferenceLibraryViewController* referenceLibraryViewController =
448 [[UIReferenceLibraryViewController alloc] initWithTerm:term];
449 [engineViewController presentViewController:referenceLibraryViewController
450 animated:YES
451 completion:nil];
452 }

## ◆ showShareViewController:

- (void) showShareViewController: |  | (NSString*) | content |

Definition at line 87 of file FlutterPlatformPlugin.mm.

192 :(NSString*)content {
193 UIViewController* engineViewController = [self.engine viewController];
194
195 NSArray* itemsToShare = @[ content ?: [NSNull null] ];
196 UIActivityViewController* activityViewController =
197 [[UIActivityViewController alloc] initWithActivityItems:itemsToShare
198 applicationActivities:nil];
199
200 if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
201 // On iPad, the share screen is presented in a popover view, and requires a
202 // sourceView and sourceRect
203 FlutterTextInputPlugin* _textInputPlugin = [self.engine textInputPlugin];
204 UITextRange* range = _textInputPlugin.textInputView.selectedTextRange;
205
206 // firstRectForRange cannot be used here as it's current implementation does
207 // not always return the full rect of the range.
208 CGRect firstRect = [(FlutterTextInputView*)_textInputPlugin.textInputView
209 caretRectForPosition:(FlutterTextPosition*)range.start];
210 CGRect transformedFirstRect = [(FlutterTextInputView*)_textInputPlugin.textInputView
211 localRectFromFrameworkTransform:firstRect];
212 CGRect lastRect = [(FlutterTextInputView*)_textInputPlugin.textInputView
213 caretRectForPosition:(FlutterTextPosition*)range.end];
214 CGRect transformedLastRect = [(FlutterTextInputView*)_textInputPlugin.textInputView
215 localRectFromFrameworkTransform:lastRect];
216
217 activityViewController.popoverPresentationController.sourceView = engineViewController.view;
218 // In case of RTL Language, get the minimum x coordinate
219 activityViewController.popoverPresentationController.sourceRect =
220 CGRectMake(fmin(transformedFirstRect.origin.x, transformedLastRect.origin.x),
221 transformedFirstRect.origin.y,
222 abs(transformedLastRect.origin.x - transformedFirstRect.origin.x),
223 transformedFirstRect.size.height);
224 }
225
226 [engineViewController presentViewController:activityViewController animated:YES completion:nil];
227 }
FlutterTextInputView
Definition: FlutterTextInputPlugin.mm:812
FlutterTextInputPlugin
Definition: FlutterTextInputPlugin.h:34
-[FlutterTextInputPlugin textInputView]
UIView< UITextInput > * textInputView()
Definition: FlutterTextInputPlugin.mm:2554

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

- shell/platform/darwin/ios/framework/Source/FlutterPlatformPlugin.h
- shell/platform/darwin/ios/framework/Source/FlutterPlatformPlugin.mm