kvalifika_sdk 0.12.1 copy "kvalifika_sdk: ^0.12.1" to clipboard
kvalifika_sdk: ^0.12.1 copied to clipboard

outdated

Official Flutter plugin for integating Kvalifika SDK into your app.

example/lib/main.dart

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

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

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  int counter = -1;
  bool isGeorgian = false;

  KvalifikaSdkLocale get locale {
    if (isGeorgian) return KvalifikaSdkLocale.GE;
    return KvalifikaSdkLocale.EN;
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Kvalifika'),
          actions: [
            Switch(
              value: isGeorgian,
              onChanged: (val) {
                setState(() {
                  isGeorgian = val;
                });
              },
            ),
          ],
        ),
        body: KvalifikaSdk(
          // appId: "7bd2bab9-5bcb-4f8d-a0c8-d7fd3fd4653b", // Production
          appId: "d4bb88d7-8e6d-4653-baef-9d87c1e102e6", // Development
          development: true,
          locale: locale,
          logo: "logo",
          documentIcon: "logo",
          onInitialize: (context, sdk) {
            setState(() {
              counter = 0;
            });
            ScaffoldMessenger.of(context).showSnackBar(
              SnackBar(
                content: Text('SDK Initialized'),
              ),
            );
            sdk.startSession();
          },
          onStart: (context, sessionId) {
            setState(() {
              counter++;
            });
            ScaffoldMessenger.of(context).showSnackBar(
              SnackBar(
                content: Text('Started Verification'),
              ),
            );
          },
          onFinish: (context, sessionId) {},
          onError: (context, error, message) {
            print(error);

            if (error == KvalifikaSdkError.TIMEOUT) {
              ScaffoldMessenger.of(context).showSnackBar(
                SnackBar(
                  content: Text('Timeout'),
                ),
              );
            }

            if (error == KvalifikaSdkError.USER_CANCELLED) {
              ScaffoldMessenger.of(context).showSnackBar(
                SnackBar(
                  content: Text('User Canceled'),
                ),
              );
            }
          },
          builder: (BuildContext context, KvalifikaSdk sdk) {
            return Center(
              child: Column(
                mainAxisAlignment: MainAxisAlignment.center,
                children: [
                  ElevatedButton(
                    key: const Key('start_session'),
                    onPressed: () {
                      sdk.startSession();
                    },
                    child: Text('Start Verification'),
                  ),
                  SizedBox(
                    height: 10,
                  ),
                  Text(
                    '$counter',
                    key: const Key('counter'),
                  ),
                ],
              ),
            );
          },
        ),
        floatingActionButton: FloatingActionButton(
          onPressed: () {
            setState(() {
              counter++;
            });
          },
          child: Icon(Icons.add),
        ),
      ),
    );
  }
}
12
likes
0
pub points
0%
popularity

Publisher

verified publisherkvalifika.com

Official Flutter plugin for integating Kvalifika SDK into your app.

Homepage

License

unknown (LICENSE)

Dependencies

flutter

More

Packages that depend on kvalifika_sdk