speso_id_capture 0.0.4 copy "speso_id_capture: ^0.0.4" to clipboard
speso_id_capture: ^0.0.4 copied to clipboard

This is a flutter package that gives you a custom and reusable Kyc feature for ID capture and Selfie Capture.

example/lib/main.dart

import 'dart:io';
import 'package:path/path.dart' as path;
import 'package:speso_id_capture/speso_id_capture.dart';
import 'package:flutter/material.dart';

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

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

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

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

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

class _CaptureGhanaCardState extends State<MyHomePage> {
  File? idCaptureFile;

  String? frontViewCardName;
  String? frontViewCardPath;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
        appBar: AppBar(title: const Text('Capture ID Card')),
        body: SafeArea(
            child: Padding(
                padding:
                    const EdgeInsets.symmetric(horizontal: 10, vertical: 12),
                child: Column(
                    crossAxisAlignment: CrossAxisAlignment.start,
                    children: [
                      Expanded(
                          child: ListView(shrinkWrap: true, children: [
                        GestureDetector(
                          onTap: () async {
                            // Show the Capture Identity dialog and update the state with the captured image
                            // idCaptureFile = await showIDCapture(
                            //   context: context,
                            //   title: "Scan ID",
                            //   selfie: false,
                            //   hideIdWidget: true,
                            // );

                            frontViewCardPath = idCaptureFile?.path;
                            frontViewCardName =
                                path.basename(idCaptureFile!.path.toString());
                            setState(() {});
                          },
                          child: Container(
                            height: idCaptureFile == null
                                ? MediaQuery.of(context).size.height * 0.28
                                : MediaQuery.of(context).size.height * 0.26,
                            width: idCaptureFile == null
                                ? 0
                                : MediaQuery.of(context).size.width * 0.28,
                            margin: const EdgeInsets.all(15),
                            decoration: BoxDecoration(
                                borderRadius: BorderRadius.circular(10),
                                border:
                                    Border.all(width: 4, color: Colors.purple),
                                image: idCaptureFile == null
                                    ? null
                                    : DecorationImage(
                                        image: FileImage(idCaptureFile!))),
                            child: Center(
                              child: idCaptureFile == null
                                  ? const Column(
                                      mainAxisAlignment:
                                          MainAxisAlignment.center,
                                      children: [
                                        Icon(
                                          Icons.camera_alt,
                                          color: Colors.purple,
                                          size: 30,
                                        ),
                                        Text('Capture Front Side',
                                            style: TextStyle(
                                                color: Colors.purple,
                                                fontSize: 12,
                                                fontWeight: FontWeight.w400)),
                                      ],
                                    )
                                  : null,
                            ),
                          ),
                        ),
                      ])),
                    ]))));
  }
}
1
likes
150
points
31
downloads

Publisher

verified publisherspeso.co

Weekly Downloads

This is a flutter package that gives you a custom and reusable Kyc feature for ID capture and Selfie Capture.

Homepage

Documentation

API reference

License

MIT (license)

Dependencies

camera, flutter, image, path_provider

More

Packages that depend on speso_id_capture