passbase_flutter 1.9.8 passbase_flutter: ^1.9.8 copied to clipboard
Official Flutter wrapper for Passbase SDK. For more info please visit https://docs.passbase.com/flutter
import 'package:flutter/material.dart';
import 'package:passbase_flutter/passbase_flutter.dart';
void main() => runApp(PassbaseFlutterDemoApp());
class PassbaseFlutterDemoApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
PassbaseFlutter.initialize(
apiKey:
"YOUR_OWN_PUBLISHABLE_API_KEY",
prefillUserEmail: 'EMAIL',
additionalAttributes: {
// object of String:String based additional Params you want, **must be string (key, value) e.g.
"userId": "a2ab4-f2jc4-k2dd4-1fa3x" //example
});
return MaterialApp(
home: PassbaseDemoHomePage(),
);
}
}
class PassbaseDemoHomePage extends StatefulWidget {
PassbaseDemoHomePage({Key key}) : super(key: key);
@override
_PassbaseDemoHomePageState createState() {
PassbaseFlutter.setTestMode(false);
return _PassbaseDemoHomePageState();
}
}
class _PassbaseDemoHomePageState extends State<PassbaseDemoHomePage> {
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Color.fromARGB(255, 50, 107, 236),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Padding(
padding: EdgeInsets.only(top: 80),
child: Image.asset(
'lib/assets/shield-icon.png',
width: 50,
height: 50,
),
),
Container(
padding: EdgeInsets.symmetric(horizontal: 45),
child: Column(
children: <Widget>[
Text(
'Welcome to Passbase',
style: TextStyle(
fontSize: 25,
color: Colors.white,
fontFamily: 'Exo',
fontWeight: FontWeight.w600),
),
SizedBox(
height: 25,
),
Text(
'Start your first verification by clicking on the button below.',
style: TextStyle(
fontSize: 15,
color: Colors.white,
fontFamily: 'Exo',
),
textAlign: TextAlign.center,
),
],
),
),
Padding(
padding: EdgeInsets.only(bottom: 70),
child: PassbaseButton(
onVerificationSuccess: (authKey) {
// do stuff in case of success
print(authKey);
},
onVerificationCancel: () {
// do stuff in case of cancel
print("cancel");
},
onVerificationStart: () {
// do stuff in case of start
print("start");
},
width: 300,
height: 60,
),
),
],
),
),
);
}
}