prophetx_sdk 0.5.0
prophetx_sdk: ^0.5.0 copied to clipboard
ProphetX Flutter SDK — embed deposit, withdraw, KYC and onboarding flows in Flutter apps.
example/lib/main.dart
import 'package:flutter/material.dart';
import 'package:prophetx_sdk/prophetx_sdk.dart';
void main() {
runApp(const ExampleApp());
}
class ExampleApp extends StatelessWidget {
const ExampleApp({super.key});
@override
Widget build(BuildContext context) {
return ProphetXProvider(
environment: EnvironmentName.staging,
token: const String.fromEnvironment('PROPHETX_TOKEN'),
theme: const EmbedTheme(primaryColor: '#6366f1'),
locale: 'en',
child: MaterialApp(
title: 'ProphetX SDK Example',
theme: ThemeData.dark(useMaterial3: true),
home: const HomeScreen(),
),
);
}
}
class HomeScreen extends StatelessWidget {
const HomeScreen({super.key});
@override
Widget build(BuildContext context) {
final px = ProphetX.of(context);
return Scaffold(
appBar: AppBar(title: const Text('ProphetX SDK Example')),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
ElevatedButton(
onPressed: () => px.deposit.open(OpenDepositOptions(
onSuccess: (id, amt) => debugPrint('deposit success $id ($amt)'),
onCancel: () => debugPrint('deposit cancelled'),
onError: (code, msg) => debugPrint('deposit error $code: $msg'),
)),
child: const Text('Open Deposit'),
),
const SizedBox(height: 12),
ElevatedButton(
onPressed: () => px.withdraw.open(OpenWithdrawOptions(
onSuccess: (id, amt) => debugPrint('withdraw success $id ($amt)'),
onCancel: () => debugPrint('withdraw cancelled'),
)),
child: const Text('Open Withdraw'),
),
const SizedBox(height: 24),
const PoweredByProphetX(),
],
),
),
);
}
}