apple_pencil_double_tap 0.0.1 copy "apple_pencil_double_tap: ^0.0.1" to clipboard
apple_pencil_double_tap: ^0.0.1 copied to clipboard

Flutter plugin to detect apple pencil double tap.

example/lib/main.dart

import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';

import 'package:apple_pencil_double_tap/apple_pencil_double_tap.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatefulWidget {
  const MyApp({super.key});

  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  final _applePencilDoubleTapPlugin = ApplePencilDoubleTap();

  @override
  void initState() {
    super.initState();
    initApplePencilListener();
  }

  void initApplePencilListener() {
    _applePencilDoubleTapPlugin
        .listen((PreferredDoubleTapAction preferedAction) {
      if (kDebugMode) {
        print('Double tap detected. Prefered user action: $preferedAction');
      }
    });
  }

  @override
  void dispose() {
    _applePencilDoubleTapPlugin.dispose();
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Apple pencil double tap plugin example app'),
        ),
        body: const Center(
          child: TextField(
            decoration: InputDecoration(
                hintText:
                    "Use apple pencil to write something. Double tap and check logs"),
          ),
        ),
      ),
    );
  }
}
5
likes
0
pub points
73%
popularity

Publisher

verified publishercodegrowers.tech

Flutter plugin to detect apple pencil double tap.

Homepage

License

unknown (license)

Dependencies

flutter, plugin_platform_interface

More

Packages that depend on apple_pencil_double_tap