BioPass ID Signature SDK Flutter
Quick Start Guide • Prerequisites • Installation • How to use • LicenseKey • SignatureConfig • Something else • Changelog • Support
Quick Start Guide
First, you will need a license key to use the biopassid_signature_sdk
. To get your license key contact us through our website BioPass ID.
Check out our official documentation for more in depth information on BioPass ID.
1. Prerequisites:
Android | iOS | |
---|---|---|
Support | SDK 23+ | iOS 15+ |
- License key
- Internet connection is required to verify the license
2. Installation
First, add biopassid_signature_sdk
as a dependency in your pubspec.yaml file.
Android
Change the minimum Android sdk version to 23 (or higher) in your android/app/build.gradle
file.
minSdkVersion 23
iOS
Requires iOS 15.0 or higher.
Then go into your project's ios folder and run pod install.
# Go into ios folder
$ cd ios
# Install dependencies
$ pod install
Privacy manifest file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>NSPrivacyCollectedDataTypes</key>
<array>
<dict>
<key>NSPrivacyCollectedDataType</key>
<string>NSPrivacyCollectedDataTypeOtherUserContent</string>
<key>NSPrivacyCollectedDataTypeLinked</key>
<false/>
<key>NSPrivacyCollectedDataTypeTracking</key>
<false/>
<key>NSPrivacyCollectedDataTypePurposes</key>
<array>
<string>NSPrivacyCollectedDataTypePurposeAppFunctionality</string>
</array>
</dict>
<dict>
<key>NSPrivacyCollectedDataType</key>
<string>NSPrivacyCollectedDataTypeDeviceID</string>
<key>NSPrivacyCollectedDataTypeLinked</key>
<false/>
<key>NSPrivacyCollectedDataTypeTracking</key>
<false/>
<key>NSPrivacyCollectedDataTypePurposes</key>
<array>
<string>NSPrivacyCollectedDataTypePurposeAppFunctionality</string>
</array>
</dict>
</array>
<key>NSPrivacyTracking</key>
<false/>
<key>NSPrivacyAccessedAPITypes</key>
<array>
<dict>
<key>NSPrivacyAccessedAPITypeReasons</key>
<array>
<string>CA92.1</string>
</array>
<key>NSPrivacyAccessedAPIType</key>
<string>NSPrivacyAccessedAPICategoryUserDefaults</string>
</dict>
</array>
</dict>
</plist>
3. How to use
To call Signature in your Flutter project is as easy as follow:
import 'package:flutter/material.dart';
import 'package:biopassid_signature_sdk/biopassid_signature_sdk.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Signature Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: const MyHomePage(),
);
}
}
class MyHomePage extends StatefulWidget {
const MyHomePage({super.key});
@override
State<MyHomePage> createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
late SignatureController controller;
@override
void initState() {
super.initState();
final config = SignatureConfig(licenseKey: 'your-license-key');
controller = SignatureController(config);
}
void takeSignature() async {
final signature = await controller.takeSignature();
print('Signature: ${signature[0]}');
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('Signature Demo'),
),
body: Center(
child: ElevatedButton(
onPressed: takeSignature,
child: const Text('Capture Signature'),
),
),
);
}
}
4. LicenseKey
First, you will need a license key to use the biopassid_signature_sdk
. To get your license key contact us through our website BioPass ID.
To use biopassid_signature_sdk
you need a license key. To set the license key needed is simple as setting another attribute. Simply doing:
final config = SignatureConfig(licenseKey: 'your-license-key');
SignatureConfig
You can also use pre-build configurations on your application, so you can automatically start using multiples features that better suit your application. You can instantiate each one and use it's default properties, or if you prefer you can change every config available. Here are the types that are supported right now:
SignatureConfig
Name | Type | Default value |
---|---|---|
licenseKey | String | '' |
screenOrientation // Android only | SignatureScreenOrientation | SignatureScreenOrientation.portrait |
pencilColor | Color | Color(0xFF000000) |
pencilWidth | int | 5 |
backgroundColor | Color | Color(0xFFFFFFFF) |
overlayColor | Color | Color(0x80000000) |
fontFamily | String | 'opensans_bold' |
titleText | SignatureTextOptions | |
backButton | SignatureButtonOptions | |
saveButton | SignatureButtonOptions | |
deleteButton | SignatureButtonOptions | |
undoButton | SignatureButtonOptions |
Default configs:
final defaultConfig = SignatureConfig(
licenseKey: '',
screenOrientation: SignatureScreenOrientation.portrait, // Android only
pencilColor: const Color(0xFF000000),
pencilWidth: 5,
backgroundColor: const Color(0xFFFFFFFF),
overlayColor: const Color(0x80000000),
fontFamily: 'signaturesdk_opensans_bold',
titleText: SignatureTextOptions(
enabled: true,
content: 'Captura de assinatura digital',
textColor: const Color(0xFFFFFFFF),
textSize: 20,
),
backButton: SignatureButtonOptions(
enabled: true,
backgroundColor: const Color(0x00000000),
buttonPadding: 0,
buttonSize: const Size(56, 56),
iconOptions: SignatureIconOptions(
enabled: true,
iconFile: 'signaturesdk_ic_close',
iconColor: const Color(0xFFFFFFFF),
iconSize: const Size(32, 32),
),
labelOptions: SignatureTextOptions(
enabled: false,
content: 'Voltar',
textColor: const Color(0xFFFFFFFF),
textSize: 14,
),
),
saveButton: SignatureButtonOptions(
enabled: true,
backgroundColor: const Color(0xFFFFFFFF),
buttonPadding: 0,
buttonSize: const Size(56, 56),
iconOptions: SignatureIconOptions(
enabled: true,
iconFile: 'signaturesdk_ic_save',
iconColor: const Color(0xFFFFFFFF),
iconSize: const Size(32, 32),
),
labelOptions: SignatureTextOptions(
enabled: false,
content: 'Salvar',
textColor: const Color(0xFFFFFFFF),
textSize: 14,
),
),
deleteButton: SignatureButtonOptions(
enabled: true,
backgroundColor: const Color(0xFFFFFFFF),
buttonPadding: 0,
buttonSize: const Size(56, 56),
iconOptions: SignatureIconOptions(
enabled: true,
iconFile: 'signaturesdk_ic_delete',
iconColor: const Color(0xFFFFFFFF),
iconSize: const Size(32, 32),
),
labelOptions: SignatureTextOptions(
enabled: false,
content: 'Deletar',
textColor: const Color(0xFFFFFFFF),
textSize: 14,
),
),
undoButton: SignatureButtonOptions(
enabled: true,
backgroundColor: const Color(0xFFFFFFFF),
buttonPadding: 0,
buttonSize: const Size(56, 56),
iconOptions: SignatureIconOptions(
enabled: true,
iconFile: 'signaturesdk_ic_undo',
iconColor: const Color(0xFFFFFFFF),
iconSize: const Size(32, 32),
),
labelOptions: SignatureTextOptions(
enabled: false,
content: 'Desfazer',
textColor: const Color(0xFFFFFFFF),
textSize: 14,
),
),
);
SignatureButtonOptions
Name | Type | Default value |
---|---|---|
enabled | bool | true |
backgroundColor | Color | Color(0xFFFFFFFF) |
buttonPadding | int | 0 |
buttonSize | Size | Size(56, 56) |
iconOptions | SignatureIconOptions | |
labelOptions | SignatureTextOptions |
SignatureIconOptions
Name | Type | Default value |
---|---|---|
enabled | bool | true |
iconFile | String | 'ic_close' |
iconColor | Color | Color(0xFF323232) |
iconSize | Size | Size(32, 32) |
SignatureTextOptions
Name | Type | Default value |
---|---|---|
enabled | bool | true |
content | String | '' |
textColor | Color | Color(0xFF323232) |
textSize | int | 14 |
SignatureScreenOrientation (enum)
Name |
---|
SignatureScreenOrientation.portrait |
SignatureScreenOrientation.landscape |
How to change font family
on Android side
You can use the default font family or set one of your own. To set a font family, create a folder font under res directory in your android/app/src/main/res
. Download the font which ever you want and paste it inside font folder. All font file names must be only: lowercase a-z, 0-9, or underscore. The structure should be some thing like below.
on iOS side
To add the font files to your Xcode project:
- In Xcode, select the Project navigator.
- Drag your fonts from a Finder window into your project. This copies the fonts to your project.
- Select the font or folder with the fonts, and verify that the files show their target membership checked for your app’s targets.
Then, add the "Fonts provided by application" key to your app’s Info.plist file. For the key’s value, provide an array of strings containing the relative paths to any added font files.
In the following example, the font file is inside the fonts directory, so you use fonts/roboto_mono_bold_italic.ttf as the string value in the Info.plist file.
on Dart side
Finally, just set the font family passing the name of the font file when instantiating SignatureConfig in your Flutter app.
final config = SignatureConfig(
licenseKey: 'your-license-key',
fontFamily: 'roboto_mono_bold_italic',
);
How to change icon
on Android side
You can use the default icons or define one of your own. To set a icon, download the icon which ever you want and paste it inside drawable folder in your android/app/src/main/res
. All icon file names must be only: lowercase a-z, 0-9, or underscore. The structure should be some thing like below.
on iOS side
To add icon files to your Xcode project:
- In the Project navigator, select an asset catalog: a file with a .xcassets file extension.
- Drag an image from the Finder to the outline view. A new image set appears in the outline view, and the image asset appears in a well in the detail area.
on Dart side
Finally, just set the icon passing the name of the icon file when instantiating SignatureConfig in your Flutter app.
final config = SignatureConfig(licenseKey: 'your-license-key');
// Changing back button icon
config.backButton.iconOptions.iconFile = 'ic_baseline_camera';
// Changing save button icon
config.saveButton.iconOptions.iconFile = 'ic_baseline_camera';
// Changing delete button icon
config.deleteButton.iconOptions.iconFile = 'ic_baseline_camera';
// Changing undo button icon
config.undoButton.iconOptions.iconFile = 'ic_baseline_camera';
Something else
Do you like the Signature SDK and would you like to know about our other products? We have solutions for face and fingerprint detection.
- Face SDK
- Fingerprint SDK
- Signature SDK
Changelog
v0.1.5
- Documentation update;
- Upgrade minSdkVersion to 23 on Android;
- Upgrade to Kotlin 1.9.10 on Android;
- Added privacy manifest file on iOS.
v0.1.4
- Documentation update;
- Removed noDrawingAlert from SignatureConfig.
v0.1.3
- Documentation update.
v0.1.2
- Documentation update;
- Added new configuration noDrawingAlert:
- It's now possible to show an alert dialog when trying to save a blank signature.
- Bug fix in license functionality for Android;
- Added guidance to screen rotation for iOS.
v0.1.1
- Documentation update;
- Fixes and improvements.
v0.1.0
- Add documentation;
- Signature capture functionality;
- Customizable UI;
- Return of captured signature image.