propaga 0.0.2
propaga: ^0.0.2 copied to clipboard
Propaga offers B2B BNPL by embedding financing and flexible payment options at distributors' checkout.
example/lib/main.dart
// ignore_for_file: avoid_print
import 'package:flutter/material.dart';
import 'package:propaga/main.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
title: 'Propaga Demo',
theme: ThemeData(
primarySwatch: Colors.deepPurple,
),
home: const MyHomePage(title: 'Propaga demo'),
);
}
}
class MyHomePage extends StatefulWidget {
const MyHomePage({super.key, required this.title});
final String title;
@override
State<MyHomePage> createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
late bool isActivePropagaButton = false;
@override
Widget build(BuildContext context) {
final size = MediaQuery.of(context).size;
return Scaffold(
appBar: AppBar(
title: Text(widget.title),
),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Padding(
padding: const EdgeInsets.all(10.0),
child: PropagaButton(
isActive: isActivePropagaButton,
onSelect: () => setState(
() => isActivePropagaButton = !isActivePropagaButton),
token: 'pr_test_MUhd1z9e0F2JFnq',
cornerStoreId: '14578',
totalAmount: 8000),
),
const SizedBox(
height: 40.0,
),
SizedBox(
width: size.width * 0.9,
height: 40,
child: ElevatedButton.icon(
style: const ButtonStyle(),
onPressed: () {
startPropaga(
context,
PropagaPayment(
onSuccessTransaction: (PropagaResponse response) {
print(response.transactionId);
print(response.paymentDate);
print(response.totalAmountWithInterest);
},
onErrorTransaction: (PropagaError error) {
print(error.errorCode);
print(error.errorMessage);
},
totalAmount: 8000,
token: 'pr_test_MUhd1z9e0F2JFnq',
cornerStoreId: '14578',
wholesalerTransactionId: "wholesalerId-123",
products: [
Products(
externalSKU: '12312',
name: 'Nombre',
quantity: 3)
]));
},
icon: const Icon(Icons.payment),
label: const Text('Pagar'),
),
),
],
),
),
);
}
}
copied to clipboard