Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit b120180

Browse files
authored
iPhone floating cursor selection (#36643)
Floating cursor selection hasn't worked as we haven't been returning a real value for `caretRectForPosition:`. If we have the selection rectangles, we can do so. Fixes [#30476](flutter/flutter#30476) Requires selection rects to be turned on for iPhone (flutter/flutter#113048) writing and running engine tests.
1 parent 8a559ea commit b120180

File tree

3 files changed

+431
-140
lines changed

3 files changed

+431
-140
lines changed

shell/platform/darwin/ios/framework/Source/FlutterTextInputPlugin.h

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,11 @@ typedef NS_ENUM(NSInteger, FlutterScribbleInteractionStatus) {
6363
@interface FlutterTextPosition : UITextPosition
6464

6565
@property(nonatomic, readonly) NSUInteger index;
66+
@property(nonatomic, readonly) UITextStorageDirection affinity;
6667

6768
+ (instancetype)positionWithIndex:(NSUInteger)index;
68-
- (instancetype)initWithIndex:(NSUInteger)index;
69+
+ (instancetype)positionWithIndex:(NSUInteger)index affinity:(UITextStorageDirection)affinity;
70+
- (instancetype)initWithIndex:(NSUInteger)index affinity:(UITextStorageDirection)affinity;
6971

7072
@end
7173

@@ -100,6 +102,10 @@ typedef NS_ENUM(NSInteger, FlutterScribbleInteractionStatus) {
100102

101103
+ (instancetype)selectionRectWithRect:(CGRect)rect position:(NSUInteger)position;
102104

105+
+ (instancetype)selectionRectWithRect:(CGRect)rect
106+
position:(NSUInteger)position
107+
writingDirection:(NSWritingDirection)writingDirection;
108+
103109
- (instancetype)initWithRectAndInfo:(CGRect)rect
104110
position:(NSUInteger)position
105111
writingDirection:(NSWritingDirection)writingDirection
@@ -108,6 +114,8 @@ typedef NS_ENUM(NSInteger, FlutterScribbleInteractionStatus) {
108114
isVertical:(BOOL)isVertical;
109115

110116
- (instancetype)init NS_UNAVAILABLE;
117+
118+
- (BOOL)isRTL;
111119
@end
112120

113121
API_AVAILABLE(ios(13.0)) @interface FlutterTextPlaceholder : UITextPlaceholder

0 commit comments

Comments
 (0)