Skip to content

Commit edfe024

Browse files
matthewtsmithcbracken
authored andcommitted
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`
1 parent cadf440 commit edfe024

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,13 @@ - (void)setSelectedTextRange:(UITextRange*)selectedTextRange updateEditingState:
289289
}
290290
}
291291

292+
- (id)insertDictationResultPlaceholder {
293+
return @"";
294+
}
295+
296+
- (void)removeDictationResultPlaceholder:(id)placeholder willInsertResult:(BOOL)willInsertResult {
297+
}
298+
292299
- (NSString*)textInRange:(UITextRange*)range {
293300
NSRange textRange = ((FlutterTextRange*)range).range;
294301
return [self.text substringWithRange:textRange];
@@ -297,7 +304,6 @@ - (NSString*)textInRange:(UITextRange*)range {
297304
- (void)replaceRange:(UITextRange*)range withText:(NSString*)text {
298305
NSRange replaceRange = ((FlutterTextRange*)range).range;
299306
NSRange selectedRange = _selectedTextRange.range;
300-
301307
// Adjust the text selection:
302308
// * reduce the length by the intersection length
303309
// * adjust the location by newLength - oldLength + intersectionLength

0 commit comments

Comments
 (0)