kyc_widget_falconlite 1.2.0
kyc_widget_falconlite: ^1.2.0 copied to clipboard
Universal KYC verification widget for Flutter applications with WebView integration
example/lib/main.dart
import 'package:flutter/material.dart';
import 'package:kyc_widget_falconlite/kyc_widget_falconlite.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'KYC Widget Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
useMaterial3: true,
),
home: const HomePage(),
);
}
}
class HomePage extends StatelessWidget {
const HomePage({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('KYC Widget Demo'),
),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
ElevatedButton(
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => const KYCScreen(tier: 'tier_1'),
),
);
},
child: const Text('Start Tier 1 KYC'),
),
const SizedBox(height: 16),
ElevatedButton(
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => const KYCScreen(tier: 'tier_2'),
),
);
},
child: const Text('Start Tier 2 KYC'),
),
],
),
),
);
}
}
class KYCScreen extends StatelessWidget {
final String tier;
const KYCScreen({Key? key, required this.tier}) : super(key: key);
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('${tier == 'tier_1' ? 'Tier 1' : 'Tier 2'} KYC'),
),
body: KYCWidget(
config: KYCConfig(
tier: tier,
accessToken: 'demo-token', // Replace with actual token
apiBaseUrl: 'https://api.yourapp.com', // Replace with actual API
theme: 'light',
),
onSuccess: (result) {
ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(
content: Text('KYC verification successful!'),
backgroundColor: Colors.green,
),
);
Navigator.pop(context);
},
onError: (error) {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Text('KYC failed: $error'),
backgroundColor: Colors.red,
),
);
},
onProgress: (step, progress) {
debugPrint('KYC Progress: $step - ${progress.toStringAsFixed(0)}%');
},
),
);
}
}