listen method

  1. @override
void listen(
  1. dynamic callback(
    1. PreferredDoubleTapAction
    )
)
override

Implementation

@override
void listen(Function(PreferredDoubleTapAction) callback) {
  methodChannel.setMethodCallHandler((call) async {
    if (call.method == 'onPencilDoubleTap') {
      switch (call.arguments?.toString()) {
        case 'switchPrevious':
          callback(PreferredDoubleTapAction.switchPrevious);
        case 'showColorPalette':
          callback(PreferredDoubleTapAction.showColorPalette);
        case 'showInkAttributes':
          callback(PreferredDoubleTapAction.showInkAttributes);
        case 'ignore':
          callback(PreferredDoubleTapAction.ignore);
        case 'switchEraser':
          callback(PreferredDoubleTapAction.switchEraser);
        default:
          callback(PreferredDoubleTapAction.none);
      }
    }
  });
}