dispatchFunction method
void
dispatchFunction(
- TextInputRenderViewModel viewModel,
- String functionName,
- VoltronArray array, {
- Promise? promise,
override
Implementation
@override
void dispatchFunction(TextInputRenderViewModel viewModel, String functionName, VoltronArray array,
{Promise? promise}) {
switch (functionName) {
case kFuncSetValue:
var value = array.getString(0);
if (value != null) {
int? pos = array.get<int>(1) ?? value.length;
LogUtils.i("text_input", "js set value: $value, $pos");
viewModel.dispatcher.jsSetValue(array.getString(0), pos);
}
break;
case kFuncClear:
viewModel.dispatcher.jsSetValue("", 0);
break;
case kFuncFocus:
viewModel.focus();
break;
case kFuncDismiss:
viewModel.dismiss();
break;
case kFuncBlur:
viewModel.blur();
break;
case kFuncGetValue:
if (promise != null) {
var resultMap = viewModel.dispatcher.jsGetValue();
promise.resolve(resultMap);
}
break;
}
}