import android.content.Context;\nimport android.view.View;\nimport android.widget.EditText;\nimport io.flutter.plugin.common.MethodCall; \nimport io.flutter.plugin.common.MethodChannel;\nimport static io.flutter.plugin.common.MethodChannel.Result;\nimport io.flutter.plugin.common.BinaryMessenger;\nimport io.flutter.plugin.platform.PlatformView;\n\npublic class FlutterTextView implements PlatformView, MethodChannel.MethodCallHandler {\n private final EditText textView;\n private final MethodChannel methodChannel;\n\n FlutterTextView(Context context, BinaryMessenger messenger, int id) {\n textView = new EditText(context);\n methodChannel = new MethodChannel(messenger, "plugins.cjs.test/textview_" + id);\n methodChannel.setMethodCallHandler(this);\n }\n\n @Override\n public View getView() {\n return textView;\n }\n\n @Override\n public void onMethodCall(MethodCall methodCall, MethodChannel.Result result) {\n switch (methodCall.method) {\n case "setText":\n setText(methodCall, result);\n break;\n default:\n result.notImplemented();\n }\n\n }\n\n private void setText(MethodCall methodCall, Result result) {\n …
Run Code Online (Sandbox Code Playgroud)