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

2389  :(FlutterMethodCall*)call result:(FlutterResult)result {
2390  NSString* method = call.method;
2391  id args = call.arguments;
2392  if ([method isEqualToString:kShowMethod]) {
2393  [self showTextInput];
2394  result(nil);
2395  } else if ([method isEqualToString:kHideMethod]) {
2396  [self hideTextInput];
2397  result(nil);
2398  } else if ([method isEqualToString:kSetClientMethod]) {
2399  [self setTextInputClient:[args[0] intValue] withConfiguration:args[1]];
2400  result(nil);
2401  } else if ([method isEqualToString:kSetPlatformViewClientMethod]) {
2402  // This method call has a `platformViewId` argument, but we do not need it for iOS for now.
2403  [self setPlatformViewTextInputClient];
2404  result(nil);
2405  } else if ([method isEqualToString:kSetEditingStateMethod]) {
2406  [self setTextInputEditingState:args];
2407  result(nil);
2408  } else if ([method isEqualToString:kClearClientMethod]) {
2409  [self clearTextInputClient];
2410  result(nil);
2411  } else if ([method isEqualToString:kSetEditableSizeAndTransformMethod]) {
2412  [self setEditableSizeAndTransform:args];
2413  result(nil);
2414  } else if ([method isEqualToString:kSetMarkedTextRectMethod]) {
2415  [self updateMarkedRect:args];
2416  result(nil);
2417  } else if ([method isEqualToString:kFinishAutofillContextMethod]) {
2418  [self triggerAutofillSave:[args boolValue]];
2419  result(nil);
2420  // TODO(justinmc): Remove the TextInput method constant when the framework has
2421  // finished transitioning to using the Scribble channel.
2422  // https://github.com/flutter/flutter/pull/104128
2423  } else if ([method isEqualToString:kDeprecatedSetSelectionRectsMethod]) {
2424  [self setSelectionRects:args];
2425  result(nil);
2426  } else if ([method isEqualToString:kSetSelectionRectsMethod]) {
2427  [self setSelectionRects:args];
2428  result(nil);
2429  } else if ([method isEqualToString:kStartLiveTextInputMethod]) {
2430  [self startLiveTextInput];
2431  result(nil);
2432  } else if ([method isEqualToString:kUpdateConfigMethod]) {
2433  [self updateConfig:args];
2434  result(nil);
2435  } else if ([method isEqualToString:kOnInteractiveKeyboardPointerMoveMethod]) {
2436  CGFloat pointerY = (CGFloat)[args[@"pointerY"] doubleValue];
2437  [self handlePointerMove:pointerY];
2438  result(nil);
2439  } else if ([method isEqualToString:kOnInteractiveKeyboardPointerUpMethod]) {
2440  CGFloat pointerY = (CGFloat)[args[@"pointerY"] doubleValue];
2441  [self handlePointerUp:pointerY];
2442  result(nil);
2443  } else {
2445  }
2446 }

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

2349  :(id<FlutterTextInputDelegate>)textInputDelegate {
2350  self = [super init];
2351  if (self) {
2352  // `_textInputDelegate` is a weak reference because it should retain FlutterTextInputPlugin.
2353  _textInputDelegate = textInputDelegate;
2354  _autofillContext = [[NSMutableDictionary alloc] init];
2355  _inputHider = [[FlutterTextInputViewAccessibilityHider alloc] init];
2356  _scribbleElements = [[NSMutableDictionary alloc] init];
2357  _keyboardViewContainer = [[UIView alloc] init];
2358 
2359  [[NSNotificationCenter defaultCenter] addObserver:self
2360  selector:@selector(handleKeyboardWillShow:)
2361  name:UIKeyboardWillShowNotification
2362  object:nil];
2363  }
2364 
2365  return self;
2366 }

◆ NS_UNAVAILABLE [1/2]

+ (instancetype) NS_UNAVAILABLE

◆ NS_UNAVAILABLE [2/2]

- (instancetype) NS_UNAVAILABLE

◆ resetViewResponder

- (void) resetViewResponder

Definition at line 3036 of file FlutterTextInputPlugin.mm.

3036  {
3037  _viewResponder = nil;
3038 }

◆ setUpIndirectScribbleInteraction:

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

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

Definition at line 3022 of file FlutterTextInputPlugin.mm.

3022  :(id<FlutterViewResponder>)viewResponder {
3023  if (_viewResponder != viewResponder) {
3024  if (@available(iOS 14.0, *)) {
3025  UIView* parentView = viewResponder.view;
3026  if (parentView != nil) {
3027  UIIndirectScribbleInteraction* scribbleInteraction = [[UIIndirectScribbleInteraction alloc]
3028  initWithDelegate:(id<UIIndirectScribbleInteractionDelegate>)self];
3029  [parentView addInteraction:scribbleInteraction];
3030  }
3031  }
3032  }
3033  _viewResponder = viewResponder;
3034 }

References viewResponder.

◆ showEditMenu:

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

Definition at line 2552 of file FlutterTextInputPlugin.mm.

2552  :(NSDictionary*)args API_AVAILABLE(ios(16.0)) {
2553  if (!self.activeView.isFirstResponder) {
2554  return NO;
2555  }
2556  NSDictionary<NSString*, NSNumber*>* encodedTargetRect = args[@"targetRect"];
2557  CGRect globalTargetRect = CGRectMake(
2558  [encodedTargetRect[@"x"] doubleValue], [encodedTargetRect[@"y"] doubleValue],
2559  [encodedTargetRect[@"width"] doubleValue], [encodedTargetRect[@"height"] doubleValue]);
2560  CGRect localTargetRect = [self.hostView convertRect:globalTargetRect toView:self.activeView];
2561  [self.activeView showEditMenuWithTargetRect:localTargetRect];
2562  return YES;
2563 }

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

2385  {
2386  return _activeView;
2387 }

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