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 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 {
2578  }
2579 }
void(^ FlutterResult)(id _Nullable result)
FLUTTER_DARWIN_EXPORT NSObject const * FlutterMethodNotImplemented
static NSString *const kSetMarkedTextRectMethod
static NSString *const kFinishAutofillContextMethod
static NSString *const kShowMethod
static NSString *const kUpdateConfigMethod
static NSString *const kSetSelectionRectsMethod
static NSString *const kSetPlatformViewClientMethod
static NSString *const kSetEditingStateMethod
static NSString *const kOnInteractiveKeyboardPointerUpMethod
static NSString *const kClearClientMethod
static NSString *const kSetClientMethod
static NSString *const kStartLiveTextInputMethod
static NSString *const kDeprecatedSetSelectionRectsMethod
static NSString *const kHideMethod
static NSString *const kSetEditableSizeAndTransformMethod
static NSString *const kOnInteractiveKeyboardPointerMoveMethod

◆ 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 }

◆ 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 }
id< FlutterViewResponder > viewResponder

◆ 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 }

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