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 2398 of file FlutterTextInputPlugin.mm.

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

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 2358 of file FlutterTextInputPlugin.mm.

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

◆ NS_UNAVAILABLE [1/2]

+ (instancetype) NS_UNAVAILABLE

◆ NS_UNAVAILABLE [2/2]

- (instancetype) NS_UNAVAILABLE

◆ resetViewResponder

- (void) resetViewResponder

Definition at line 3045 of file FlutterTextInputPlugin.mm.

3045  {
3046  _viewResponder = nil;
3047 }

◆ setUpIndirectScribbleInteraction:

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

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

Definition at line 3031 of file FlutterTextInputPlugin.mm.

3031  :(id<FlutterViewResponder>)viewResponder {
3032  if (_viewResponder != viewResponder) {
3033  if (@available(iOS 14.0, *)) {
3034  UIView* parentView = viewResponder.view;
3035  if (parentView != nil) {
3036  UIIndirectScribbleInteraction* scribbleInteraction = [[UIIndirectScribbleInteraction alloc]
3037  initWithDelegate:(id<UIIndirectScribbleInteractionDelegate>)self];
3038  [parentView addInteraction:scribbleInteraction];
3039  }
3040  }
3041  }
3042  _viewResponder = viewResponder;
3043 }

References viewResponder.

◆ showEditMenu:

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

Definition at line 2561 of file FlutterTextInputPlugin.mm.

2561  :(NSDictionary*)args API_AVAILABLE(ios(16.0)) {
2562  if (!self.activeView.isFirstResponder) {
2563  return NO;
2564  }
2565  NSDictionary<NSString*, NSNumber*>* encodedTargetRect = args[@"targetRect"];
2566  CGRect globalTargetRect = CGRectMake(
2567  [encodedTargetRect[@"x"] doubleValue], [encodedTargetRect[@"y"] doubleValue],
2568  [encodedTargetRect[@"width"] doubleValue], [encodedTargetRect[@"height"] doubleValue]);
2569  CGRect localTargetRect = [self.hostView convertRect:globalTargetRect toView:self.activeView];
2570  [self.activeView showEditMenuWithTargetRect:localTargetRect];
2571  return YES;
2572 }

◆ 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 2394 of file FlutterTextInputPlugin.mm.

2394  {
2395  return _activeView;
2396 }

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:2300
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