Skip to content

The M-Trust IMP-Kit allows you to integrate the IMP-Reader with your mobile applications.

License

Notifications You must be signed in to change notification settings

emdgroup/mtrust-imp-kit

Repository files navigation

IMP-Kit

Description

Documentation Status

pub package pub points style: very good analysis

Overview

The M-Trust IMP-Kit allows you to integrate the IMP-Reader with your mobile applications.

Prerequisites

  • Flutter SDK installed on your system.
  • Basic knowledge of Flutter development.
  • Access to the M-Trust IMP-Reader hardware, or use the mtrust_virtual_strategy for development without the hardware.

Getting started

Installation

Add the mtrust_imp_kit package to your Flutter project via the pub add command

flutter pub add mtrust_imp_kit

or manually add it to your pubspec.yaml

dependencies:
  mtrust_imp_kit: ˆ1.0.0

IMP-Kit can work with different URP Connection types. The default for IMP Readers is BLE. Add the ble connection strategy to your project by including it in your pubspec.yaml file.

dependencies:
  mtrust_imp_kit: ˆ1.0.0
  # Add the BLE connection strategy
  urp_ble_strategy: ˆ8.0.1

Please follow the instructions for configuring BLE for your respective platform in the README of the urp_ble_strategy!

Usage

Fonts

IMP-Kit utilizes the Lato font and custom icons. To include these assets, update your pubspec.yaml:

fluter:
  fonts: 
    - family: Lato
      fonts:
        - asset: packages/liquid_flutter/fonts/Lato-Regular.ttf
          weight: 500
        - asset: packages/liquid_flutter/fonts/Lato-Bold.ttf
          weight: 800
    - family: LiquidIcons
      fonts:
        - asset: packages/liquid_flutter/fonts/LiquidIcons.ttf

Localization

To support multiple languages, add the necessary localization delegates to your application. For comprehensive guidance on internationalization, consult the flutter documentation.

  return const MaterialApp(
    title: 'Your awesome application',
      localizationsDelegates: [
        ...LiquidLocalizations.delegate,
        ...UrpUiLocalizations.delegate,
        ...ImpLocalizations.localizationsDelegates,
      ],
      
      home: MyHomePage(),
    );

Adding UI dependencies

To utilize IMC Kit's UI components, incorporate the following providers and portals:

  1. Theme Provider: Wrap your app with LdThemeProvider:

    LdThemeProvider(
        child: MaterialApp(
          home: MyHomePage(),
        ),
    )
  2. Portal: Enclose your Scaffold with LdPortal:

    LdPortal(
      child: Scaffold(
        ...
      ),
    )

Use the IMP Sheet

To display the IMP Sheet, utilize the ImpSheet widget. It requires a connection strategy, a payload, and callbacks for the verification process:

  ImpSheet(
    strategy: _connectionStrategy,
    payload: // Payload,
    onVerificationDone: () {},
    onVerificationFailed: () {},
    builder: (context, openSheet) {
      // Call openSheet to open the IMP Sheet
    },
  ),

Use ImpReader to build custom workflows

To build custom workflows, utilize the ImpReader class. It requires a connection strategy to handle the connection between the device and the reader.

final reader = ImpReader(
  connectionStrategy: _connectionStrategy,
);

With the ImpReader you can access all methods required to build workflows that meet your specific requirements. Please refer to the example_advanced for an example on how to build custom workflows.

Configuration Options

  • Connection Strategies: While BLE is the default, IMP-Kit supports various connection strategies. Ensure you include and configure the appropriate strategy package as needed.

Troubleshooting

  • BLE Connectivity Issues: Verify that your device's Bluetooth is enabled and that the M-Trust IMP-Reader is powered on and in range.

  • Font Rendering Problems: Ensure that the font assets are correctly referenced in your pubspec.yaml and that the files exist in the specified paths.

Contributing

We welcome contributions! Please fork the repository and submit a pull request with your changes. Ensure that your code adheres to our coding standards and includes appropriate tests.

License

This project is licensed under the Apache 2.0 License. See the LICENSE file for details.

About

The M-Trust IMP-Kit allows you to integrate the IMP-Reader with your mobile applications.

Resources

License

Stars

Watchers

Forks