Flutter Engine
FlutterTextInputPlugin.mm File Reference
#import "flutter/shell/platform/darwin/macos/framework/Source/FlutterTextInputPlugin.h"
#import <objc/message.h>
#include <algorithm>
#include <memory>
#include "flutter/shell/platform/common/text_input_model.h"
#import "flutter/shell/platform/darwin/common/framework/Headers/FlutterCodecs.h"
#import "flutter/shell/platform/darwin/macos/framework/Headers/FlutterAppDelegate.h"
#import "flutter/shell/platform/darwin/macos/framework/Source/FlutterTextInputSemanticsObject.h"
#import "flutter/shell/platform/darwin/macos/framework/Source/FlutterViewController_Internal.h"

Go to the source code of this file.

Functions

typedef NS_ENUM (NSUInteger, FlutterTextAffinity)
 
static flutter::TextRange RangeFromBaseExtent (NSNumber *base, NSNumber *extent, const flutter::TextRange &range)
 

Variables

static NSString *const kTextInputChannel = @"@"flutter/textinput"
 
static NSString *const kSetClientMethod = @"@"TextInput.setClient"
 
static NSString *const kShowMethod = @"@"TextInput.show"
 
static NSString *const kHideMethod = @"@"TextInput.hide"
 
static NSString *const kClearClientMethod = @"@"TextInput.clearClient"
 
static NSString *const kSetEditingStateMethod = @"@"TextInput.setEditingState"
 
static NSString *const kSetEditableSizeAndTransform = @"@"TextInput.setEditableSizeAndTransform"
 
static NSString *const kSetCaretRect = @"@"TextInput.setCaretRect"
 
static NSString *const kUpdateEditStateResponseMethod = @"@"TextInputClient.updateEditingState"
 
static NSString *const kPerformAction = @"@"TextInputClient.performAction"
 
static NSString *const kMultilineInputType = @"@"TextInputType.multiline"
 
static NSString *const kTextAffinityDownstream = @"@"TextAffinity.downstream"
 
static NSString *const kTextAffinityUpstream = @"@"TextAffinity.upstream"
 
static NSString *const kTextInputAction = @"@"inputAction"
 
static NSString *const kTextInputType = @"@"inputType"
 
static NSString *const kTextInputTypeName = @"@"name"
 
static NSString *const kSelectionBaseKey = @"@"selectionBase"
 
static NSString *const kSelectionExtentKey = @"@"selectionExtent"
 
static NSString *const kSelectionAffinityKey = @"@"selectionAffinity"
 
static NSString *const kSelectionIsDirectionalKey = @"@"selectionIsDirectional"
 
static NSString *const kComposingBaseKey = @"@"composingBase"
 
static NSString *const kComposingExtentKey = @"@"composingExtent"
 
static NSString *const kTextKey = @"@"text"
 
static NSString *const kTransformKey = @"@"transform"
 
CATransform3D _editableTransform
 
CGRect _caretRect
 

Function Documentation

◆ NS_ENUM()

typedef NS_ENUM ( NSUInteger  ,
FlutterTextAffinity   
)

The affinity of the current cursor position. If the cursor is at a position representing a line break, the cursor may be drawn either at the end of the current line (upstream) or at the beginning of the next (downstream).

Definition at line 53 of file FlutterTextInputPlugin.mm.

53  {
54  FlutterTextAffinityUpstream,
55  FlutterTextAffinityDownstream
56 };

◆ RangeFromBaseExtent()

static flutter::TextRange RangeFromBaseExtent ( NSNumber *  base,
NSNumber *  extent,
const flutter::TextRange range 
)
static

Definition at line 61 of file FlutterTextInputPlugin.mm.

Referenced by FlutterTextInputPlugin::isFirstResponder.

63  {
64  if (base == nil || extent == nil) {
65  return range;
66  }
67  if (base.intValue == -1 && extent.intValue == -1) {
68  return flutter::TextRange(0, 0);
69  }
70  return flutter::TextRange([base unsignedLongValue], [extent unsignedLongValue]);
71 }

Variable Documentation

◆ _caretRect

CGRect _caretRect

Current position of caret in local (editable) coordinates.

Definition at line 168 of file FlutterTextInputPlugin.mm.

Referenced by FlutterTextInputPlugin::initWithViewController:, and FlutterTextInputPlugin::isFirstResponder.

◆ _editableTransform

