onyxsdk_pen 1.0.2 copy "onyxsdk_pen: ^1.0.2" to clipboard
onyxsdk_pen: ^1.0.2 copied to clipboard

This plugin integrates the Onyx Pen SDK into Flutter.

onyxsdk_pen #

This plugin integrates the Onyx Pen SDK into Flutter.

Most of the SDK functionality is omitted due to it being restricted to Onyx devices. We instead only provide the OnyxSdkPenArea widget. The children of this widget (typically including a CustomPaint and GestureDetector) will automatically gain fluid pen strokes.

You are responsible for taking user input and drawing it. The OnyxSdkPenArea widget will just make things faster on Onyx devices.

When used on devices that aren't Onyx Android devices, the OnyxSdkPenArea widget will just return its child.

Getting Started #

Android #

See this commit for an example of the following setup...

android/app/build.gradle

android {
    defaultConfig {
        // Onyx SDK requires 23 or higher
        minSdkVersion 23
    }

    packagingOptions {
        pickFirst 'lib/*/libc++_shared.so'
        pickFirst 'androidsupportmultidexversion.txt'
    }
}

android/app/src/main/AndroidManifest.xml

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    package="com.adilhanney.saber">

    <!-- Add this `tools:replace` attribute to the `application` tag -->
    <application
        tools:replace="android:label">

    </application>
</manifest>

In my case, I got a compiler error saying that I needed tools:replace="android:allowBackup" so I merged the two with tools:replace="android:label,android:allowBackup".

android/build.gradle

allprojects {
    repositories {
        google()
        mavenCentral()

        // Add these two lines
        maven {
            url "https://jitpack.io"
        }
        maven {
            url "http://repo.boox.com/repository/maven-public/"
            allowInsecureProtocol true
        }
    }
}

pubspec.yaml

dependencies:
  onyxsdk_pen: ^1.0.2

lib/main.dart

// Wrap your drawable widget with the OnyxSdkPenArea widget, e.g.
OnyxSdkPenArea(
  child: GestureDetector(
    onPanUpdate: (details) {},
    child: CustomPaint(
      painter: MyPainter(points),
    ),
  ),
),