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

2539  :(FlutterMethodCall*)call result:(FlutterResult)result {
2540  NSString* method = call.method;
2541  id args = call.arguments;
2542  if ([method isEqualToString:kShowMethod]) {
2543  [self showTextInput];
2544  result(nil);
2545  } else if ([method isEqualToString:kHideMethod]) {
2546  [self hideTextInput];
2547  result(nil);
2548  } else if ([method isEqualToString:kSetClientMethod]) {
2549  [self setTextInputClient:[args[0] intValue] withConfiguration:args[1]];
2550  result(nil);
2551  } else if ([method isEqualToString:kSetPlatformViewClientMethod]) {
2552  // This method call has a `platformViewId` argument, but we do not need it for iOS for now.
2553  [self setPlatformViewTextInputClient];
2554  result(nil);
2555  } else if ([method isEqualToString:kSetEditingStateMethod]) {
2556  [self setTextInputEditingState:args];
2557  result(nil);
2558  } else if ([method isEqualToString:kClearClientMethod]) {
2559  [self clearTextInputClient];
2560  result(nil);
2561  } else if ([method isEqualToString:kSetEditableSizeAndTransformMethod]) {
2562  [self setEditableSizeAndTransform:args];
2563  result(nil);
2564  } else if ([method isEqualToString:kSetMarkedTextRectMethod]) {
2565  [self updateMarkedRect:args];
2566  result(nil);
2567  } else if ([method isEqualToString:kFinishAutofillContextMethod]) {
2568  [self triggerAutofillSave:[args boolValue]];
2569  result(nil);
2570  // TODO(justinmc): Remove the TextInput method constant when the framework has
2571  // finished transitioning to using the Scribble channel.
2572  // https://github.com/flutter/flutter/pull/104128
2573  } else if ([method isEqualToString:kDeprecatedSetSelectionRectsMethod]) {
2574  [self setSelectionRects:args];
2575  result(nil);
2576  } else if ([method isEqualToString:kSetSelectionRectsMethod]) {
2577  [self setSelectionRects:args];
2578  result(nil);
2579  } else if ([method isEqualToString:kStartLiveTextInputMethod]) {
2580  [self startLiveTextInput];
2581  result(nil);
2582  } else if ([method isEqualToString:kUpdateConfigMethod]) {
2583  [self updateConfig:args];
2584  result(nil);
2585  } else if ([method isEqualToString:kOnInteractiveKeyboardPointerMoveMethod]) {
2586  CGFloat pointerY = (CGFloat)[args[@"pointerY"] doubleValue];
2587  [self handlePointerMove:pointerY];
2588  result(nil);
2589  } else if ([method isEqualToString:kOnInteractiveKeyboardPointerUpMethod]) {
2590  CGFloat pointerY = (CGFloat)[args[@"pointerY"] doubleValue];
2591  [self handlePointerUp:pointerY];
2592  result(nil);
2593  } else {
2595  }
2596 }
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 2488 of file FlutterTextInputPlugin.mm.

2495  :(id<FlutterTextInputDelegate>)textInputDelegate {
2496  self = [super init];
2497  if (self) {
2498  // `_textInputDelegate` is a weak reference because it should retain FlutterTextInputPlugin.
2499  _textInputDelegate = textInputDelegate;
2500  _autofillContext = [[NSMutableDictionary alloc] init];
2501  _inputHider = [[FlutterTextInputViewAccessibilityHider alloc] init];
2502  _scribbleElements = [[NSMutableDictionary alloc] init];
2503  _keyboardViewContainer = [[UIView alloc] init];
2504 
2505  [[NSNotificationCenter defaultCenter] addObserver:self
2506  selector:@selector(handleKeyboardWillShow:)
2507  name:UIKeyboardWillShowNotification
2508  object:nil];
2509  }
2510 
2511  return self;
2512 }

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

2535  {
2536  [self hideTextInput];
2537 }

◆ resetViewResponder

- (void) resetViewResponder

Definition at line 2488 of file FlutterTextInputPlugin.mm.

3194  {
3195  _viewResponder = nil;
3196 }

◆ setUpIndirectScribbleInteraction:

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

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

Definition at line 2488 of file FlutterTextInputPlugin.mm.

3180  :(id<FlutterViewResponder>)viewResponder {
3181  if (_viewResponder != viewResponder) {
3182  if (@available(iOS 14.0, *)) {
3183  UIView* parentView = viewResponder.view;
3184  if (parentView != nil) {
3185  UIIndirectScribbleInteraction* scribbleInteraction = [[UIIndirectScribbleInteraction alloc]
3186  initWithDelegate:(id<UIIndirectScribbleInteractionDelegate>)self];
3187  [parentView addInteraction:scribbleInteraction];
3188  }
3189  }
3190  }
3191  _viewResponder = viewResponder;
3192 }
id< FlutterViewResponder > viewResponder

◆ showEditMenu:

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

Definition at line 2488 of file FlutterTextInputPlugin.mm.

2710  :(NSDictionary*)args API_AVAILABLE(ios(16.0)) {
2711  if (!self.activeView.isFirstResponder) {
2712  return NO;
2713  }
2714  NSDictionary<NSString*, NSNumber*>* encodedTargetRect = args[@"targetRect"];
2715  CGRect globalTargetRect = CGRectMake(
2716  [encodedTargetRect[@"x"] doubleValue], [encodedTargetRect[@"y"] doubleValue],
2717  [encodedTargetRect[@"width"] doubleValue], [encodedTargetRect[@"height"] doubleValue]);
2718  CGRect localTargetRect = [self.hostView convertRect:globalTargetRect toView:self.activeView];
2719  [self.activeView showEditMenuWithTargetRect:localTargetRect items:args[@"items"]];
2720  return YES;
2721 }

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

2531  {
2532  return _activeView;
2533 }

Member Data Documentation

◆ __pad0__

- __pad0__
protected

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