Flutter iOS Embedder
FlutterTextInputPlugin Class Reference

#import <FlutterTextInputPlugin.h>

Instance Methods

(instancetype) - NS_UNAVAILABLE
 
(instancetype) - initWithDelegate:
 
(void) - handleMethodCall:result:
 
(UIView< UITextInput > *) - textInputView
 
(void) - setUpIndirectScribbleInteraction:
 
(void) - resetViewResponder
 
(BOOL) - showEditMenu:
 
(ios(16.0) - API_AVAILABLE
 

Class Methods

(instancetype) + NS_UNAVAILABLE
 

Protected Attributes

 __pad0__: NSObject <FlutterKeySecondaryResponder
 

Properties

UIIndirectScribbleInteractionDelegate UIViewController * viewController
 
id< FlutterIndirectScribbleDelegateindirectScribbleDelegate
 
NSMutableDictionary< UIScribbleElementIdentifier, NSValue * > * scribbleElements
 

Detailed Description

Definition at line 33 of file FlutterTextInputPlugin.h.

Method Documentation

◆ API_AVAILABLE

- (ios(16.0) API_AVAILABLE

◆ handleMethodCall:result:

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

Definition at line 2391 of file FlutterTextInputPlugin.mm.

2391  :(FlutterMethodCall*)call result:(FlutterResult)result {
2392  NSString* method = call.method;
2393  id args = call.arguments;
2394  if ([method isEqualToString:kShowMethod]) {
2395  [self showTextInput];
2396  result(nil);
2397  } else if ([method isEqualToString:kHideMethod]) {
2398  [self hideTextInput];
2399  result(nil);
2400  } else if ([method isEqualToString:kSetClientMethod]) {
2401  [self setTextInputClient:[args[0] intValue] withConfiguration:args[1]];
2402  result(nil);
2403  } else if ([method isEqualToString:kSetPlatformViewClientMethod]) {
2404  // This method call has a `platformViewId` argument, but we do not need it for iOS for now.
2405  [self setPlatformViewTextInputClient];
2406  result(nil);
2407  } else if ([method isEqualToString:kSetEditingStateMethod]) {
2408  [self setTextInputEditingState:args];
2409  result(nil);
2410  } else if ([method isEqualToString:kClearClientMethod]) {
2411  [self clearTextInputClient];
2412  result(nil);
2413  } else if ([method isEqualToString:kSetEditableSizeAndTransformMethod]) {
2414  [self setEditableSizeAndTransform:args];
2415  result(nil);
2416  } else if ([method isEqualToString:kSetMarkedTextRectMethod]) {
2417  [self updateMarkedRect:args];
2418  result(nil);
2419  } else if ([method isEqualToString:kFinishAutofillContextMethod]) {
2420  [self triggerAutofillSave:[args boolValue]];
2421  result(nil);
2422  // TODO(justinmc): Remove the TextInput method constant when the framework has
2423  // finished transitioning to using the Scribble channel.
2424  // https://github.com/flutter/flutter/pull/104128
2425  } else if ([method isEqualToString:kDeprecatedSetSelectionRectsMethod]) {
2426  [self setSelectionRects:args];
2427  result(nil);
2428  } else if ([method isEqualToString:kSetSelectionRectsMethod]) {
2429  [self setSelectionRects:args];
2430  result(nil);
2431  } else if ([method isEqualToString:kStartLiveTextInputMethod]) {
2432  [self startLiveTextInput];
2433  result(nil);
2434  } else if ([method isEqualToString:kUpdateConfigMethod]) {
2435  [self updateConfig:args];
2436  result(nil);
2437  } else if ([method isEqualToString:kOnInteractiveKeyboardPointerMoveMethod]) {
2438  CGFloat pointerY = (CGFloat)[args[@"pointerY"] doubleValue];
2439  [self handlePointerMove:pointerY];
2440  result(nil);
2441  } else if ([method isEqualToString:kOnInteractiveKeyboardPointerUpMethod]) {
2442  CGFloat pointerY = (CGFloat)[args[@"pointerY"] doubleValue];
2443  [self handlePointerUp:pointerY];
2444  result(nil);
2445  } else {
2447  }
2448 }

References FlutterMethodCall::arguments, FlutterMethodNotImplemented, kClearClientMethod, kDeprecatedSetSelectionRectsMethod, kFinishAutofillContextMethod, kHideMethod, kOnInteractiveKeyboardPointerMoveMethod, kOnInteractiveKeyboardPointerUpMethod, kSetClientMethod, kSetEditableSizeAndTransformMethod, kSetEditingStateMethod, kSetMarkedTextRectMethod, kSetPlatformViewClientMethod, kSetSelectionRectsMethod, kShowMethod, kStartLiveTextInputMethod, kUpdateConfigMethod, and FlutterMethodCall::method.

◆ initWithDelegate:

- (instancetype) initWithDelegate: (id<FlutterTextInputDelegate>)  NS_DESIGNATED_INITIALIZER
Initial value:
{
NSTimer* _enableFlutterTextInputViewAccessibilityTimer

Definition at line 2351 of file FlutterTextInputPlugin.mm.

2351  :(id<FlutterTextInputDelegate>)textInputDelegate {
2352  self = [super init];
2353  if (self) {
2354  // `_textInputDelegate` is a weak reference because it should retain FlutterTextInputPlugin.
2355  _textInputDelegate = textInputDelegate;
2356  _autofillContext = [[NSMutableDictionary alloc] init];
2357  _inputHider = [[FlutterTextInputViewAccessibilityHider alloc] init];
2358  _scribbleElements = [[NSMutableDictionary alloc] init];
2359  _keyboardViewContainer = [[UIView alloc] init];
2360 
2361  [[NSNotificationCenter defaultCenter] addObserver:self
2362  selector:@selector(handleKeyboardWillShow:)
2363  name:UIKeyboardWillShowNotification
2364  object:nil];
2365  }
2366 
2367  return self;
2368 }

◆ NS_UNAVAILABLE [1/2]

+ (instancetype) NS_UNAVAILABLE

◆ NS_UNAVAILABLE [2/2]

- (instancetype) NS_UNAVAILABLE

◆ resetViewResponder

- (void) resetViewResponder

Definition at line 3038 of file FlutterTextInputPlugin.mm.

3038  {
3039  _viewResponder = nil;
3040 }

◆ setUpIndirectScribbleInteraction:

- (void) setUpIndirectScribbleInteraction: (id<FlutterViewResponder>)  viewResponder

These are used by the UIIndirectScribbleInteractionDelegate methods to handle focusing on the correct element.

Definition at line 3024 of file FlutterTextInputPlugin.mm.

3024  :(id<FlutterViewResponder>)viewResponder {
3025  if (_viewResponder != viewResponder) {
3026  if (@available(iOS 14.0, *)) {
3027  UIView* parentView = viewResponder.view;
3028  if (parentView != nil) {
3029  UIIndirectScribbleInteraction* scribbleInteraction = [[UIIndirectScribbleInteraction alloc]
3030  initWithDelegate:(id<UIIndirectScribbleInteractionDelegate>)self];
3031  [parentView addInteraction:scribbleInteraction];
3032  }
3033  }
3034  }
3035  _viewResponder = viewResponder;
3036 }

References viewResponder.

◆ showEditMenu:

- (BOOL) showEditMenu: (ios(16.0))  API_AVAILABLE

Definition at line 2554 of file FlutterTextInputPlugin.mm.

2554  :(NSDictionary*)args API_AVAILABLE(ios(16.0)) {
2555  if (!self.activeView.isFirstResponder) {
2556  return NO;
2557  }
2558  NSDictionary<NSString*, NSNumber*>* encodedTargetRect = args[@"targetRect"];
2559  CGRect globalTargetRect = CGRectMake(
2560  [encodedTargetRect[@"x"] doubleValue], [encodedTargetRect[@"y"] doubleValue],
2561  [encodedTargetRect[@"width"] doubleValue], [encodedTargetRect[@"height"] doubleValue]);
2562  CGRect localTargetRect = [self.hostView convertRect:globalTargetRect toView:self.activeView];
2563  [self.activeView showEditMenuWithTargetRect:localTargetRect];
2564  return YES;
2565 }

◆ textInputView

- (UIView< UITextInput > *) textInputView

The UITextInput implementation used to control text entry.

This is used by AccessibilityBridge to forward interactions with iOS' accessibility system.

Definition at line 2387 of file FlutterTextInputPlugin.mm.

2387  {
2388  return _activeView;
2389 }

Member Data Documentation

◆ __pad0__

- __pad0__
protected

Definition at line 34 of file FlutterTextInputPlugin.h.

Property Documentation

◆ indirectScribbleDelegate

- (id<FlutterIndirectScribbleDelegate>) indirectScribbleDelegate
readwritenonatomicweak

Definition at line 37 of file FlutterTextInputPlugin.h.

◆ scribbleElements

- (NSMutableDictionary<UIScribbleElementIdentifier, NSValue*>*) scribbleElements
readwritenonatomicstrong

Definition at line 39 of file FlutterTextInputPlugin.h.

◆ viewController

- (UIIndirectScribbleInteractionDelegate UIViewController*) viewController
readwritenonatomicweak

Definition at line 36 of file FlutterTextInputPlugin.h.


The documentation for this class was generated from the following files:
kSetEditingStateMethod
static NSString *const kSetEditingStateMethod
Definition: FlutterTextInputPlugin.mm:43
FlutterMethodNotImplemented
FLUTTER_DARWIN_EXPORT NSObject const * FlutterMethodNotImplemented
kOnInteractiveKeyboardPointerUpMethod
static NSString *const kOnInteractiveKeyboardPointerUpMethod
Definition: FlutterTextInputPlugin.mm:58
kSetClientMethod
static NSString *const kSetClientMethod
Definition: FlutterTextInputPlugin.mm:41
kUpdateConfigMethod
static NSString *const kUpdateConfigMethod
Definition: FlutterTextInputPlugin.mm:55
FlutterMethodCall::method
NSString * method
Definition: FlutterCodecs.h:233
kSetPlatformViewClientMethod
static NSString *const kSetPlatformViewClientMethod
Definition: FlutterTextInputPlugin.mm:42
kSetEditableSizeAndTransformMethod
static NSString *const kSetEditableSizeAndTransformMethod
Definition: FlutterTextInputPlugin.mm:45
kClearClientMethod
static NSString *const kClearClientMethod
Definition: FlutterTextInputPlugin.mm:44
-[FlutterTextInputPlugin API_AVAILABLE]
ios(16.0 API_AVAILABLE()
kStartLiveTextInputMethod
static NSString *const kStartLiveTextInputMethod
Definition: FlutterTextInputPlugin.mm:54
kDeprecatedSetSelectionRectsMethod
static NSString *const kDeprecatedSetSelectionRectsMethod
Definition: FlutterTextInputPlugin.mm:52
FlutterMethodCall
Definition: FlutterCodecs.h:220
FlutterResult
void(^ FlutterResult)(id _Nullable result)
Definition: FlutterChannels.h:194
kOnInteractiveKeyboardPointerMoveMethod
static NSString *const kOnInteractiveKeyboardPointerMoveMethod
Definition: FlutterTextInputPlugin.mm:56
FlutterTextInputViewAccessibilityHider
Definition: FlutterTextInputPlugin.mm:2293
viewResponder
id< FlutterViewResponder > viewResponder
Definition: FlutterTextInputPlugin.h:161
kFinishAutofillContextMethod
static NSString *const kFinishAutofillContextMethod
Definition: FlutterTextInputPlugin.mm:48
kShowMethod
static NSString *const kShowMethod
Definition: FlutterTextInputPlugin.mm:39
kHideMethod
static NSString *const kHideMethod
Definition: FlutterTextInputPlugin.mm:40
kSetMarkedTextRectMethod
static NSString *const kSetMarkedTextRectMethod
Definition: FlutterTextInputPlugin.mm:47
kSetSelectionRectsMethod
static NSString *const kSetSelectionRectsMethod
Definition: FlutterTextInputPlugin.mm:53
FlutterMethodCall::arguments
id arguments
Definition: FlutterCodecs.h:238