mtrust_imp_kit 1.0.0-1 copy "mtrust_imp_kit: ^1.0.0-1" to clipboard
mtrust_imp_kit: ^1.0.0-1 copied to clipboard

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

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:liquid_flutter/liquid_flutter.dart';
import 'package:mtrust_imp_kit/mtrust_imp_kit.dart';
import 'package:mtrust_urp_ble_strategy/mtrust_urp_ble_strategy.dart';

void main() {
  WidgetsFlutterBinding.ensureInitialized();
  runApp(MainApp());
}

class MainApp extends StatelessWidget {
  MainApp({super.key});

  final UrpBleStrategy _bleStrategy = UrpBleStrategy();

  // Will be called if a identifcation was successful. Add the logic here to
  // control what should happen after a successful identification.
  void onIdentificationDone(UrpImpMeasurement content) {
    // ignore: avoid_print
    print("Measurement successful: ${content.toDebugString()}");
  }

  // Will be called if a identifcation failed. Add the logic here to control
  // what should happen after a failed identification.
  void onIdentificationFailed() {
    // ignore: avoid_print
    print("Measurement failed.");
  }

  @override
  Widget build(BuildContext context) {
    return LdThemeProvider(
      child: LdThemedAppBuilder(
        appBuilder: (context, theme) => MaterialApp(
          theme: theme,
          localizationsDelegates: const [
            DefaultMaterialLocalizations.delegate,
            DefaultWidgetsLocalizations.delegate,
            ImpLocalizations.delegate,
            UrpUiLocalizations.delegate,
            LiquidLocalizations.delegate,
          ],

          debugShowCheckedModeBanner:
              false, //Disable debug banner (top right) in debug mode
          home: LdPortal(
            child: Scaffold(
                appBar: LdAppBar(
                  context: context,
                  title: const Text('IMP Example Application'),
                ),
                body: ImpSheet(
                  strategy: _bleStrategy,
                  onIdentificationDone: (content) {
                    onIdentificationDone(content);
                  },
                  onIdentificationFailed: () {},
                  builder: (BuildContext context, Function openSheet) {
                    return Center(
                      child: Column(
                        mainAxisSize: MainAxisSize.min,
                        children: [
                          /* const SizedBox(
                            height: 120,
                            child: ScanningInstruction(),
                          ), */
                          LdButton(
                            onPressed: openSheet,
                            child: const Text('Start Identification'),
                          ),
                        ],
                      ),
                    );
                  },
                )),
          ),
        ),
      ),
    );
  }
}
1
likes
0
points
61
downloads

Publisher

verified publishermtrust.io

Weekly Downloads

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

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

collection, flutter, flutter_localizations, intl, liquid_flutter, mtrust_urp_core, mtrust_urp_types, mtrust_urp_ui

More

Packages that depend on mtrust_imp_kit