kyc_widget_falconlite 1.2.0 copy "kyc_widget_falconlite: ^1.2.0" to clipboard
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)}%');
        },
      ),
    );
  }
}
0
likes
140
points
139
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

Universal KYC verification widget for Flutter applications with WebView integration

Homepage

License

MIT (license)

Dependencies

flutter, http, webview_flutter, webview_flutter_android, webview_flutter_wkwebview

More

Packages that depend on kyc_widget_falconlite