b24_payment_sdk 0.2.1 copy "b24_payment_sdk: ^0.2.1" to clipboard
b24_payment_sdk: ^0.2.1 copied to clipboard

retracted

Package payment SDK for merchant.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:b24_payment_sdk/b24_payment_sdk.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(
      debugShowCheckedModeBanner: false,
      title: 'Flutter Demo',
      theme: ThemeData(
        colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
        useMaterial3: true,
      ),
      home: const MyHomePage(title: 'កម្មវិធី'),
    );
  }
}

// ignore: must_be_immutable
class MyHomePage extends StatefulWidget {
  const MyHomePage({
    super.key,
    required this.title,
  });

  final String title;

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  bool isToggled = false;

  String? tranId = "8F79D121E49E";
  String? refererKey = "123X";
  String? language = '';
  bool? darkMode = false;
  bool? isProduction = false;

  @override
  Widget build(BuildContext context) {
    
    return Scaffold(
      appBar: AppBar(
        backgroundColor: Theme.of(context).colorScheme.inversePrimary,
        title: Text(widget.title),
      ),
      body: Center(
        child: SingleChildScrollView(
          child: Padding(
            padding: const EdgeInsets.all(16.0),
            child: Column(
              mainAxisAlignment: MainAxisAlignment.center,
              mainAxisSize: MainAxisSize.min,
              children: <Widget>[
                TextField(
                  onChanged: (value) {
                    setState(() {
                      tranId = value;
                    });
                  },
                  decoration: const InputDecoration(labelText: 'tranId'),
                ),
                TextField(
                  onChanged: (value) {
                    setState(() {
                      language = value;
                    });
                  },
                  decoration: const InputDecoration(labelText: 'language'),
                ),

                CheckboxListTile(
                  title: const Text('Is production'),
                  value: isProduction,
                  onChanged: (value) {
                    setState(() {
                      isProduction = value;
                    });
                  },
                ),
                CheckboxListTile(
                  title: const Text('dark Mode'),
                  value: darkMode,
                  onChanged: (value) {
                    setState(() {
                      darkMode = value;
                    });
                  },
                ),

                const SizedBox(height: 10.0),
                ElevatedButton(
                  onPressed: () {
                    B24PaymentSdk.intSdk(
                      controller: context,
                      tranId: '$tranId',
                      refererKey: "$refererKey",
                      language: "$language",
                      darkMode: darkMode,
                      isProduction: isProduction,
                    );
                  },
                  child: const Text('Checkout'),
                ),
                const SizedBox(
                    height: 80), 
              ],
            ),
          ),
        ),
      ),
    );
  }
}