pooler_flutter 1.0.0 copy "pooler_flutter: ^1.0.0" to clipboard
pooler_flutter: ^1.0.0 copied to clipboard

Unofficial Pooler Flutter SDK

example/lib/main.dart

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),
              ],
            ),
          ],
        ),
      ),
    );
  }
}
1
likes
140
points
2
downloads

Publisher

unverified uploader

Weekly Downloads

Unofficial Pooler Flutter SDK

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

connectivity_plus, equatable, flutter, url_launcher, webview_flutter

More

Packages that depend on pooler_flutter