rabitlala_flutter_sdk 1.0.8+1 copy "rabitlala_flutter_sdk: ^1.0.8+1" to clipboard
rabitlala_flutter_sdk: ^1.0.8+1 copied to clipboard

A Flutter SDK for launching RabbitLala secure mobile checkout – ideal for businesses accepting payments.

example/lib/main.dart

import 'dart:developer';
import 'package:flutter/material.dart';
import 'package:rabitlala_flutter_sdk/rabbitlala.dart';

void main() {
  WidgetsFlutterBinding.ensureInitialized();
  Rabbitlala.initialize(mode: Modes.demo);
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Rabbitlalas Demo',
      theme: ThemeData(
        colorScheme: ColorScheme.fromSeed(seedColor: const Color(0xEC34C8DF)),
      ),
      home: const MyHomePage(title: 'RabbitLaLa 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> {
  final reference = TextEditingController(text: "gn0ii0lchp");
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        backgroundColor: Theme.of(context).colorScheme.inversePrimary,

        title: Text(widget.title),
      ),
      body: Center(
        child: Padding(
          padding: const EdgeInsets.all(20),
          child: Column(
            spacing: 20,
            mainAxisAlignment: MainAxisAlignment.center,
            children: <Widget>[
              SizedBox(height: 20),
              TextFormField(
                controller: reference,
                decoration: InputDecoration(
                  labelText: "Reference",
                  border: OutlineInputBorder(),
                ),
              ),
              ElevatedButton(
                onPressed: () {
                  try {
                    Rabbitlala.checkout(
                      context,
                      paymentRef: reference.text,
                    ).then((value) {
                      log("response:$value");
                      if (!context.mounted) return null;
                      showDialog(
                        context: context,
                        builder: (_) {
                          return Container();
                        },
                      );
                    });
                  } catch (e) {
                    log("Error launching checkout: $e");
                  }
                },
                child: Row(
                  mainAxisAlignment: MainAxisAlignment.center,
                  children: [Text("Pay")],
                ),
              ),
            ],
          ),
        ),
      ),
    );
  }
}
1
likes
150
points
56
downloads

Publisher

unverified uploader

Weekly Downloads

A Flutter SDK for launching RabbitLala secure mobile checkout – ideal for businesses accepting payments.

Homepage

Topics

#payments #checkout #mobile #rab #rabbitlala

Documentation

API reference

License

MIT (license)

Dependencies

cupertino_icons, flutter, flutter_inappwebview, google_fonts, http, intl, pin_code_fields, url_launcher

More

Packages that depend on rabitlala_flutter_sdk