custom_cam_plugin 0.0.1
custom_cam_plugin: ^0.0.1 copied to clipboard
USE this Plugin for Custom Camera for PAN, Aadhaar & Cheque
example/lib/main.dart
import 'package:flutter/material.dart';
import 'dart:async';
import 'package:flutter/services.dart';
import 'package:custom_cam_plugin/custom_cam_plugin.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatefulWidget {
const MyApp({super.key});
@override
State<MyApp> createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
final _customCamPlugin = CustomCamPlugin();
int _selectedValue = 1;
@override
void initState() {
super.initState();
}
Future<void> callCustomCamPlugin() async {
try {
String? selectedType;
if(_selectedValue==0){
selectedType="PAN";
}else if(_selectedValue==1){
selectedType="AADHAAR";
}else if(_selectedValue==2){
selectedType="CHEQUE";
}
await _customCamPlugin.setScanType(selectedType!).start();
} catch (e) {
'Failed to get platform version.';
}
}
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: const Text('Plugin example app'),
),
body: Column(
children: [
Container(
margin: EdgeInsets.all(16.0),
decoration: BoxDecoration(
color: Colors.grey.shade600,
borderRadius: BorderRadius.all(Radius.circular(12.0))
),
child: Column(
children: [
RadioListTile<int>(
title: Text('Pan Card'),
value: 0,
groupValue: _selectedValue,
onChanged: (int? value) {
setState(() {
_selectedValue = value!;
});
},
),
RadioListTile<int>(
title: Text('Aadhaar Card'),
value: 1,
groupValue: _selectedValue,
onChanged: (int? value) {
setState(() {
_selectedValue = value!;
});
},
),
RadioListTile<int>(
title: Text('Cheque'),
value: 2,
groupValue: _selectedValue,
onChanged: (int? value) {
setState(() {
_selectedValue = value!;
});
},
),
],
),
),
SizedBox(
height: 16,
),
ElevatedButton(onPressed: (){
callCustomCamPlugin();
}, child: Text("Start"))
],
),
),
);
}
}