-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.dart
114 lines (105 loc) · 3.52 KB
/
main.dart
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
import 'dart:math';
import 'package:bambara_flutter/bambara_flutter.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return AnnotatedRegion<SystemUiOverlayStyle>(
value: const SystemUiOverlayStyle(
statusBarColor: Colors.transparent,
systemNavigationBarColor: Colors.white,
),
child: MaterialApp(
title: 'Bambara Flutter Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
),
debugShowCheckedModeBanner: false,
home: MyHomePage(title: 'Bambara Demo'),
),
);
}
}
class MyHomePage extends StatefulWidget {
MyHomePage({Key? key, this.title}) : super(key: key);
final String? title;
@override
_MyHomePageState createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
@override
Widget build(BuildContext context) {
return CupertinoPageScaffold(
navigationBar: CupertinoNavigationBar(
middle: Text(
widget.title ?? '',
style: const TextStyle(
color: Colors.black,
fontSize: 18,
),
),
backgroundColor: Colors.white,
),
backgroundColor: Colors.white,
child: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
const SizedBox(height: 60),
Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Container(
height: 60,
margin: const EdgeInsets.symmetric(horizontal: 30),
child: CupertinoButton(
color: const Color(0xFF0066FF),
child: const Center(
child: Text(
'Open Bambara',
style: TextStyle(
color: Colors.white,
fontSize: 13,
fontWeight: FontWeight.bold,
),
),
),
onPressed: () async {
await BambaraView(
data: BambaraData(
amount: 200,
provider: 'bank-card',
reference: getRandomString(30),
phone: "786339816",
email: "bass@gmail.com",
name: "Bassirou",
publicKey: "pk_IuR83FabBsxW2P6mHPJywyGljga9QcFg",
),
onClosed: () => print("CLOSED"),
onError: (data) => print(data),
onSuccess: (data) => print(data),
onRedirect: (data) => print(data),
onProcessing: (data) => print(data),
closeOnComplete: false,
).show(context);
},
),
),
],
),
],
),
),
);
}
}
const _chars = 'AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz1234567890';
Random _rnd = Random();
String getRandomString(int length) => String.fromCharCodes(Iterable.generate(
length, (_) => _chars.codeUnitAt(_rnd.nextInt(_chars.length))));