pooler_flutter 1.0.0
pooler_flutter: ^1.0.0 copied to clipboard
Unofficial Pooler Flutter SDK
import 'dart:math';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:pooler_flutter/pooler_flutter.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: 'Pooler Demo',
theme: ThemeData(
colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
useMaterial3: true,
),
home: const MyHomePage(title: 'Pooler Page'),
);
}
}
class MyHomePage extends StatefulWidget {
const MyHomePage({Key? key, this.title}) : super(key: key);
final String? title;
@override
State<MyHomePage> createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
@override
Widget build(BuildContext context) {
return CupertinoPageScaffold(
navigationBar: CupertinoNavigationBar(
middle: Text(
widget.title ?? '',
style: const TextStyle(
color: Colors.black,
fontSize: 18,
),
),
backgroundColor: Colors.white,
),
backgroundColor: Colors.white,
child: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
const SizedBox(height: 60),
Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Container(
height: 60,
margin: const EdgeInsets.symmetric(horizontal: 30),
child: CupertinoButton(
color: Colors.green,
child: const Center(
child: Text(
'Launch Checkout',
style: TextStyle(
color: Colors.white,
fontSize: 13,
fontWeight: FontWeight.bold,
),
),
),
onPressed: () async {
await PoolerCheckoutView(
config: PoolerConfig(
publicKey:
"pb_test_40291a0c6bbc66f64875de067c8fb05b4c5c2c544cd3af9ee730ba947407df21",
amount: 400,
transactionReference:
"73f03de5-1043-${Random().nextInt(100000000)}",
redirectLink: 'https://google.com',
email: 'anita@gmail.com',
),
showLogs: true,
onClosed: () {
print('closed');
Navigator.pop(context);
},
onSuccess: (v) {
print(v.toString());
Navigator.pop(context);
},
onError: print,
).show(context);
},
),
),
const SizedBox(height: 60),
],
),
],
),
),
);
}
}