paste method

  1. @override
Future<void> paste(
  1. ZefyrController controller,
  2. TextEditingValue textEditingValue
)
override

Implementation

@override
Future<void> paste(
    ZefyrController controller, TextEditingValue textEditingValue) async {
  final data = await Clipboard.getData(Clipboard.kTextPlain);
  if (data != null) {
    final length = controller.selection.end - controller.selection.start;
    controller.replaceText(
      controller.selection.start,
      length,
      data.text,
      selection: TextSelection.collapsed(
          offset: controller.selection.start + data.text!.length),
    );
  }
}