fix a LateInitializationError (flutter/engine#26492)

This commit is contained in:
xubaolin
2021-06-04 07:44:02 +08:00
committed by GitHub
parent 0cd5eb3217
commit b925680397
2 changed files with 17 additions and 1 deletions

View File

@@ -1487,6 +1487,14 @@ class TextInputSetCaretRect extends TextInputCommand {
}
}
class TextInputRequestAutofill extends TextInputCommand {
const TextInputRequestAutofill();
void run(HybridTextEditing textEditing) {
// No-op: not supported on this platform.
}
}
class TextInputFinishAutofillContext extends TextInputCommand {
TextInputFinishAutofillContext({
required this.saveForm,
@@ -1544,7 +1552,7 @@ class TextEditingChannel {
ByteData? data, ui.PlatformMessageResponseCallback? callback) {
const JSONMethodCodec codec = JSONMethodCodec();
final MethodCall call = codec.decodeMethodCall(data);
late final TextInputCommand command;
final TextInputCommand command;
switch (call.method) {
case 'TextInput.setClient':
command = TextInputSetClient(
@@ -1595,6 +1603,7 @@ class TextEditingChannel {
// There's no API to request autofill on the web. Instead we let the
// browser show autofill options automatically, if available. We
// therefore simply ignore this message.
command = const TextInputRequestAutofill();
break;
case 'TextInput.finishAutofillContext':

View File

@@ -435,6 +435,13 @@ void testMain() {
textEditing = null;
});
test('TextInput.requestAutofill', () async {
final MethodCall requestAutofill = MethodCall('TextInput.requestAutofill');
sendFrameworkMessage(codec.encodeMethodCall(requestAutofill));
//No-op and without crashing.
});
test('setClient, show, setEditingState, hide', () {
final MethodCall setClient = MethodCall(
'TextInput.setClient', <dynamic>[123, flutterSinglelineConfig]);