From edfe02481a2982733de6159eae77d39a91f16b5f Mon Sep 17 00:00:00 2001 From: Matthew Smith Date: Mon, 22 Oct 2018 10:28:39 -0700 Subject: [PATCH] 13771 - iOS dictation bug (#6607) According to the iOS docs, implementing `- (id)insertDictationResultPlaceholder` ```Implementation of this method is optional but can be done when you want to provide a specific rectangle for the placeholder animation while the dictation results are being processed. ``` If you do not implement this method, UIKit will insert a default placeholder of 10 whitespace characters. By overriding this, no placeholder text will be inserted. If you implement the `insertDictationResultPlaceholder`, you must implement `- (void)removeDictationResultPlaceholder:(id)placeholder willInsertResult:(BOOL)willInsertResult` --- .../darwin/ios/framework/Source/FlutterTextInputPlugin.mm | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/shell/platform/darwin/ios/framework/Source/FlutterTextInputPlugin.mm b/shell/platform/darwin/ios/framework/Source/FlutterTextInputPlugin.mm index da6412343..f8378d5d7 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterTextInputPlugin.mm +++ b/shell/platform/darwin/ios/framework/Source/FlutterTextInputPlugin.mm @@ -289,6 +289,13 @@ static UIReturnKeyType ToUIReturnKeyType(NSString* inputType) { } } +- (id)insertDictationResultPlaceholder { + return @""; +} + +- (void)removeDictationResultPlaceholder:(id)placeholder willInsertResult:(BOOL)willInsertResult { +} + - (NSString*)textInRange:(UITextRange*)range { NSRange textRange = ((FlutterTextRange*)range).range; return [self.text substringWithRange:textRange]; @@ -297,7 +304,6 @@ static UIReturnKeyType ToUIReturnKeyType(NSString* inputType) { - (void)replaceRange:(UITextRange*)range withText:(NSString*)text { NSRange replaceRange = ((FlutterTextRange*)range).range; NSRange selectedRange = _selectedTextRange.range; - // Adjust the text selection: // * reduce the length by the intersection length // * adjust the location by newLength - oldLength + intersectionLength -- GitLab