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

A new flutter plugin project.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:upi_flutter/upi_flutter.dart';

void main() => runApp(MyApp());

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  String data = 'Testing plugin';


  @override
  void initState() {
    super.initState();
  }

   Future<String> initiateTransaction(String app) async {
    UpiFlutter upi = new UpiFlutter(
      receiverUpiId: '7014971653@apl',
      receiverName: 'Tester',
      transactionRefId: 'TestingId',
      transactionNote: 'Not actual. Just an example.',
      amount: 1.00,
    );

    String response = await upi.startTransaction();

    return response;
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Plugin example app'),
        ),
        body: Center(
          child: Column(
            mainAxisAlignment: MainAxisAlignment.center,
            children: <Widget>[
              GestureDetector(
                onTap: (){
                  initiateTransaction("7014971653@ybl").then((onValue){
                    setState(() {
                      data = onValue;
                    });
                  });
                },
                child: Container(
                  width: 150,
                  height: 50,
                  color: Colors.grey,
                  child: Center(child: Text("tap to pay")),
                ),
              ),
              SizedBox(height: 30,),
              Text(data,style: TextStyle(color: Colors.black,fontSize: 20),)
            ],
          ),
        ),
      ),
    );
  }
}
4
likes
20
pub points
16%
popularity

Publisher

unverified uploader

A new flutter plugin project.

Homepage

License

unknown (LICENSE)

Dependencies

flutter

More

Packages that depend on upi_flutter