b24_payment_sdk 0.0.5 copy "b24_payment_sdk: ^0.0.5" to clipboard
b24_payment_sdk: ^0.0.5 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> {
  int _counter = 0;
  bool isToggled = false;

  String? tranId = "6D20A7DDF076";
  String? refererKey = "123X";
  String? langauge = '';
  bool? isLightMode = true;
  String? env = 'stage';

  void _incrementCounter() {
    setState(() {
      isToggled = !isToggled;

      _counter++;
    });
  }

  @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(() {
                      langauge = value;
                    });
                  },
                  decoration: const InputDecoration(labelText: 'language'),
                ),

                TextField(
                  onChanged: (value) {
                    setState(() {
                      env = value;
                    });
                  },
                  decoration: const InputDecoration(labelText: 'env'),
                ),
                CheckboxListTile(
                  title: const Text('Light Mode'),
                  value: isLightMode,
                  onChanged: (value) {
                    setState(() {
                      isLightMode = value;
                    });
                  },
                ),

                const SizedBox(height: 10.0),
                ElevatedButton(
                  onPressed: () {
                    B24PaymentSdk.intSdk(
                      controller: context,
                      tranId: '$tranId',
                      refererKey: "$refererKey",
                      langauge: "$langauge",
                      isLightMode: isLightMode,
                      env: "$env",
                    );
                  },
                  child: const Text('Checkout'),
                ),
                const SizedBox(
                    height: 80), // Replace the Expanded widget with a SizedBox

                Text(
                  '$_counter',
                  style: Theme.of(context).textTheme.headlineMedium,
                ),
              ],
            ),
          ),
        ),
      ),
      floatingActionButton: FloatingActionButton(
        onPressed: _incrementCounter,
        tooltip: 'Increment',
        child: const Icon(Icons.add),
      ),
    );
  }
}