Commit eda93267 authored by Izol's avatar Izol

bug fixing transaction cek status , get qr

added validation cekstatus get qr #1
parent 7378ac15
...@@ -81,6 +81,8 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback { ...@@ -81,6 +81,8 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
late Timer? timer; late Timer? timer;
late Timer? timerPage; late Timer? timerPage;
bool isShowingDialog = false; bool isShowingDialog = false;
bool isProcessGet = false;
bool isProcessCheck = false;
late ConnectivityResult _connectivityResult; late ConnectivityResult _connectivityResult;
Color _statusColor1 = Colors.grey; Color _statusColor1 = Colors.grey;
Color _statusColor2 = Colors.grey; Color _statusColor2 = Colors.grey;
...@@ -133,7 +135,6 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback { ...@@ -133,7 +135,6 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
bool isHitApi = false; bool isHitApi = false;
bool _isLoading = false; bool _isLoading = false;
@override @override
void initState() { void initState() {
super.initState(); super.initState();
...@@ -429,7 +430,8 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback { ...@@ -429,7 +430,8 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
dialogType: DialogType.error, dialogType: DialogType.error,
animType: AnimType.rightSlide, animType: AnimType.rightSlide,
headerAnimationLoop: true, headerAnimationLoop: true,
title: 'Maaf wristband anda tidak dapat digunakan untuk isi saldo', title:
'Maaf wristband anda tidak dapat digunakan untuk isi saldo',
desc: "Sorry, your card cannot be used to top up", desc: "Sorry, your card cannot be used to top up",
btnOkOnPress: () { btnOkOnPress: () {
setState(() { setState(() {
...@@ -591,10 +593,14 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback { ...@@ -591,10 +593,14 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
), ),
).show().then((value) { ).show().then((value) {
Navigator.of(context).pop(); Navigator.of(context).pop();
setState(() => isProcessCheck = false);
countMax = 0; countMax = 0;
checkCountZero = false; checkCountZero = false;
timer?.cancel(); timer?.cancel();
isShowingDialog = true; isShowingDialog = true;
trxId = "";
reffNo = "";
isShowingDialog = true;
_showTap(); _showTap();
tapDial(); tapDial();
}); });
...@@ -627,18 +633,10 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback { ...@@ -627,18 +633,10 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
Map<String, dynamic> response = Map<String, dynamic> response =
await ServiceApi.statusQris(body, PreferencesHelper.getString("mid")); await ServiceApi.statusQris(body, PreferencesHelper.getString("mid"));
if (response['response']['code'].toString() == "200") { if (response['response']['code'].toString() == "200") {
if (response['data']['status'] String status = response['data']['status'].toString().toLowerCase();
.toString() if (status.contains('paid') ||
.toLowerCase() status.contains('success') ||
.contains('paid') || status.contains('settlement')) {
response['data']['status']
.toString()
.toLowerCase()
.contains('success') ||
response['data']['status']
.toString()
.toLowerCase()
.contains('settlement')) {
Navigator.pop(context); Navigator.pop(context);
//TODO: getcard //TODO: getcard
tapBalance(); tapBalance();
...@@ -672,7 +670,7 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback { ...@@ -672,7 +670,7 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
_getInfoBeforeTopup(var info) { _getInfoBeforeTopup(var info) {
setState(() { setState(() {
countMax += 1; countMax += 1;
if (info.toString().toLowerCase().contains('failed')) { if (info.toString().toLowerCase().contains('failed')) {
print('ini pesan salah'); print('ini pesan salah');
message = "Silakan Tempel Wristband Anda Di Reader"; message = "Silakan Tempel Wristband Anda Di Reader";
tapBalance(); tapBalance();
...@@ -750,6 +748,7 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback { ...@@ -750,6 +748,7 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
).show().then((value) { ).show().then((value) {
Navigator.of(context).pop(); Navigator.of(context).pop();
countMax = 0; countMax = 0;
setState(() => isProcessCheck = false);
checkCountZero = false; checkCountZero = false;
timer?.cancel(); timer?.cancel();
isShowingDialog = true; isShowingDialog = true;
...@@ -945,7 +944,6 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback { ...@@ -945,7 +944,6 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
int _minDuration = 3; int _minDuration = 3;
late ValueNotifier<int> idleDuration; late ValueNotifier<int> idleDuration;
// void tapIdle() { // void tapIdle() {
// int duration = int.parse(idle); // int duration = int.parse(idle);
// idleDuration.value = // idleDuration.value =
...@@ -1060,7 +1058,6 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback { ...@@ -1060,7 +1058,6 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
}); });
} }
void tapBalance() async { void tapBalance() async {
Future.delayed(const Duration(milliseconds: 500), () async { Future.delayed(const Duration(milliseconds: 500), () async {
// await StartService.initLibrary(); // await StartService.initLibrary();
...@@ -1094,7 +1091,7 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback { ...@@ -1094,7 +1091,7 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
}, },
btnOkColor: Colors.blue, btnOkColor: Colors.blue,
).show(); ).show();
} else if (isTap == "Error Get Card Type"){ } else if (isTap == "Error Get Card Type") {
print("Error Get Card Type"); print("Error Get Card Type");
await StartService.initLibrary(); await StartService.initLibrary();
AwesomeDialog( AwesomeDialog(
...@@ -1119,7 +1116,7 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback { ...@@ -1119,7 +1116,7 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
}, },
btnOkColor: Colors.blue, btnOkColor: Colors.blue,
).show(); ).show();
} else if (isTap == "CardInfoError: 5001"){ } else if (isTap == "CardInfoError: 5001") {
print("CardInfoError: 5001"); print("CardInfoError: 5001");
await StartService.initLibrary(); await StartService.initLibrary();
AwesomeDialog( AwesomeDialog(
...@@ -1144,7 +1141,7 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback { ...@@ -1144,7 +1141,7 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
}, },
btnOkColor: Colors.blue, btnOkColor: Colors.blue,
).show(); ).show();
} else if (isTap == "Get TicketList Error 5001"){ } else if (isTap == "Get TicketList Error 5001") {
print("Get TicketList Error 5001"); print("Get TicketList Error 5001");
await StartService.initLibrary(); await StartService.initLibrary();
AwesomeDialog( AwesomeDialog(
...@@ -1169,11 +1166,10 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback { ...@@ -1169,11 +1166,10 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
}, },
btnOkColor: Colors.blue, btnOkColor: Colors.blue,
).show(); ).show();
} else{ } else {
print("Error $isTap"); print("Error $isTap");
} }
} }
}); });
} }
...@@ -1476,7 +1472,8 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback { ...@@ -1476,7 +1472,8 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
margin: EdgeInsets.only(top: 0), margin: EdgeInsets.only(top: 0),
padding: EdgeInsets.symmetric(horizontal: 17), padding: EdgeInsets.symmetric(horizontal: 17),
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment:
CrossAxisAlignment.start,
children: [ children: [
Text( Text(
'Masukkan nominal isi ulang disini', 'Masukkan nominal isi ulang disini',
...@@ -1498,11 +1495,11 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback { ...@@ -1498,11 +1495,11 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
), ),
Container( Container(
height: 50, height: 50,
padding: padding: EdgeInsets.symmetric(
EdgeInsets.symmetric(horizontal: 16), horizontal: 16),
decoration: BoxDecoration( decoration: BoxDecoration(
border: border: Border.all(
Border.all(color: Colors.black12), color: Colors.black12),
color: Colors.white, color: Colors.white,
borderRadius: borderRadius:
BorderRadius.circular(12)), BorderRadius.circular(12)),
...@@ -1511,7 +1508,8 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback { ...@@ -1511,7 +1508,8 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
children: <Widget>[ children: <Widget>[
Expanded( Expanded(
child: TextFormField( child: TextFormField(
style: blackTextStyle.copyWith( style:
blackTextStyle.copyWith(
fontSize: 20, fontSize: 20,
fontWeight: bold, fontWeight: bold,
color: purpleColor, color: purpleColor,
...@@ -1549,7 +1547,8 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback { ...@@ -1549,7 +1547,8 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
} }
AwesomeDialog( AwesomeDialog(
context: context, context: context,
dialogType: DialogType.info, dialogType:
DialogType.info,
animType: animType:
AnimType.rightSlide, AnimType.rightSlide,
dismissOnTouchOutside: dismissOnTouchOutside:
...@@ -1560,26 +1559,29 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback { ...@@ -1560,26 +1559,29 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
title: title:
'Mohon Tunggu Sebentar ...', 'Mohon Tunggu Sebentar ...',
titleTextStyle: titleTextStyle:
blackTextStyle.copyWith( blackTextStyle
.copyWith(
fontSize: 20, fontSize: 20,
fontWeight: bold, fontWeight: bold,
), ),
desc: desc:
"Please wait a moment ...", "Please wait a moment ...",
descTextStyle: descTextStyle:
greyTextStyle.copyWith( greyTextStyle
.copyWith(
fontSize: 18, fontSize: 18,
fontWeight: light, fontWeight: light,
), ),
).show().then((value) { ).show().then((value) {
// isProcessGet = true;
if (amountController! if (amountController!
.text.isEmpty) { .text.isEmpty) {
AwesomeDialog( AwesomeDialog(
context: context, context: context,
dialogType: dialogType:
DialogType.error, DialogType.error,
animType: animType: AnimType
AnimType.rightSlide, .rightSlide,
headerAnimationLoop: headerAnimationLoop:
true, true,
title: title:
...@@ -1591,8 +1593,10 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback { ...@@ -1591,8 +1593,10 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
timer?.cancel(); timer?.cancel();
tapIdle(); tapIdle();
}, },
btnOkIcon: Icons.cancel, btnOkIcon:
btnOkColor: Colors.red, Icons.cancel,
btnOkColor:
Colors.red,
).show(); ).show();
} }
if (mounted) { if (mounted) {
...@@ -1620,7 +1624,8 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback { ...@@ -1620,7 +1624,8 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
Container( Container(
padding: EdgeInsets.symmetric(horizontal: 17), padding: EdgeInsets.symmetric(horizontal: 17),
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment:
CrossAxisAlignment.start,
children: [ children: [
SizedBox( SizedBox(
height: 15, height: 15,
...@@ -1648,7 +1653,8 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback { ...@@ -1648,7 +1653,8 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
Expanded( Expanded(
child: GestureDetector( child: GestureDetector(
onTap: () { onTap: () {
if (timer != null) timer?.cancel(); if (timer != null)
timer?.cancel();
tapIdle(); tapIdle();
if (mounted) { if (mounted) {
...@@ -1663,11 +1669,11 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback { ...@@ -1663,11 +1669,11 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
vertical: 15), vertical: 15),
decoration: BoxDecoration( decoration: BoxDecoration(
border: Border.all( border: Border.all(
color: color: amountController!
amountController!.text == .text ==
cTopUp1 cTopUp1
? purpleColor ? purpleColor
: Colors.black12), : Colors.black12),
borderRadius: borderRadius:
BorderRadius.circular(7), BorderRadius.circular(7),
), ),
...@@ -1687,7 +1693,8 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback { ...@@ -1687,7 +1693,8 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
Expanded( Expanded(
child: GestureDetector( child: GestureDetector(
onTap: () { onTap: () {
if (timer != null) timer?.cancel(); if (timer != null)
timer?.cancel();
tapIdle(); tapIdle();
if (mounted) { if (mounted) {
...@@ -1702,11 +1709,11 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback { ...@@ -1702,11 +1709,11 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
vertical: 15), vertical: 15),
decoration: BoxDecoration( decoration: BoxDecoration(
border: Border.all( border: Border.all(
color: color: (amountController!
(amountController!.text == .text ==
cTopUp2) cTopUp2)
? Color(0xff005DAC) ? Color(0xff005DAC)
: Colors.black12), : Colors.black12),
borderRadius: borderRadius:
BorderRadius.circular(7), BorderRadius.circular(7),
), ),
...@@ -1730,7 +1737,8 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback { ...@@ -1730,7 +1737,8 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
Expanded( Expanded(
child: GestureDetector( child: GestureDetector(
onTap: () { onTap: () {
if (timer != null) timer?.cancel(); if (timer != null)
timer?.cancel();
tapIdle(); tapIdle();
if (mounted) { if (mounted) {
...@@ -1745,11 +1753,11 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback { ...@@ -1745,11 +1753,11 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
vertical: 15), vertical: 15),
decoration: BoxDecoration( decoration: BoxDecoration(
border: Border.all( border: Border.all(
color: color: (amountController!
(amountController!.text == .text ==
cTopUp3) cTopUp3)
? Color(0xff005DAC) ? Color(0xff005DAC)
: Colors.black12), : Colors.black12),
borderRadius: borderRadius:
BorderRadius.circular(7), BorderRadius.circular(7),
), ),
...@@ -1795,8 +1803,8 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback { ...@@ -1795,8 +1803,8 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
), ),
child: Center( child: Center(
child: Text("200,000", child: Text("200,000",
style: style: blackTextStyle
blackTextStyle.copyWith( .copyWith(
fontSize: 25, fontSize: 25,
fontWeight: bold, fontWeight: bold,
)), )),
...@@ -1820,55 +1828,76 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback { ...@@ -1820,55 +1828,76 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
subtitle: ' / proceed', subtitle: ' / proceed',
onPressed: () { onPressed: () {
setState(() { setState(() {
if (timer != null) timer?.cancel(); if (timer != null)
timer?.cancel();
AwesomeDialog( AwesomeDialog(
context: context, context: context,
dialogType: DialogType.info, dialogType:
animType: AnimType.rightSlide, DialogType.info,
dismissOnTouchOutside: false, animType: AnimType
autoHide: Duration(seconds: 2), .rightSlide,
headerAnimationLoop: true, dismissOnTouchOutside:
false,
autoHide: Duration(
seconds: 2),
headerAnimationLoop:
true,
title: title:
'Mohon Tunggu Sebentar ...', 'Mohon Tunggu Sebentar ...',
titleTextStyle: titleTextStyle:
blackTextStyle.copyWith( blackTextStyle
.copyWith(
fontSize: 20, fontSize: 20,
fontWeight: bold, fontWeight: bold,
), ),
desc: "Please wait a moment ...", desc:
"Please wait a moment ...",
descTextStyle: descTextStyle:
greyTextStyle.copyWith( greyTextStyle
.copyWith(
fontSize: 18, fontSize: 18,
fontWeight: light, fontWeight: light,
), ),
).show().then((value) { ).show().then((value) {
isProcessCheck =
false;
if (amountController! if (amountController!
.text.isEmpty) { .text.isEmpty) {
AwesomeDialog( AwesomeDialog(
context: context, context: context,
dialogType: DialogType.error, dialogType:
animType: AnimType.rightSlide, DialogType
headerAnimationLoop: true, .error,
title: 'Terjadi Kesalahan', animType: AnimType
.rightSlide,
headerAnimationLoop:
true,
title:
'Terjadi Kesalahan',
desc: desc:
"Anda belum mengisi saldo", "Anda belum mengisi saldo",
btnOkOnPress: () { btnOkOnPress: () {
if (timer != null) if (timer !=
timer?.cancel(); null)
timer
?.cancel();
tapIdle(); tapIdle();
}, },
btnOkIcon: Icons.cancel, btnOkIcon:
btnOkColor: Colors.red, Icons.cancel,
btnOkColor:
Colors.red,
).show(); ).show();
} }
if (mounted) { if (mounted) {
denomLimits( denomLimits(
outletName, outletName,
info, info,
int.parse(amountController! int.parse(amountController!
.text .text
.replaceAll(",", ""))); .replaceAll(
",",
"")));
} }
}); });
}); });
...@@ -1884,60 +1913,67 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback { ...@@ -1884,60 +1913,67 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
Container( Container(
margin: const EdgeInsets.only( margin: const EdgeInsets.only(
right: 350, left: 350), right: 350, left: 350),
child: Row( child: Row(children: [
children: [ Expanded(
Expanded( child: CustomFillButton(
child: CustomFillButton( title: 'Batal',
title: 'Batal', subtitle: ' / cancel',
subtitle:' / cancel', onPressed: () {
onPressed: (){ setState(
Navigator.of(context).pop(); timer?.cancel(); () => isProcessCheck = false);
checkCountZero = false; Navigator.of(context).pop();
isShowingDialog = true; timer?.cancel();
_showTap(); checkCountZero = false;
tapDial(); isShowingDialog = true;
}, _showTap();
) tapDial();
) },
] ))
), ]),
), ),
SizedBox(height: 10), SizedBox(height: 10),
Align( Align(
alignment: Alignment.center, alignment: Alignment.center,
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment:
children:[ MainAxisAlignment.center,
Stack( children: [
Stack(
alignment: Alignment.center, alignment: Alignment.center,
children: [ children: [
ValueListenableBuilder( ValueListenableBuilder(
valueListenable: idleDuration, valueListenable:
builder: (context, value, child) => idleDuration,
builder: (context, value,
child) =>
CircularProgressIndicator( CircularProgressIndicator(
strokeWidth: 5, strokeWidth: 5,
value: (idleDuration.value.toDouble()) / value: (idleDuration.value
_maxDuration, .toDouble()) /
valueColor: _maxDuration,
AlwaysStoppedAnimation<Color>( valueColor:
AlwaysStoppedAnimation<
Color>(
Colors.blue), Colors.blue),
), ),
), ),
RotatedBox( RotatedBox(
quarterTurns: 4, quarterTurns: 4,
child: ValueListenableBuilder( child:
valueListenable: idleDuration, ValueListenableBuilder(
builder: (context, value, child) => valueListenable:
idleDuration,
builder: (context, value,
child) =>
Text( Text(
value.toString(), value.toString(),
style: TextStyle(fontSize: 18), style: TextStyle(
), fontSize: 18),
),
), ),
), ),
] ]),
), ],
],
), ),
), ),
], ],
...@@ -1958,23 +1994,13 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback { ...@@ -1958,23 +1994,13 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
} }
void _showQris(BuildContext context) async { void _showQris(BuildContext context) async {
bool isProcessGet = false; isProcessGet = false;
bool isProcessCheck = false;
Future.delayed(Duration(seconds: 30), () {
if (!isProcessGet) {
isProcessGet = true;
_getQris().then((_qris) {
setState(() {
dataQris = _qris;
});
});
}
});
await showDialog( await showDialog(
context: context, context: context,
builder: (context) { builder: (context) {
return StatefulBuilder(builder: (context, StateSetter setState) { return StatefulBuilder(builder: (context, StateSetter setState) {
Future.delayed(Duration(seconds: 2), () { Future.delayed(Duration(seconds: 2), () {
print("is process get $isProcessGet");
if (!isProcessGet) { if (!isProcessGet) {
isProcessGet = true; isProcessGet = true;
_getQris().then((_qris) { _getQris().then((_qris) {
...@@ -2083,16 +2109,18 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback { ...@@ -2083,16 +2109,18 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
children: [ children: [
//button batalkan di showqris
TextButton( TextButton(
onPressed: () async { onPressed: () async {
setState(() => isProcessCheck = true); print("Click-button-cancel");
setState(() {
isProcessCheck = true;
});
try { try {
bool value = await _cekStatus(); bool value = await _cekStatus();
if (value) { if (value) {
isProcessGet = false;
print("pembayaran berhasil dilakukan"); print("pembayaran berhasil dilakukan");
Navigator.pop(context);
showPop(approvalCode); showPop(approvalCode);
} else { } else {
await AwesomeDialog( await AwesomeDialog(
...@@ -2168,21 +2196,23 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback { ...@@ -2168,21 +2196,23 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
subtitle: 'cancel', subtitle: 'cancel',
), ),
), ),
// Button Saya sudah Bayar di Showqris
TextButton( TextButton(
onPressed: () async { onPressed: () async {
if (isProcessCheck) return; // Tambahkan pengecekan jika proses sedang berjalan print("Click-button-saya-sudah-bayar");
if (isProcessCheck) return;
setState(() => isProcessCheck = true); setState(() => isProcessCheck = true);
try { try {
bool result = await _cekStatus(); bool result = await _cekStatus();
if (result) {
isProcessGet = false;
}
setState(() { setState(() {
if (result) { if (result) {
isProcessCheck = true;
print("pembayaran berhasil dilakukan"); print("pembayaran berhasil dilakukan");
Navigator.pop(context); Navigator.pop(context);
showPop(approvalCode); showPop(approvalCode);
} else { } else {
// isProcessCheck = false; // Hapus baris ini
setState(() => isProcessCheck = false); // Pindahkan baris ini ke bawah AwesomeDialog
AwesomeDialog( AwesomeDialog(
context: context, context: context,
dialogType: DialogType.error, dialogType: DialogType.error,
...@@ -2288,12 +2318,14 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback { ...@@ -2288,12 +2318,14 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
desc: desc:
"Your payment time has expired !", "Your payment time has expired !",
btnOkOnPress: () async { btnOkOnPress: () async {
setState( setState(() {
() => isProcessCheck = true); isProcessCheck = true;
});
try { try {
bool result = await _cekStatus(); bool result = await _cekStatus();
setState(() { setState(() {
if (result) { if (result) {
isProcessGet = false;
print( print(
"pembayaran berhasil dilakukan"); "pembayaran berhasil dilakukan");
Navigator.pop(context); Navigator.pop(context);
...@@ -2704,7 +2736,6 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback { ...@@ -2704,7 +2736,6 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
// }), // }),
// ], // ],
// ), // ),
], ],
), ),
), ),
...@@ -2842,29 +2873,34 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback { ...@@ -2842,29 +2873,34 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
// subtitle: " topup balance", // subtitle: " topup balance",
// ), // ),
// ), // ),
Stack( Stack(
alignment: Alignment.center, alignment: Alignment.center,
children: [ children: [
ValueListenableBuilder( ValueListenableBuilder(
valueListenable: idleDuration, valueListenable: idleDuration,
builder: (context, value, child) => CircularProgressIndicator( builder: (context, value, child) =>
strokeWidth: 5, CircularProgressIndicator(
value: value / 3, // Menggunakan nilai langsung dari value strokeWidth: 5,
valueColor: AlwaysStoppedAnimation<Color>(Colors.blue), value: value / 3,
), // Menggunakan nilai langsung dari value
), valueColor:
RotatedBox( AlwaysStoppedAnimation<Color>(Colors.blue),
quarterTurns: 4, // Menggunakan nilai bulat dari value ),
child: ValueListenableBuilder( ),
valueListenable: idleDuration, RotatedBox(
builder: (context, value, child) => Text( quarterTurns: 4, // Menggunakan nilai bulat dari value
(value.toInt() % 7).toString(), // Menggunakan nilai bulat dari value child: ValueListenableBuilder(
style: TextStyle(fontSize: 20), valueListenable: idleDuration,
), builder: (context, value, child) => Text(
), (value.toInt() % 7).toString(),
), // Menggunakan nilai bulat dari value
], style: TextStyle(fontSize: 20),
), // TextButton( ),
),
),
],
),
// TextButton(
// onPressed: () { // onPressed: () {
// timer?.cancel(); // timer?.cancel();
// checkCountZero = false; // checkCountZero = false;
......
...@@ -44,7 +44,7 @@ dependencies: ...@@ -44,7 +44,7 @@ dependencies:
equatable: ^2.0.5 equatable: ^2.0.5
flutter_bloc: ^8.1.1 flutter_bloc: ^8.1.1
build_runner: ^2.3.2 build_runner: ^2.3.2
intl: ^0.17.0 intl: ^0.18.0
qr_flutter: ^4.0.0 qr_flutter: ^4.0.0
connectivity_plus: ^3.0.3 connectivity_plus: ^3.0.3
ping_discover_network_forked: ^0.0.1 ping_discover_network_forked: ^0.0.1
......
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