feexpay_flutter 1.0.0 copy "feexpay_flutter: ^1.0.0" to clipboard
feexpay_flutter: ^1.0.0 copied to clipboard

A secure plugin to accept Mobile Money and Credit Card payments.

example/lib/main.dart

// @dart = 2.8

import 'package:example/end.dart';
import 'package:feexpay_flutter/feexpay_flutter.dart';
import 'package:flutter/material.dart';
import 'dart:math';
import 'package:random_string/random_string.dart';

void main() {
  runApp(const MyApp());
}


class MyApp extends StatelessWidget {
  const MyApp({key});

  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: const MyHomePage(title: 'My Flutter Application'),
    );
  }
}

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

  // This widget is the home page of your application. It is stateful, meaning
  // that it has a State object (defined below) that contains fields that affect
  // how it looks.

  // This class is the configuration for the state. It holds the values (in this
  // case the title) provided by the parent (in this case the App widget) and
  // used by the build method of the State. Fields in a Widget subclass are
  // always marked "final".

  final String title;

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

class _MyHomePageState extends State<MyHomePage> {
  int _counter = 0;
  bool popupIsActive = false;
  String editableText;
  String randomString = randomAlphaNumeric(15);
  String amount = '50';

  void _incrementCounter() {
    setState(() {
      _counter++;
    });
  }

  _showDialogSuccess(String message) {
    showDialog(
      context: context,
      builder: (context) => Visibility(
        visible: false,
          child: AlertDialog(
            title: Text(message),
            actions: [
              TextButton(
                child: const Text('Terminer'),
                onPressed: () => Navigator.of(context).pop(),
              ),
            ],
          ),
      )
    );
  }

  void _showDialog(String message) {
    showDialog<void>(
        context: context,
        builder: (context) => Visibility(
          visible: false,
          child: AlertDialog(
            title: Text(message),
            actions: [
              TextButton(
                child: const Text('Terminer'),
                onPressed: () => Navigator.of(context).pop(),
              ),
            ],
          ),
        )
    );
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(widget.title),
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            // Text(
            //   'You have pushed the button this many times:',
            // ),
            MaterialButton(
              child: Text('Payer $amount'),
                color: Color(0xFF112C56),
                textColor: Colors.white,
                shape: RoundedRectangleBorder(
                borderRadius: BorderRadius.circular(10.0),),
                onPressed: () => {
                // showDialog<void>(
                // context: context,
                // builder: (context) => AlertDialog(
                // backgroundColor: Colors.red,
                // title: Text(
                // 'Transaction échouée. Veuillez reessayer', style: TextStyle(color: Colors.white)),
                // actions: [
                // TextButton(
                // child: const Text('OK'),
                // onPressed: () => Navigator.of(context).pop(),
                // ),
                // ],
                // ),
                // )
                //   _showDialogSuccess('xdfgvh').then((_){
                //     popupIsActive = false;
                //   })
                // Future.delayed(const Duration(seconds: 1), () {
                //   if (popupIsActive) Navigator.of(context).pop();
                // },),

                // Navigator.push(
                // context,
                // MaterialPageRoute(
                // builder: (context) => ChoicePage((value) {
                // return editableText = value;
                // })));
                // print(randomString)
                Navigator.push(
                context,
                MaterialPageRoute(builder: (context) => ChoicePage(
                  // token: 'fp_expK2auYVTcKGLkg6yq3FfozEg7TdOkczJSMMZtJoOBR55gwwrDv7kGrssa0tZEj',
                  token: 'fp_M6tuzYgsYl39d6kJvdaLmYGQcEAdzGmk0txgEWvLRivVhbeK4UCwbDiyMlj9UPMO',
                  // id: '63e3c477589840e611232472',
                  id: '63e586c1fe4c35f54de9749c',
                  amount: amount,
                  callbackurl: 'EndPage',
                  trans_key: randomString,
                )),
                )
                  // ChoicePage(
                  //     onPressed: _incrementCounter,
                  //     child: const Text("Click me")
                  // ),
                }
            ),
            // Text(
            //   '$_counter',
            //   style: Theme.of(context).textTheme.headline4,
            // ),
          ],
        ),
      ),
      // floatingActionButton: FloatingActionButton(
      //   onPressed: _incrementCounter,
      //   tooltip: 'Increment',
      //   child: Icon(Icons.add),
      // ), // This trailing comma makes auto-formatting nicer for build methods.
    );
  }
}

  int _counter = 0;

  void _incrementCounter() {
    setState(() {
      // This call to setState tells the Flutter framework that something has
      // changed in this State, which causes it to rerun the build method below
      // so that the display can reflect the updated values. If we changed
      // _counter without calling setState(), then the build method would not be
      // called again, and so nothing would appear to happen.
      _counter++;
    });
  }
  
  void setState(Null Function() param0) {
  }

  @override
  Widget build(BuildContext context) {
    var widget;
    return Scaffold(
      appBar: AppBar(
        title: Text(widget.title),
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            const Text(
              'You have pushed the button this many times:',
            ),
            Text(
              '$_counter',
              style: Theme.of(context).textTheme.headlineMedium,
            ),
          ],
        ),
      ),
      floatingActionButton: FloatingActionButton(
        onPressed: _incrementCounter,
        tooltip: 'Increment',
        child: const Icon(Icons.add),
      ), // This trailing comma makes auto-formatting nicer for build methods.
    );
  }
1
likes
0
pub points
53%
popularity

Publisher

unverified uploader

A secure plugin to accept Mobile Money and Credit Card payments.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter, flutter_credit_card, http, random_string, test, url_launcher

More

Packages that depend on feexpay_flutter