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

IDMeta Kit streamlines the integration of MetaPeta API in Dart apps, simplifying complex tasks. Easily incorporate compliance, biometrics, and country-specific verifications with minimal code. It enha [...]

example/lib/main.dart

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

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

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'IDMeta Kit Demo',
      theme: ThemeData(
        colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
        useMaterial3: true,
      ),
      home: const MyHomePage(title: 'IDMeta Kit Demo Page'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({super.key, required this.title});

  final String title;

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  Enum? typeSelection;
  IdMeta? idMeta;
  String result = "";
  int selectedTimeOut = 5;
  final TextEditingController _controller = TextEditingController();

  @override
  void initState() {
    super.initState();
    _controller.text = "";
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        backgroundColor: Theme.of(context).colorScheme.inversePrimary,
        title: Text(widget.title),
      ),
      body: SingleChildScrollView(
        child: Padding(
          padding: const EdgeInsets.all(8.0),
          child: Column(
            mainAxisAlignment: MainAxisAlignment.start,
            crossAxisAlignment: CrossAxisAlignment.start,
            children: [
              ExpansionTile(
                initiallyExpanded: true,
                childrenPadding: const EdgeInsets.only(bottom: 12),
                title: const Text(
                  "IDMeta Init",
                  textAlign: TextAlign.start,
                  style: TextStyle(
                    fontSize: 20,
                    fontWeight: FontWeight.bold,
                  ),
                ),
                children: [
                  Container(
                    decoration: BoxDecoration(
                      border: Border.all(color: Colors.grey),
                      borderRadius:
                          const BorderRadius.all(Radius.circular(8.0)),
                    ),
                    padding: const EdgeInsets.all(10.0),
                    child: Column(
                      crossAxisAlignment: CrossAxisAlignment.start,
                      children: [
                        Row(
                          mainAxisAlignment: MainAxisAlignment.start,
                          crossAxisAlignment: CrossAxisAlignment.start,
                          children: [
                            const Text(
                              'Auth Token:',
                              style: TextStyle(fontWeight: FontWeight.bold),
                            ),
                            const Spacer(),
                            InkWell(
                              onTap: () {
                                setState(() {
                                  _controller.text = "";
                                });
                              },
                              child: const Padding(
                                padding: EdgeInsets.only(
                                  bottom: 15,
                                  left: 15,
                                ),
                                child: Text(
                                  'Clear',
                                  style: TextStyle(
                                    fontWeight: FontWeight.bold,
                                    color: Colors.red,
                                  ),
                                ),
                              ),
                            ),
                          ],
                        ),
                        TextField(
                          controller: _controller,
                          maxLines: 2,
                          decoration: const InputDecoration(
                            border: OutlineInputBorder(),
                          ),
                        ),
                        const SizedBox(height: 10),
                        Center(
                          child: SizedBox(
                            width: 50,
                            child: DropdownButton<int>(
                              value: selectedTimeOut,
                              onChanged: (int? newValue) {
                                setState(() {
                                  selectedTimeOut = newValue ?? 1;
                                });
                              },
                              items: <int>[0, 1, 2, 3, 4, 5]
                                  .map<DropdownMenuItem<int>>(
                                (int value) {
                                  return DropdownMenuItem<int>(
                                    value: value,
                                    child:
                                        Center(child: Text(value.toString())),
                                  );
                                },
                              ).toList(),
                            ),
                          ),
                        ),
                        const SizedBox(height: 10),
                        Text(
                          'Waiting timeout to get Verification API for MetaMap : \n$selectedTimeOut seconds',
                          style: const TextStyle(fontWeight: FontWeight.bold),
                          textAlign: TextAlign.center,
                        ),
                        const SizedBox(height: 10),
                        Center(
                          child: ElevatedButton(
                            onPressed: () async {
                              if (_controller.text.isNotEmpty) {
                                idMeta = IdMeta.init(
                                  authToken: _controller.text,
                                  waitingTime: selectedTimeOut,
                                );
                                ScaffoldMessenger.of(context).showSnackBar(
                                  const SnackBar(
                                    content:
                                        Text('IDMeta Kit Init Succesfully'),
                                    duration: Duration(seconds: 2),
                                  ),
                                );
                              } else {
                                ScaffoldMessenger.of(context).showSnackBar(
                                  const SnackBar(
                                    content: Text(
                                      'Please enter your idMeta Auth Token',
                                    ),
                                    duration: Duration(seconds: 2),
                                  ),
                                );
                              }
                            },
                            child: const Padding(
                              padding: EdgeInsets.symmetric(horizontal: 40),
                              child: Text('Init SDK'),
                            ),
                          ),
                        ),
                        const SizedBox(height: 10),
                        const Text(
                          "*This section usually handle in the code side by the developer,"
                          "\nPut it here for the demo purpose only",
                          style: TextStyle(fontSize: 12),
                        )
                      ],
                    ),
                  ),
                ],
              ),
              ExpansionTile(
                title: const Text(
                  "Compliance",
                  textAlign: TextAlign.start,
                  style: TextStyle(
                    fontSize: 20,
                    fontWeight: FontWeight.bold,
                  ),
                ),
                expandedCrossAxisAlignment: CrossAxisAlignment.start,
                children: [
                  for (final name in IdMetaCompliance.values) ...[
                    ListTile(
                      title: Text(name.name),
                      leading: Radio(
                        value: name,
                        groupValue: typeSelection,
                        onChanged: (value) {
                          setState(() {
                            typeSelection = value;
                          });
                        },
                      ),
                    ),
                  ],
                ],
              ),
              ExpansionTile(
                title: const Text(
                  "Philipines",
                  textAlign: TextAlign.start,
                  style: TextStyle(
                    fontSize: 20,
                    fontWeight: FontWeight.bold,
                  ),
                ),
                expandedCrossAxisAlignment: CrossAxisAlignment.start,
                children: [
                  for (final name in IdMetaPhilippines.values) ...[
                    ListTile(
                      title: Text(name.name),
                      leading: Radio(
                        value: name,
                        groupValue: typeSelection,
                        onChanged: (value) {
                          setState(() {
                            typeSelection = value;
                          });
                        },
                      ),
                    ),
                  ],
                ],
              ),

              ExpansionTile(
                title: const Text(
                  "Indonesia",
                  textAlign: TextAlign.start,
                  style: TextStyle(
                    fontSize: 20,
                    fontWeight: FontWeight.bold,
                  ),
                ),
                expandedCrossAxisAlignment: CrossAxisAlignment.start,
                children: [
                  for (final name in IdMetaIndonesia.values) ...[
                    ListTile(
                      title: Text(name.name),
                      leading: Radio(
                        value: name,
                        groupValue: typeSelection,
                        onChanged: (value) {
                          setState(() {
                            typeSelection = value;
                          });
                        },
                      ),
                    ),
                  ],
                ],
              ),

              ExpansionTile(
                title: const Text(
                  "Document Verification",
                  textAlign: TextAlign.start,
                  style: TextStyle(
                    fontSize: 20,
                    fontWeight: FontWeight.bold,
                  ),
                ),
                expandedCrossAxisAlignment: CrossAxisAlignment.start,
                children: [
                  for (final name in IdMetaDocVerification.values) ...[
                    ListTile(
                      title: Text(name.name),
                      leading: Radio(
                        value: name,
                        groupValue: typeSelection,
                        onChanged: (value) {
                          setState(() {
                            typeSelection = value;
                          });
                        },
                      ),
                    ),
                  ],
                ],
              ),
              // const Divider(),
              // const Text(
              //   "Australia",
              //   style: TextStyle(
              //     fontSize: 20,
              //     fontWeight: FontWeight.bold,
              //   ),
              // ),
              // for (final name in IdMetaAustralia.values) ...[
              //   ListTile(
              //     title: Text(name.name),
              //     leading: Radio(
              //       value: name,
              //       groupValue: typeSelection,
              //       onChanged: (value) {
              //         setState(() {
              //           typeSelection = value;
              //         });
              //       },
              //     ),
              //   ),
              // ],
              if (result.isNotEmpty) ...[
                const Divider(),
                const Padding(
                  padding: EdgeInsets.symmetric(horizontal: 16),
                  child: Text(
                    "Result : ",
                    style: TextStyle(
                      fontSize: 20,
                      fontWeight: FontWeight.bold,
                    ),
                  ),
                ),
                Padding(
                  padding: const EdgeInsets.symmetric(horizontal: 16),
                  child: Text(result),
                ),
                const Divider(),
              ],
              Center(
                child: ElevatedButton(
                  onPressed: () async {
                    if (idMeta == null) {
                      ScaffoldMessenger.of(context).showSnackBar(
                        const SnackBar(
                          content: Text(
                              'Please init the idmeta_kit sdk with your Auth Token'),
                          duration: Duration(seconds: 2),
                        ),
                      );
                    } else if (typeSelection == null) {
                      ScaffoldMessenger.of(context).showSnackBar(
                        const SnackBar(
                          content: Text('Please Select ID Meta Type'),
                          duration: Duration(seconds: 2),
                        ),
                      );
                    } else {
                      final a = await idMeta!.startVerification(
                        context: context,
                        type: typeSelection!,
                      );
                      setState(() {
                        result = a.toString();
                      });
                    }
                  },
                  child: const Padding(
                    padding: EdgeInsets.symmetric(horizontal: 40),
                    child: Text('Launch SDK'),
                  ),
                ),
              ),
              const SizedBox(height: 200),
            ],
          ),
        ),
      ),
    );
  }
}
0
likes
80
points
15
downloads

Publisher

unverified uploader

Weekly Downloads

IDMeta Kit streamlines the integration of MetaPeta API in Dart apps, simplifying complex tasks. Easily incorporate compliance, biometrics, and country-specific verifications with minimal code. It enhances app security and functionality with comprehensive verification support.

Homepage

Documentation

API reference

License

BSD-3-Clause (license)

Dependencies

build_runner, dio, easy_debounce_throttle, face_camera, flutter, flutter_bloc, flutter_screenutil, flutter_svg, freezed, freezed_annotation, gauge_indicator, image_picker, intl, json_annotation, json_serializable, permission_handler

More

Packages that depend on idmeta_kit