CATransform3D _editableTransform
Initial value:
{
std::unique_ptr<flutter::TextInputModel> _activeModel

Transform for current the editable. Used to determine position of accent selection menu.

Definition at line 154 of file FlutterTextInputPlugin.mm.

Referenced by FlutterTextInputPlugin::initWithViewController:, and FlutterTextInputPlugin::isFirstResponder.

◆ kClearClientMethod

NSString* const kClearClientMethod = @"@"TextInput.clearClient"
static

Definition at line 24 of file FlutterTextInputPlugin.mm.

Referenced by FlutterTextInputPlugin::isFirstResponder.

◆ kComposingBaseKey

NSString* const kComposingBaseKey = @"@"composingBase"
static

Definition at line 43 of file FlutterTextInputPlugin.mm.

Referenced by FlutterTextInputPlugin::isFirstResponder.

◆ kComposingExtentKey

NSString* const kComposingExtentKey = @"@"composingExtent"
static

Definition at line 44 of file FlutterTextInputPlugin.mm.

Referenced by FlutterTextInputPlugin::isFirstResponder.

◆ kHideMethod

NSString* const kHideMethod = @"@"TextInput.hide"
static

Definition at line 23 of file FlutterTextInputPlugin.mm.

Referenced by FlutterTextInputPlugin::isFirstResponder.

◆ kMultilineInputType

NSString* const kMultilineInputType = @"@"TextInputType.multiline"
static

Definition at line 30 of file FlutterTextInputPlugin.mm.

Referenced by FlutterTextInputPlugin::isFirstResponder.

◆ kPerformAction

NSString* const kPerformAction = @"@"TextInputClient.performAction"
static

Definition at line 29 of file FlutterTextInputPlugin.mm.

◆ kSelectionAffinityKey

NSString* const kSelectionAffinityKey = @"@"selectionAffinity"
static

Definition at line 41 of file FlutterTextInputPlugin.mm.

Referenced by FlutterTextInputPlugin::isFirstResponder.

◆ kSelectionBaseKey

NSString* const kSelectionBaseKey = @"@"selectionBase"
static

Definition at line 39 of file FlutterTextInputPlugin.mm.

Referenced by FlutterTextInputPlugin::isFirstResponder.

◆ kSelectionExtentKey

NSString* const kSelectionExtentKey = @"@"selectionExtent"
static

Definition at line 40 of file FlutterTextInputPlugin.mm.

Referenced by FlutterTextInputPlugin::isFirstResponder.

◆ kSelectionIsDirectionalKey

NSString* const kSelectionIsDirectionalKey = @"@"selectionIsDirectional"
static

Definition at line 42 of file FlutterTextInputPlugin.mm.

Referenced by FlutterTextInputPlugin::isFirstResponder.

◆ kSetCaretRect

NSString* const kSetCaretRect = @"@"TextInput.setCaretRect"
static

Definition at line 27 of file FlutterTextInputPlugin.mm.

Referenced by FlutterTextInputPlugin::isFirstResponder.

◆ kSetClientMethod

NSString* const kSetClientMethod = @"@"TextInput.setClient"
static

Definition at line 21 of file FlutterTextInputPlugin.mm.

Referenced by FlutterTextInputPlugin::isFirstResponder.

◆ kSetEditableSizeAndTransform

NSString* const kSetEditableSizeAndTransform = @"@"TextInput.setEditableSizeAndTransform"
static

Definition at line 26 of file FlutterTextInputPlugin.mm.

Referenced by FlutterTextInputPlugin::isFirstResponder.

◆ kSetEditingStateMethod

NSString* const kSetEditingStateMethod = @"@"TextInput.setEditingState"
static

Definition at line 25 of file FlutterTextInputPlugin.mm.

Referenced by FlutterTextInputPlugin::isFirstResponder.

◆ kShowMethod

NSString* const kShowMethod = @"@"TextInput.show"
static

Definition at line 22 of file FlutterTextInputPlugin.mm.

Referenced by FlutterTextInputPlugin::isFirstResponder.

◆ kTextAffinityDownstream

NSString* const kTextAffinityDownstream = @"@"TextAffinity.downstream"
static

Definition at line 32 of file FlutterTextInputPlugin.mm.

Referenced by FlutterTextInputPlugin::isFirstResponder.

◆ kTextAffinityUpstream

NSString* const kTextAffinityUpstream = @"@"TextAffinity.upstream"
static

Definition at line 33 of file FlutterTextInputPlugin.mm.

Referenced by FlutterTextInputPlugin::isFirstResponder.

◆ kTextInputAction

NSString* const kTextInputAction = @"@"inputAction"
static

Definition at line 35 of file FlutterTextInputPlugin.mm.

◆ kTextInputChannel

NSString* const kTextInputChannel = @"@"flutter/textinput"
static

Definition at line 18 of file FlutterTextInputPlugin.mm.

◆ kTextInputType

NSString* const kTextInputType = @"@"inputType"
static

Definition at line 36 of file FlutterTextInputPlugin.mm.

◆ kTextInputTypeName

NSString* const kTextInputTypeName = @"@"name"
static

Definition at line 37 of file FlutterTextInputPlugin.mm.

◆ kTextKey

NSString* const kTextKey = @"@"text"
static

Definition at line 45 of file FlutterTextInputPlugin.mm.

Referenced by FlutterTextInputPlugin::isFirstResponder.

◆ kTransformKey

NSString* const kTransformKey = @"@"transform"
static

Definition at line 46 of file FlutterTextInputPlugin.mm.

◆ kUpdateEditStateResponseMethod

NSString* const kUpdateEditStateResponseMethod = @"@"TextInputClient.updateEditingState"
static

Definition at line 28 of file FlutterTextInputPlugin.mm.