Flutter iOS Embedder
FlutterTextInputPlugin Class Reference

#import <FlutterTextInputPlugin.h>

Instance Methods

(instancetype) - NS_UNAVAILABLE
 
(instancetype) - initWithDelegate:
 
(void) - handleMethodCall:result:
 
(void) - reset
 
(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 2546 of file FlutterTextInputPlugin.mm.

2595  :(FlutterMethodCall*)call result:(FlutterResult)result {
2596  NSString* method = call.method;
2597  id args = call.arguments;
2598  if ([method isEqualToString:kShowMethod]) {
2599  [self showTextInput];
2600  result(nil);
2601  } else if ([method isEqualToString:kHideMethod]) {
2602  [self hideTextInput];
2603  result(nil);
2604  } else if ([method isEqualToString:kSetClientMethod]) {
2605  [self setTextInputClient:[args[0] intValue] withConfiguration:args[1]];
2606  result(nil);
2607  } else if ([method isEqualToString:kSetPlatformViewClientMethod]) {
2608  // This method call has a `platformViewId` argument, but we do not need it for iOS for now.
2609  [self setPlatformViewTextInputClient];
2610  result(nil);
2611  } else if ([method isEqualToString:kSetEditingStateMethod]) {
2612  [self setTextInputEditingState:args];
2613  result(nil);
2614  } else if ([method isEqualToString:kClearClientMethod]) {
2615  [self clearTextInputClient];
2616  result(nil);
2617  } else if ([method isEqualToString:kSetEditableSizeAndTransformMethod]) {
2618  [self setEditableSizeAndTransform:args];
2619  result(nil);
2620  } else if ([method isEqualToString:kSetMarkedTextRectMethod]) {
2621  [self updateMarkedRect:args];
2622  result(nil);
2623  } else if ([method isEqualToString:kFinishAutofillContextMethod]) {
2624  [self triggerAutofillSave:[args boolValue]];
2625  result(nil);
2626  // TODO(justinmc): Remove the TextInput method constant when the framework has
2627  // finished transitioning to using the Scribble channel.
2628  // https://github.com/flutter/flutter/pull/104128
2629  } else if ([method isEqualToString:kDeprecatedSetSelectionRectsMethod]) {
2630  [self setSelectionRects:args];
2631  result(nil);
2632  } else if ([method isEqualToString:kSetSelectionRectsMethod]) {
2633  [self setSelectionRects:args];
2634  result(nil);
2635  } else if ([method isEqualToString:kStartLiveTextInputMethod]) {
2636  [self startLiveTextInput];
2637  result(nil);
2638  } else if ([method isEqualToString:kUpdateConfigMethod]) {
2639  [self updateConfig:args];
2640  result(nil);
2641  } else if ([method isEqualToString:kOnInteractiveKeyboardPointerMoveMethod]) {
2642  CGFloat pointerY = (CGFloat)[args[@"pointerY"] doubleValue];
2643  [self handlePointerMove:pointerY];
2644  result(nil);
2645  } else if ([method isEqualToString:kOnInteractiveKeyboardPointerUpMethod]) {
2646  CGFloat pointerY = (CGFloat)[args[@"pointerY"] doubleValue];
2647  [self handlePointerUp:pointerY];
2648  result(nil);
2649  } else {
2651  }
2652 }
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

Definition at line 2546 of file FlutterTextInputPlugin.mm.

2549  :(id<FlutterTextInputDelegate>)textInputDelegate {
2550  self = [super init];
2551  if (self) {
2552  // `_textInputDelegate` is a weak reference because it should retain FlutterTextInputPlugin.
2553  _textInputDelegate = textInputDelegate;
2554  _autofillContext = [[NSMutableDictionary alloc] init];
2555  _inputHider = [[FlutterTextInputViewAccessibilityHider alloc] init];
2556  _scribbleElements = [[NSMutableDictionary alloc] init];
2557  _keyboardViewContainer = [[UIView alloc] init];
2558 
2559  [[NSNotificationCenter defaultCenter] addObserver:self
2560  selector:@selector(handleKeyboardWillShow:)
2561  name:UIKeyboardWillShowNotification
2562  object:nil];
2563  }
2564 
2565  return self;
2566 }

◆ NS_UNAVAILABLE [1/2]

+ (instancetype) NS_UNAVAILABLE

◆ NS_UNAVAILABLE [2/2]

- (instancetype) NS_UNAVAILABLE

◆ reset

- (void) reset

Reset the text input plugin to prepare for a hot restart.

This hides the software keyboard and text editing context menu.

Definition at line 2546 of file FlutterTextInputPlugin.mm.

2589  {
2590  [_autofillContext removeAllObjects];
2591  [self clearTextInputClient];
2592  [self hideTextInput];
2593 }

◆ resetViewResponder

- (void) resetViewResponder

Definition at line 2546 of file FlutterTextInputPlugin.mm.

3299  {
3300  _viewResponder = nil;
3301 }

◆ setUpIndirectScribbleInteraction:

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

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

Definition at line 2546 of file FlutterTextInputPlugin.mm.

3285  :(id<FlutterViewResponder>)viewResponder {
3286  if (_viewResponder != viewResponder) {
3287  if (@available(iOS 14.0, *)) {
3288  UIView* parentView = viewResponder.view;
3289  if (parentView != nil) {
3290  UIIndirectScribbleInteraction* scribbleInteraction = [[UIIndirectScribbleInteraction alloc]
3291  initWithDelegate:(id<UIIndirectScribbleInteractionDelegate>)self];
3292  [parentView addInteraction:scribbleInteraction];
3293  }
3294  }
3295  }
3296  _viewResponder = viewResponder;
3297 }
id< FlutterViewResponder > viewResponder

◆ showEditMenu:

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

Definition at line 2546 of file FlutterTextInputPlugin.mm.

2766  :(NSDictionary*)args API_AVAILABLE(ios(16.0)) {
2767  if (!self.activeView.isFirstResponder) {
2768  return NO;
2769  }
2770  NSDictionary<NSString*, NSNumber*>* encodedTargetRect = args[@"targetRect"];
2771  CGRect globalTargetRect = CGRectMake(
2772  [encodedTargetRect[@"x"] doubleValue], [encodedTargetRect[@"y"] doubleValue],
2773  [encodedTargetRect[@"width"] doubleValue], [encodedTargetRect[@"height"] doubleValue]);
2774  CGRect localTargetRect = [self.hostView convertRect:globalTargetRect toView:self.activeView];
2775  [self.activeView showEditMenuWithTargetRect:localTargetRect items:args[@"items"]];
2776  return YES;
2777 }

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

2585  {
2586  return _activeView;
2587 }

Member Data Documentation

◆ __pad0__

- __pad0__
protected

Definition at line 187 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: