Commit 4d416709 authored by Izol's avatar Izol

adjust home page

parent 457699ca
......@@ -381,8 +381,27 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
String sc = PreferencesHelper.getString("multioutletservicecharge");
String metodeBayar = "link-aja";
String status = "Berhasil";
_getInfoBalance(info);
AwesomeDialog(
context: context,
dialogType: DialogType.success,
animType: AnimType.rightSlide,
autoHide: Duration(seconds: 5),
headerAnimationLoop: true,
title: 'Isi Ulang Anda Berhasil, Saldo Anda Saat Ini $balance',
titleTextStyle: blackTextStyle.copyWith(
fontSize: 20,
fontWeight: bold,
),
desc: "Mohon Cek Kembali Saldo Anda!",
descTextStyle: blackTextStyle.copyWith(
fontSize: 18,
fontWeight: medium,
),
).show();
infoM = await StartService.print(
info,
companyName.split("-")[0],
......@@ -423,7 +442,6 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
.toLowerCase()
.contains('settlement')) {
Navigator.pop(context);
//TODO: getcard
tapBalance();
showPop(approvalCode);
......@@ -494,8 +512,13 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
desc:
"Your transaction failed ! because didn't attach the previous card!",
btnOkOnPress: () {
countMax = 0;
if (timer != null) timer?.cancel();
// countMax = 0;
// setState(() {
// isShowingDialog = false;
// });
// if (timer != null) timer?.cancel();
// tapIdle();
String companyName, companyPhone, metodeBayar;
companyName =
PreferencesHelper.getString('outletname');
......@@ -527,7 +550,27 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
metodeBayar,
'Gagal',
);
Navigator.pop(context);
AwesomeDialog(
context: context,
dismissOnTouchOutside: false,
dialogType: DialogType.error,
animType: AnimType.rightSlide,
headerAnimationLoop: true,
title: 'Transaksi anda gagal ! saldo tidak bertambah',
desc: "Your transaction failed! Your balance did not increase.",
btnOkOnPress: () {
countMax = 0;
setState(() {
isShowingDialog = false;
});
if (timer != null) timer?.cancel();
tapIdle();
Navigator.pop(context);
},
btnOkIcon: Icons.cancel,
btnOkColor: Colors.red)
.show();
// Navigator.pop(context);
},
btnOkIcon: Icons.cancel,
btnOkColor: Colors.red)
......@@ -592,23 +635,8 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
maskedText = cardNo.replaceAll(targetMasked, '************');
name = infoMap["name"].toString().split("-")[0];
Navigator.pop(context);
AwesomeDialog(
context: context,
dialogType: DialogType.success,
animType: AnimType.rightSlide,
headerAnimationLoop: true,
title: 'Isi Ulang Anda Berhasil, Saldo Anda Saat Ini $balance',
titleTextStyle: blackTextStyle.copyWith(
fontSize: 20,
fontWeight: bold,
),
desc: "Mohon Cek Kembali Saldo Anda!",
descTextStyle: blackTextStyle.copyWith(
fontSize: 18,
fontWeight: medium,
),
).show();
Navigator.pop(context);
// Navigator.pop(context);
Future.delayed(Duration(seconds: int.parse(idle)), () {
if (timer != null) timer?.cancel();
isShowingDialog = false;
......@@ -720,7 +748,6 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
try {
var infoMap = jsonDecode(isTap);
_getInfoCard(isTap);
} catch (e){
print("Error $isTap");
tapDial();
......@@ -729,13 +756,14 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
}
void tapBalance() async {
Future.delayed(const Duration(milliseconds: 200), () async {
Future.delayed(const Duration(milliseconds: 500), () async {
var isTap = await StartService.getCard();
print("ini tapcard balance $isTap");
if (isTap == "Failed detect card") {
tapBalance();
} else {
try{
var infoMap = jsonDecode(isTap);
_getInfoBeforeTopup(isTap);
}catch (e){
print("Error $isTap");
tapBalance();
}
});
}
......@@ -1238,7 +1266,7 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
borderRadius: BorderRadius.circular(7),
),
child: Center(
child: Text("20,000",
child: Text("50,000",
style: blackTextStyle.copyWith(
fontSize: 25,
fontWeight: bold,
......@@ -1273,7 +1301,7 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
borderRadius: BorderRadius.circular(7),
),
child: Center(
child: Text("50,000",
child: Text("150,000",
style: blackTextStyle.copyWith(
fontSize: 25,
fontWeight: bold,
......@@ -1417,7 +1445,7 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
TextInputAction.done,
decoration:
InputDecoration.collapsed(
hintText: '10,000',
hintText: '50,000',
hintStyle:
blackTextStyle.copyWith(
fontSize: 20,
......@@ -1609,6 +1637,7 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
SizedBox(
height: 5,
),
// Container Button Batalakan, Saya Sudah Bayar Dan TimeOut
Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
......@@ -1704,7 +1733,7 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
subtitle: 'cancel',
),
),
//button saya sudah bayar di showqris
// Button Saya sudah Bayar di Showqris
TextButton(
onPressed: () async {
setState(() => isProcessCheck = true);
......@@ -1716,6 +1745,7 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
Navigator.pop(context);
showPop(approvalCode);
} else {
setState(() => isProcessCheck = false);
AwesomeDialog(
context: context,
dialogType: DialogType.error,
......@@ -1728,39 +1758,13 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
btnOkColor: Colors.red)
.show();
}
isProcessCheck = false;
// isProcessCheck = false;
});
} catch (e) {
print("Error: $e");
setState(() => isProcessCheck = false);
}
},
// onPressed: () {
// setState(() => isProcessCheck = true);
// _cekStatus().then((value) {
// setState(() {
// if (value) {
// print("pembayaran berhasil dilakukan");
// Navigator.pop(context);
// showPop(approvalCode);
// } else {
// AwesomeDialog(
// context: context,
// dialogType: DialogType.error,
// animType: AnimType.rightSlide,
// headerAnimationLoop: true,
// title: 'Belum Terbayar !',
// desc: "Not paid yet !",
// btnOkOnPress: () {},
// btnOkIcon: Icons.cancel,
// btnOkColor: Colors.red)
// .show();
// }
// isProcessCheck = false;
// });
// });
// },
child: (isProcessCheck)
? Column(
children: [
......@@ -1807,6 +1811,7 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
subtitle: 'i have already paid',
),
),
// Time DI Menu Qris
Column(
children: [
Container(
......@@ -1996,6 +2001,7 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
],
),
),
),
onWillPop: onWillPop);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment