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

2521  :(FlutterMethodCall*)call result:(FlutterResult)result {
2522  NSString* method = call.method;
2523  id args = call.arguments;
2524  if ([method isEqualToString:kShowMethod]) {
2525  [self showTextInput];
2526  result(nil);
2527  } else if ([method isEqualToString:kHideMethod]) {
2528  [self hideTextInput];
2529  result(nil);
2530  } else if ([method isEqualToString:kSetClientMethod]) {
2531  [self setTextInputClient:[args[0] intValue] withConfiguration:args[1]];
2532  result(nil);
2533  } else if ([method isEqualToString:kSetPlatformViewClientMethod]) {
2534  // This method call has a `platformViewId` argument, but we do not need it for iOS for now.
2535  [self setPlatformViewTextInputClient];
2536  result(nil);
2537  } else if ([method isEqualToString:kSetEditingStateMethod]) {
2538  [self setTextInputEditingState:args];
2539  result(nil);
2540  } else if ([method isEqualToString:kClearClientMethod]) {
2541  [self clearTextInputClient];
2542  result(nil);
2543  } else if ([method isEqualToString:kSetEditableSizeAndTransformMethod]) {
2544  [self setEditableSizeAndTransform:args];
2545  result(nil);
2546  } else if ([method isEqualToString:kSetMarkedTextRectMethod]) {
2547  [self updateMarkedRect:args];
2548  result(nil);
2549  } else if ([method isEqualToString:kFinishAutofillContextMethod]) {
2550  [self triggerAutofillSave:[args boolValue]];
2551  result(nil);
2552  // TODO(justinmc): Remove the TextInput method constant when the framework has
2553  // finished transitioning to using the Scribble channel.
2554  // https://github.com/flutter/flutter/pull/104128
2555  } else if ([method isEqualToString:kDeprecatedSetSelectionRectsMethod]) {
2556  [self setSelectionRects:args];
2557  result(nil);
2558  } else if ([method isEqualToString:kSetSelectionRectsMethod]) {
2559  [self setSelectionRects:args];
2560  result(nil);
2561  } else if ([method isEqualToString:kStartLiveTextInputMethod]) {
2562  [self startLiveTextInput];
2563  result(nil);
2564  } else if ([method isEqualToString:kUpdateConfigMethod]) {
2565  [self updateConfig:args];
2566  result(nil);
2567  } else if ([method isEqualToString:kOnInteractiveKeyboardPointerMoveMethod]) {
2568  CGFloat pointerY = (CGFloat)[args[@"pointerY"] doubleValue];
2569  [self handlePointerMove:pointerY];
2570  result(nil);
2571  } else if ([method isEqualToString:kOnInteractiveKeyboardPointerUpMethod]) {
2572  CGFloat pointerY = (CGFloat)[args[@"pointerY"] doubleValue];
2573  [self handlePointerUp:pointerY];
2574  result(nil);
2575  } else {
2577  }
2578 }

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

2481  :(id<FlutterTextInputDelegate>)textInputDelegate {
2482  self = [super init];
2483  if (self) {
2484  // `_textInputDelegate` is a weak reference because it should retain FlutterTextInputPlugin.
2485  _textInputDelegate = textInputDelegate;
2486  _autofillContext = [[NSMutableDictionary alloc] init];
2487  _inputHider = [[FlutterTextInputViewAccessibilityHider alloc] init];
2488  _scribbleElements = [[NSMutableDictionary alloc] init];
2489  _keyboardViewContainer = [[UIView alloc] init];
2490 
2491  [[NSNotificationCenter defaultCenter] addObserver:self
2492  selector:@selector(handleKeyboardWillShow:)
2493  name:UIKeyboardWillShowNotification
2494  object:nil];
2495  }
2496 
2497  return self;
2498 }

◆ NS_UNAVAILABLE [1/2]

+ (instancetype) NS_UNAVAILABLE

◆ NS_UNAVAILABLE [2/2]

- (instancetype) NS_UNAVAILABLE

◆ resetViewResponder

- (void) resetViewResponder

Definition at line 3171 of file FlutterTextInputPlugin.mm.

3171  {
3172  _viewResponder = nil;
3173 }

◆ setUpIndirectScribbleInteraction:

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

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

Definition at line 3157 of file FlutterTextInputPlugin.mm.

3157  :(id<FlutterViewResponder>)viewResponder {
3158  if (_viewResponder != viewResponder) {
3159  if (@available(iOS 14.0, *)) {
3160  UIView* parentView = viewResponder.view;
3161  if (parentView != nil) {
3162  UIIndirectScribbleInteraction* scribbleInteraction = [[UIIndirectScribbleInteraction alloc]
3163  initWithDelegate:(id<UIIndirectScribbleInteractionDelegate>)self];
3164  [parentView addInteraction:scribbleInteraction];
3165  }
3166  }
3167  }
3168  _viewResponder = viewResponder;
3169 }

References viewResponder.

◆ showEditMenu:

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

Definition at line 2684 of file FlutterTextInputPlugin.mm.

2684  :(NSDictionary*)args API_AVAILABLE(ios(16.0)) {
2685  if (!self.activeView.isFirstResponder) {
2686  return NO;
2687  }
2688  NSDictionary<NSString*, NSNumber*>* encodedTargetRect = args[@"targetRect"];
2689  CGRect globalTargetRect = CGRectMake(
2690  [encodedTargetRect[@"x"] doubleValue], [encodedTargetRect[@"y"] doubleValue],
2691  [encodedTargetRect[@"width"] doubleValue], [encodedTargetRect[@"height"] doubleValue]);
2692  CGRect localTargetRect = [self.hostView convertRect:globalTargetRect toView:self.activeView];
2693  [self.activeView showEditMenuWithTargetRect:localTargetRect items:args[@"items"]];
2694  return YES;
2695 }

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

2517  {
2518  return _activeView;
2519 }

Referenced by FlutterPlatformPlugin::showShareViewController:.

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