secugen_fp_capture 0.0.2 secugen_fp_capture: ^0.0.2 copied to clipboard
Flutter plugin to capture finger prints as an image
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:secugen_fp_capture/secugen_fp_capture.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatefulWidget {
const MyApp({super.key});
@override
State<MyApp> createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
List<Uint8List?> imageData = [];
String? error;
final _secugenFpCapturePlugin = SecugenFpCapture();
@override
void initState() {
super.initState();
}
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
body: SafeArea(
child: Column(
children: [
if (error != null) Text(error!),
Expanded(
child: (imageData.isNotEmpty)
? GridView.builder(
gridDelegate:
const SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 3,
),
itemBuilder: (context, index) {
return Container(
padding: const EdgeInsets.symmetric(horizontal: 10),
child: Image.memory(
width: 100,
height: 200,
imageData[index]!,
),
);
},
itemCount: imageData.length,
)
: Container(),
),
ElevatedButton(
onPressed: () {
_captureFingerPrint();
},
child: const Text('Capture Fingerprint'),
),
],
),
),
),
);
}
_captureFingerPrint() async {
try {
final result = await _secugenFpCapturePlugin.captureFingerprint();
imageData.add(result);
// print('imageData');
// print(imageData);
error = null;
setState(() {});
} on PlatformException catch (e) {
print('error is $e');
error = e.message;
setState(() {});
}
}
}