flutter_pipwave_ekyc 0.0.1+2 flutter_pipwave_ekyc: ^0.0.1+2 copied to clipboard
Flutter Packages for Pipwave EKYC
import 'package:flutter/material.dart';
import 'package:flutter_pipwave_ekyc/flutter_pipwave_ekyc.dart';
import 'package:flutter_pipwave_ekyc/index.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
useMaterial3: true,
),
home: const MyHomePage(title: 'Pipwave EKYC Demo'),
);
}
}
class MyHomePage extends StatefulWidget {
const MyHomePage({super.key, required this.title});
final String title;
@override
State<MyHomePage> createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
late TextEditingController accessTokenController;
late TextEditingController sessionIdController;
@override
void initState() {
super.initState();
accessTokenController = TextEditingController(text: 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpYXQiOjE2OTUzNjQzODAsImV4cCI6MTY5NTM2Nzk4MCwic3ViIjoiMTU1NTUiLCJtZXJjaGFudElkIjoiRzJHLXRlc3RpbmciLCJzZXNzaW9uSWQiOiI5ZjkzODg0MC1mYmM3LTQyNWMtYTM3Mi04ZjIwNGE0NjhmZTciLCJzY29wZXMiOiJQT1NUXy9la3ljL3Nlc3Npb24ve3Nlc3Npb25faWR9L2RvYyxQT1NUXy9la3ljL3Nlc3Npb24ve3Nlc3Npb25faWR9L3NlbGZpZSxHRVRfL2VreWMvc2Vzc2lvbi97c2Vzc2lvbl9pZH0vY2hlY2ssUFVUXy9la3ljL3Nlc3Npb24ve3Nlc3Npb25faWR9L2ZlZWRiYWNrLEdFVF8vbWVyY2hhbnQve21lcmNoYW50X2lkfSIsImxhbmd1YWdlIjoiZW4iLCJ2ZXJpZmljYXRpb25UeXBlcyI6WyJzZWxmaWUiLCJuYXRpb25hbF9pZGVudGl0eV9kb2N1bWVudCJdLCJtYXhSZXRyaWVzIjoxLCJhdWQiOiJodHRwczovL3N0YWdpbmctb3Blbi1hcGkucGlwd2F2ZS5jb20vIiwiaXNzIjoiUHdTbHMiLCJzdWJUeXBlIjoidXNlciIsInN1cHBvcnRlZENvdW50cmllcyI6WyJzZyIsIm15IiwiaW4iXSwiZXhjbHVkZWRDb3VudHJpZXMiOlsiaXMiXX0.A8EYwPROHBNvdzWj-gJpj2WK98iNijnQtCQrhTM8ENk');
sessionIdController = TextEditingController(text: '9f938840-fbc7-425c-a372-8f204a468fe7');
}
@override
void dispose() {
super.dispose();
accessTokenController.clear();
sessionIdController.clear();
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
backgroundColor: Theme.of(context).colorScheme.inversePrimary,
title: Text(widget.title),
),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
TextFormField(
controller: accessTokenController,
enableSuggestions: false,
autocorrect: false,
maxLines: 12,
decoration: const InputDecoration(
border: InputBorder.none,
labelText: 'Access Token',
),
),
TextFormField(
controller: sessionIdController,
enableSuggestions: false,
autocorrect: false,
maxLines: 2,
decoration: const InputDecoration(
border: InputBorder.none,
labelText: 'Session ID',
),
),
MaterialButton(
color: Theme.of(context).colorScheme.primaryContainer,
onPressed: () {
FlutterPipwaveEkyc.instance.initializeEkycSession(context,
accessToken: accessTokenController.text,
sessionId: sessionIdController.text,
);
},
child: const Text(
'Start Ekyc Process',
style: TextStyle(fontSize: 20),
),
),
],
),
),
);
}
}