b24_direct_debit_sdk 1.0.0-beta.3 copy "b24_direct_debit_sdk: ^1.0.0-beta.3" to clipboard
b24_direct_debit_sdk: ^1.0.0-beta.3 copied to clipboard

A SDK use to subscribe direct debit with banks.

example/lib/main.dart

import 'package:b24_direct_debit_sdk/b24_direct_debit_sdk.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.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: 'Init SDK Demo',
      theme: ThemeData(
        colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
        useMaterial3: true,
      ),
      home: MyHome(),
    );
  }
}

// ignore: must_be_immutable
class MyHome extends StatelessWidget {
  MyHome({super.key});

  final _subscriptionNoController = TextEditingController();
  final _refererKeyController = TextEditingController();
  final _languageCodeController = TextEditingController(text: 'km');

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Column(
        mainAxisSize: MainAxisSize.min,
        children: [
          const SizedBox(
            height: 80,
          ),
          Container(
            padding: const EdgeInsets.symmetric(horizontal: 20),
            height: 50,
            child: TextFormField(
              controller: _subscriptionNoController,
              decoration: InputDecoration(
                  suffixIcon: IconButton(
                      onPressed: () async {
                        pastText(_subscriptionNoController);
                      },
                      icon: const Icon(Icons.paste_outlined)),
                  label: const Text('Subscription No'),
                  border: const OutlineInputBorder()),
            ),
          ),
          const SizedBox(
            height: 10,
          ),
          Container(
            padding: const EdgeInsets.symmetric(horizontal: 20),
            height: 50,
            child: TextFormField(
              controller: _refererKeyController,
              decoration: InputDecoration(
                  suffixIcon: IconButton(
                      onPressed: () async {
                        pastText(_refererKeyController);
                      },
                      icon: const Icon(Icons.paste_outlined)),
                  label: const Text('Referer Key'),
                  border: const OutlineInputBorder()),
            ),
          ),
          const SizedBox(
            height: 10,
          ),
          Container(
            padding: const EdgeInsets.symmetric(horizontal: 20),
            height: 50,
            child: TextFormField(
              controller: _languageCodeController,
              decoration: InputDecoration(
                  suffixIcon: IconButton(
                      onPressed: () async {
                        pastText(_languageCodeController);
                      },
                      icon: const Icon(Icons.paste_outlined)),
                  label: const Text('Language Code'),
                  border: const OutlineInputBorder()),
            ),
          ),
          const SizedBox(
            height: 10,
          ),
          ElevatedButton(
              style: const ButtonStyle(
                  padding: WidgetStatePropertyAll(EdgeInsets.all(20)),
                  backgroundColor: WidgetStatePropertyAll(Colors.blue)),
              onPressed: () {
                if (_subscriptionNoController.text.isEmpty) {
                  _subscriptionNoController.text = '5KO9B8O52R1k';
                }
                if (_refererKeyController.text.isEmpty) {
                  _refererKeyController.text =
                      'd945botz-dc54-483d-9759-f9858a9211a0';
                }

                B24DirectDebitSdk.initSdk(
                    context: context,
                    subscriptionNo: _subscriptionNoController.text,
                    refererKey: _refererKeyController.text,
                    isDarkMode: false, // optional  default false
                    language:
                        _languageCodeController.text, // optional  default km
                    isProduction: false, // optional  default false (=Demo env)
                    testingEnv:
                        'Dev' // (Stag,Pilot,Demo) optional  default Demo
                    );
              },
              child: const Text(
                "Init SDK",
                style: TextStyle(color: Colors.white),
              ))
        ],
      ),
    );
  }
}

void pastText(TextEditingController controller) async {
  ClipboardData? data = await Clipboard.getData('text/plain');
  if (data != null) {
    controller.text = data.text ?? "";
  }
}
4
likes
0
points
56
downloads

Publisher

unverified uploader

Weekly Downloads

A SDK use to subscribe direct debit with banks.

License

unknown (license)

Dependencies

cached_network_image, flutter, flutter_localizations, fluttertoast, go_router, google_fonts, http, intl, provider, socket_io_client, universal_html, universal_platform, url_launcher

More

Packages that depend on b24_direct_debit_sdk