edviron_sdk 0.0.1 copy "edviron_sdk: ^0.0.1" to clipboard
edviron_sdk: ^0.0.1 copied to clipboard

Flutter SDK for Edviron Payment Gateway

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:edviron_sdk/edviron_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(
      title: 'Flutter Demo',
      theme: ThemeData(
        colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
        useMaterial3: true,
      ),
      home: const MyHomePage(title: 'Flutter Demo Home Page'),
    );
  }
}

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

  final String title;

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

class _MyHomePageState extends State<MyHomePage> {
  String _collectRequestId = '';
  final Edviron _edviron = Edviron(mode: EdvironMode.development);

  @override
  Widget build(BuildContext context) {
    return Scaffold(
        appBar: AppBar(
          backgroundColor: Theme.of(context).colorScheme.inversePrimary,
          title: Text(widget.title),
        ),
        body: Center(
          child: Column(
            mainAxisAlignment: MainAxisAlignment.center,
            children: <Widget>[
              const Text(
                'Enter the collect request id in the text field below',
              ),
              Padding(
                padding: const EdgeInsets.all(8.0),
                child: TextField(
                  onChanged: (value) => {
                    _collectRequestId = value,
                  },
                  decoration: const InputDecoration(
                    border: OutlineInputBorder(),
                    labelText: 'Collect Request ID',
                  ),
                ),
              ),
              const SizedBox(height: 20),
              ElevatedButton(
                onPressed: () {
                  _edviron.collect(
                      context: context,
                      collectRequestId: _collectRequestId,
                      onSuccess: () => {
                        ScaffoldMessenger.of(context).showSnackBar(
                          const SnackBar(
                            content: Text('Collect request successful'),
                          ),
                        ),
                      },
                      onError: () => {
                        ScaffoldMessenger.of(context).showSnackBar(
                          const SnackBar(
                            content: Text('Collect request failed'),
                          ),
                        ),
                      });
                },
                child: const Text('Collect'),
              ),
            ],
          ),
        ));
  }
}
1
likes
150
points
17
downloads

Publisher

verified publisheredviron.com

Weekly Downloads

Flutter SDK for Edviron Payment Gateway

Documentation

API reference

License

BSD-3-Clause (license)

Dependencies

flutter, webview_flutter

More

Packages that depend on edviron_sdk