| Flutter iOS Embedder |

Instance Methods | Class Methods | Protected Attributes | Properties | List of all members
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< FlutterIndirectScribbleDelegate > | indirectScribbleDelegate
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 2475 of file FlutterTextInputPlugin.mm.

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

## ◆ initWithDelegate:

- (instancetype) initWithDelegate: |  | (id<FlutterTextInputDelegate>) | NS_DESIGNATED_INITIALIZER |

Initial value:
{
NSTimer* _enableFlutterTextInputViewAccessibilityTimer

Definition at line 2475 of file FlutterTextInputPlugin.mm.

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

## ◆ NS_UNAVAILABLE [1/2]

+ (instancetype) NS_UNAVAILABLE |  |  |

## ◆ NS_UNAVAILABLE [2/2]

- (instancetype) NS_UNAVAILABLE |  |  |

## ◆ resetViewResponder

- (void) resetViewResponder |  |  |

Definition at line 2475 of file FlutterTextInputPlugin.mm.

3180 {
3181 _viewResponder = nil;
3182 }

## ◆ setUpIndirectScribbleInteraction:

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

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

Definition at line 2475 of file FlutterTextInputPlugin.mm.

3166 :(id<FlutterViewResponder>)viewResponder {
3167 if (_viewResponder != viewResponder) {
3168 if (@available(iOS 14.0, *)) {
3169 UIView* parentView = viewResponder.view;
3170 if (parentView != nil) {
3171 UIIndirectScribbleInteraction* scribbleInteraction = [[UIIndirectScribbleInteraction alloc]
3172 initWithDelegate:(id<UIIndirectScribbleInteractionDelegate>)self];
3173 [parentView addInteraction:scribbleInteraction];
3174 }
3175 }
3176 }
3177 _viewResponder = viewResponder;
3178 }
viewResponder
id< FlutterViewResponder > viewResponder
Definition: FlutterTextInputPlugin.h:161

## ◆ showEditMenu:

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

Definition at line 2475 of file FlutterTextInputPlugin.mm.

2693 :(NSDictionary*)args API_AVAILABLE(ios(16.0)) {
2694 if (!self.activeView.isFirstResponder) {
2695 return NO;
2696 }
2697 NSDictionary<NSString*, NSNumber*>* encodedTargetRect = args[@"targetRect"];
2698 CGRect globalTargetRect = CGRectMake(
2699 [encodedTargetRect[@"x"] doubleValue], [encodedTargetRect[@"y"] doubleValue],
2700 [encodedTargetRect[@"width"] doubleValue], [encodedTargetRect[@"height"] doubleValue]);
2701 CGRect localTargetRect = [self.hostView convertRect:globalTargetRect toView:self.activeView];
2702 [self.activeView showEditMenuWithTargetRect:localTargetRect items:args[@"items"]];
2703 return YES;
2704 }
-[FlutterTextInputPlugin API_AVAILABLE]
ios(16.0 API_AVAILABLE()

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

2518 {
2519 return _activeView;
2520 }

## Member Data Documentation

## ◆ __pad0__

- __pad0__
| protected

Definition at line 179 of file FlutterTextInputPlugin.h.

## Property Documentation

## ◆ indirectScribbleDelegate

- (id<FlutterIndirectScribbleDelegate>) indirectScribbleDelegate
| read write nonatomic weak

Definition at line 37 of file FlutterTextInputPlugin.h.

## ◆ scribbleElements

- (NSMutableDictionary<UIScribbleElementIdentifier, NSValue*>*) scribbleElements
| read write nonatomic strong

Definition at line 39 of file FlutterTextInputPlugin.h.

## ◆ viewController

- (UIIndirectScribbleInteractionDelegate UIViewController*) viewController
| read write nonatomic weak

Definition at line 36 of file FlutterTextInputPlugin.h.

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

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