Commit 4d416709 authored by Izol's avatar Izol

adjust home page

parent 457699ca
...@@ -381,8 +381,27 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback { ...@@ -381,8 +381,27 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
String sc = PreferencesHelper.getString("multioutletservicecharge"); String sc = PreferencesHelper.getString("multioutletservicecharge");
String metodeBayar = "link-aja"; String metodeBayar = "link-aja";
String status = "Berhasil"; String status = "Berhasil";
_getInfoBalance(info); _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( infoM = await StartService.print(
info, info,
companyName.split("-")[0], companyName.split("-")[0],
...@@ -423,7 +442,6 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback { ...@@ -423,7 +442,6 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
.toLowerCase() .toLowerCase()
.contains('settlement')) { .contains('settlement')) {
Navigator.pop(context); Navigator.pop(context);
//TODO: getcard //TODO: getcard
tapBalance(); tapBalance();
showPop(approvalCode); showPop(approvalCode);
...@@ -494,8 +512,13 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback { ...@@ -494,8 +512,13 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
desc: desc:
"Your transaction failed ! because didn't attach the previous card!", "Your transaction failed ! because didn't attach the previous card!",
btnOkOnPress: () { btnOkOnPress: () {
countMax = 0; // countMax = 0;
if (timer != null) timer?.cancel(); // setState(() {
// isShowingDialog = false;
// });
// if (timer != null) timer?.cancel();
// tapIdle();
String companyName, companyPhone, metodeBayar; String companyName, companyPhone, metodeBayar;
companyName = companyName =
PreferencesHelper.getString('outletname'); PreferencesHelper.getString('outletname');
...@@ -527,7 +550,27 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback { ...@@ -527,7 +550,27 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
metodeBayar, metodeBayar,
'Gagal', '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, btnOkIcon: Icons.cancel,
btnOkColor: Colors.red) btnOkColor: Colors.red)
...@@ -592,23 +635,8 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback { ...@@ -592,23 +635,8 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
maskedText = cardNo.replaceAll(targetMasked, '************'); maskedText = cardNo.replaceAll(targetMasked, '************');
name = infoMap["name"].toString().split("-")[0]; name = infoMap["name"].toString().split("-")[0];
Navigator.pop(context); Navigator.pop(context);
AwesomeDialog(
context: context, // Navigator.pop(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);
Future.delayed(Duration(seconds: int.parse(idle)), () { Future.delayed(Duration(seconds: int.parse(idle)), () {
if (timer != null) timer?.cancel(); if (timer != null) timer?.cancel();
isShowingDialog = false; isShowingDialog = false;
...@@ -720,7 +748,6 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback { ...@@ -720,7 +748,6 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
try { try {
var infoMap = jsonDecode(isTap); var infoMap = jsonDecode(isTap);
_getInfoCard(isTap); _getInfoCard(isTap);
} catch (e){ } catch (e){
print("Error $isTap"); print("Error $isTap");
tapDial(); tapDial();
...@@ -729,13 +756,14 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback { ...@@ -729,13 +756,14 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
} }
void tapBalance() async { void tapBalance() async {
Future.delayed(const Duration(milliseconds: 200), () async { Future.delayed(const Duration(milliseconds: 500), () async {
var isTap = await StartService.getCard(); var isTap = await StartService.getCard();
print("ini tapcard balance $isTap"); try{
if (isTap == "Failed detect card") { var infoMap = jsonDecode(isTap);
tapBalance();
} else {
_getInfoBeforeTopup(isTap); _getInfoBeforeTopup(isTap);
}catch (e){
print("Error $isTap");
tapBalance();
} }
}); });
} }
...@@ -1238,7 +1266,7 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback { ...@@ -1238,7 +1266,7 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
borderRadius: BorderRadius.circular(7), borderRadius: BorderRadius.circular(7),
), ),
child: Center( child: Center(
child: Text("20,000", child: Text("50,000",
style: blackTextStyle.copyWith( style: blackTextStyle.copyWith(
fontSize: 25, fontSize: 25,
fontWeight: bold, fontWeight: bold,
...@@ -1273,7 +1301,7 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback { ...@@ -1273,7 +1301,7 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
borderRadius: BorderRadius.circular(7), borderRadius: BorderRadius.circular(7),
), ),
child: Center( child: Center(
child: Text("50,000", child: Text("150,000",
style: blackTextStyle.copyWith( style: blackTextStyle.copyWith(
fontSize: 25, fontSize: 25,
fontWeight: bold, fontWeight: bold,
...@@ -1417,7 +1445,7 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback { ...@@ -1417,7 +1445,7 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
TextInputAction.done, TextInputAction.done,
decoration: decoration:
InputDecoration.collapsed( InputDecoration.collapsed(
hintText: '10,000', hintText: '50,000',
hintStyle: hintStyle:
blackTextStyle.copyWith( blackTextStyle.copyWith(
fontSize: 20, fontSize: 20,
...@@ -1609,6 +1637,7 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback { ...@@ -1609,6 +1637,7 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
SizedBox( SizedBox(
height: 5, height: 5,
), ),
// Container Button Batalakan, Saya Sudah Bayar Dan TimeOut
Row( Row(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
...@@ -1704,7 +1733,7 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback { ...@@ -1704,7 +1733,7 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
subtitle: 'cancel', subtitle: 'cancel',
), ),
), ),
//button saya sudah bayar di showqris // Button Saya sudah Bayar di Showqris
TextButton( TextButton(
onPressed: () async { onPressed: () async {
setState(() => isProcessCheck = true); setState(() => isProcessCheck = true);
...@@ -1716,6 +1745,7 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback { ...@@ -1716,6 +1745,7 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
Navigator.pop(context); Navigator.pop(context);
showPop(approvalCode); showPop(approvalCode);
} else { } else {
setState(() => isProcessCheck = false);
AwesomeDialog( AwesomeDialog(
context: context, context: context,
dialogType: DialogType.error, dialogType: DialogType.error,
...@@ -1728,39 +1758,13 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback { ...@@ -1728,39 +1758,13 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
btnOkColor: Colors.red) btnOkColor: Colors.red)
.show(); .show();
} }
isProcessCheck = false; // isProcessCheck = false;
}); });
} catch (e) { } catch (e) {
print("Error: $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) child: (isProcessCheck)
? Column( ? Column(
children: [ children: [
...@@ -1807,6 +1811,7 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback { ...@@ -1807,6 +1811,7 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
subtitle: 'i have already paid', subtitle: 'i have already paid',
), ),
), ),
// Time DI Menu Qris
Column( Column(
children: [ children: [
Container( Container(
...@@ -1996,6 +2001,7 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback { ...@@ -1996,6 +2001,7 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
], ],
), ),
), ),
), ),
onWillPop: onWillPop); 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