Commit f4ae6b12 authored by Izol's avatar Izol

Simplifikasi self service

- Update version SS.14.WWW
- Version code 7
- Adjust timer idle all state
- Adjust button wristband info
- Adjust manual and topup button
- Adjust layout wristband info
- Adjust state transaction failed
- Adjust state transaction success
- Adjust state 3 seconds go to topup page
- Adjust state timeout idle topup to tap card info
- Adjust init library in splash page
- Adjust configuration tap wristband different
- Added detection tap wristband in topup balance
- Added auto hide in show dialog succes and failed transactions
parent afc75ab7
sdk.dir=/Users/macbookpro/Library/Android/sdk sdk.dir=/Users/macbookpro/Library/Android/sdk
flutter.sdk=/Users/macbookpro/Developer/flutter flutter.sdk=/Users/macbookpro/Developer/flutter
flutter.buildMode=debug flutter.buildMode=debug
flutter.versionName=SS.13.WWW flutter.versionName=SS.14.WWW
flutter.versionCode=6 flutter.versionCode=7
\ No newline at end of file \ No newline at end of file
...@@ -89,6 +89,8 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback { ...@@ -89,6 +89,8 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
Color _tapColor3 = Colors.grey; Color _tapColor3 = Colors.grey;
int _activeContainerIndex = 1; int _activeContainerIndex = 1;
double _downloadSpeed = 0; double _downloadSpeed = 0;
bool checkCountZero = false;
bool isDenomDialogShowing = false;
var infoCard, var infoCard,
prevInfoCard, prevInfoCard,
...@@ -111,7 +113,7 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback { ...@@ -111,7 +113,7 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
Map<String, dynamic>? dataQris; Map<String, dynamic>? dataQris;
var countMax = 0; var countMax = 0;
String? prevBalance, maskedText,getRegDb; String? prevBalance, maskedText, getRegDb;
String subPhone = ""; String subPhone = "";
var trxId = ""; var trxId = "";
...@@ -127,11 +129,14 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback { ...@@ -127,11 +129,14 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
@override @override
void initState() { void initState() {
super.initState(); super.initState();
WidgetsBinding.instance.addPostFrameCallback((_) { WidgetsBinding.instance.addPostFrameCallback((_) {
isShowingDialog = true; isShowingDialog = true;
checkCountZero = false;
_showTap(); _showTap();
tapDial(); tapDial();
}); });
idleDuration = ValueNotifier<int>(_maxDuration); idleDuration = ValueNotifier<int>(_maxDuration);
Timer.periodic(Duration(seconds: 1), (timer) { Timer.periodic(Duration(seconds: 1), (timer) {
if (idleDuration.value > 0) { if (idleDuration.value > 0) {
...@@ -142,6 +147,7 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback { ...@@ -142,6 +147,7 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
timer.cancel(); timer.cancel();
} }
}); });
Connectivity() Connectivity()
.onConnectivityChanged .onConnectivityChanged
.listen((ConnectivityResult connectivityResult) { .listen((ConnectivityResult connectivityResult) {
...@@ -356,8 +362,8 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback { ...@@ -356,8 +362,8 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
} }
}); });
amount = amountController!.text.replaceAll(",", "").toString(); amount = amountController!.text.replaceAll(",", "").toString();
var responseInquiry = await StartService.topupInquiryResponse( var responseInquiry = await StartService.topupInquiryResponse(outletName,
outletName, prevBalance!, cardNumber, getRegDb!, amount, outletId, persoReff); prevBalance!, cardNumber, getRegDb!, amount, outletId, persoReff);
var infoInquiry = jsonDecode(responseInquiry); var infoInquiry = jsonDecode(responseInquiry);
var name = infoMap["name"].toString().trim(); var name = infoMap["name"].toString().trim();
...@@ -384,11 +390,12 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback { ...@@ -384,11 +390,12 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
desc: "Sorry, your wristband has expired", desc: "Sorry, your wristband has expired",
btnOkIcon: Icons.error, btnOkIcon: Icons.error,
btnOkColor: Colors.red) btnOkColor: Colors.red)
.show().then((value){ .show()
timer?.cancel(); .then((value) {
isShowingDialog = true; timer?.cancel();
_showTap(); isShowingDialog = true;
tapDial(); _showTap();
tapDial();
}); });
} else { } else {
print("ini response fail : ${infoInquiry['errors'][0]['details'][0]}"); print("ini response fail : ${infoInquiry['errors'][0]['details'][0]}");
...@@ -399,7 +406,7 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback { ...@@ -399,7 +406,7 @@ 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 kartu 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(() {
...@@ -435,16 +442,23 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback { ...@@ -435,16 +442,23 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
var infoPaymentNotes = jsonDecode(info); var infoPaymentNotes = jsonDecode(info);
var reffNo = trxId.toString(); var reffNo = trxId.toString();
paymentProvider = ''; paymentProvider = '';
paymentNotes = "reffNo: $reffNo\nprovider: $paymentNotes"; paymentNotes = "reffNo: $reffNo\nprovider: $paymentNotes";
print("ini adalag test hasil payment notes:$paymentNotes"); print("ini adalag test hasil payment notes:$paymentNotes");
tid = PreferencesHelper.getString('outletname'); tid = PreferencesHelper.getString('outletname');
tid = tid.substring(tid.length -4); tid = tid.substring(tid.length - 4);
if (int.parse(lastBalance) > int.parse(prevBalance!)) { if (int.parse(lastBalance) > int.parse(prevBalance!)) {
countMax = 0; countMax = 0;
var result = await StartService.topUpConfirm(cardNumber, lastBalance, tid, var result = await StartService.topUpConfirm(
samReport, approvalCode, paymentMethod, paymentProvider, paymentNotes); cardNumber,
lastBalance,
tid,
samReport,
approvalCode,
paymentMethod,
paymentProvider,
paymentNotes);
print('topUpConfirm result: $result'); print('topUpConfirm result: $result');
String readerDate, String readerDate,
...@@ -522,7 +536,7 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback { ...@@ -522,7 +536,7 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
dismissOnTouchOutside: false, dismissOnTouchOutside: false,
autoHide: Duration(seconds: 5), autoHide: Duration(seconds: 5),
headerAnimationLoop: true, headerAnimationLoop: true,
title: 'Isi Ulang Anda Berhasil, Mohon Cek Kembali Saldo Anda!', title: 'Isi Ulang Anda Berhasil, Saldo Anda Saat Ini $balance',
titleTextStyle: blackTextStyle.copyWith( titleTextStyle: blackTextStyle.copyWith(
fontSize: 20, fontSize: 20,
fontWeight: bold, fontWeight: bold,
...@@ -531,9 +545,12 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback { ...@@ -531,9 +545,12 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
descTextStyle: blackTextStyle.copyWith( descTextStyle: blackTextStyle.copyWith(
fontSize: 18, fontSize: 18,
color: Colors.green, color: Colors.green,
fontWeight: medium, fontWeight: light,
), ),
).show().then((value) { ).show().then((value) {
Navigator.of(context).pop();
countMax = 0;
checkCountZero = false;
timer?.cancel(); timer?.cancel();
isShowingDialog = true; isShowingDialog = true;
_showTap(); _showTap();
...@@ -609,31 +626,29 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback { ...@@ -609,31 +626,29 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
return result; return result;
} }
_getInfoBeforeTopup(var info) { _getInfoBeforeTopup(var info) {
setState(() { setState(() {
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();
} } else {
else {
countMax += 1;
infoCard = info; infoCard = info;
var infoMap = jsonDecode(info); var infoMap = jsonDecode(info);
String nilaiTap = PreferencesHelper.getString('maxTap'); String nilaiTap = PreferencesHelper.getString('maxTap');
String newCardNumber = infoMap["cardNumber"]; String newCardNumber = infoMap["cardNumber"];
if (newCardNumber == cardNumber) { if (newCardNumber == cardNumber) {
topUpBalance(approvalCode); topUpBalance(approvalCode);
} } else {
else {
AwesomeDialog( AwesomeDialog(
context: context, context: context,
dismissOnTouchOutside: false, dismissOnTouchOutside: false,
dialogType: DialogType.error, dialogType: DialogType.error,
animType: AnimType.rightSlide, animType: AnimType.rightSlide,
headerAnimationLoop: true, headerAnimationLoop: true,
title: 'Wristband tidak sama ! tempelkan wristband sebelumnya', title:
'Wristband tidak sama ! tempelkan wristband sebelumnya',
desc: desc:
"Wristband are not the same! please put the previous wristband ${countMax}", "Wristband are not the same! please put the previous wristband ${countMax}",
btnOkOnPress: () async { btnOkOnPress: () async {
...@@ -644,12 +659,11 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback { ...@@ -644,12 +659,11 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
AwesomeDialog( AwesomeDialog(
context: context, context: context,
dismissOnTouchOutside: false, dismissOnTouchOutside: false,
autoHide: Duration(seconds: 5),
dialogType: DialogType.error, dialogType: DialogType.error,
animType: AnimType.rightSlide, animType: AnimType.rightSlide,
headerAnimationLoop: true, headerAnimationLoop: true,
title: title:
'Transaksi anda gagal ! dikarenakan tidak menempelkan kartu sebelumnya', 'Transaksi anda gagal ! dikarenakan tidak menempelkan wristband sebelumnya',
desc: desc:
"Your transaction failed ! because didn't attach the previous card!", "Your transaction failed ! because didn't attach the previous card!",
btnOkOnPress: () { btnOkOnPress: () {
...@@ -672,26 +686,28 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback { ...@@ -672,26 +686,28 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
_getInfoBalance(info); _getInfoBalance(info);
AwesomeDialog( AwesomeDialog(
context: context, context: context,
dismissOnTouchOutside: false, dismissOnTouchOutside: false,
autoHide: Duration(seconds: 10), autoHide: Duration(seconds: 10),
dialogType: DialogType.error, dialogType: DialogType.error,
animType: AnimType.rightSlide, animType: AnimType.rightSlide,
headerAnimationLoop: true, headerAnimationLoop: true,
title: title:
'Transaksi isi ulang anda tidak berhasil\nsimpan bukti pembayaran untuk di tunjukkan kepada petugas', 'Transaksi isi ulang anda tidak berhasil\nsimpan bukti pembayaran untuk di tunjukkan kepada petugas',
titleTextStyle: blackTextStyle.copyWith( titleTextStyle: blackTextStyle.copyWith(
fontSize: 20, fontSize: 20,
fontWeight: bold, fontWeight: bold,
), ),
desc: desc:
"Your top up transaction was not successful\nSave proof of payment to show to the officer", "Your top up transaction was not successful\nSave proof of payment to show to the officer",
descTextStyle: greyTextStyle.copyWith( descTextStyle: greyTextStyle.copyWith(
fontSize: 18, fontSize: 18,
fontWeight: light, fontWeight: light,
), ),
).show().then((value){ ).show().then((value) {
Navigator.of(context).pop();
countMax = 0; countMax = 0;
checkCountZero = false;
timer?.cancel(); timer?.cancel();
isShowingDialog = true; isShowingDialog = true;
_showTap(); _showTap();
...@@ -778,13 +794,19 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback { ...@@ -778,13 +794,19 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
String targetMasked = cardNo.substring(0, 12); String targetMasked = cardNo.substring(0, 12);
maskedText = cardNo.replaceAll(targetMasked, '************'); maskedText = cardNo.replaceAll(targetMasked, '************');
name = infoMap["name"].toString().split("-")[0]; name = infoMap["name"].toString().split("-")[0];
Navigator.pop(context); if (timer != null) timer?.cancel();
isShowingDialog = false;
Future.delayed(Duration(seconds: int.parse(idle)), () { isDenomDialogShowing = false;
if (timer != null) timer?.cancel(); checkCountZero = false;
isShowingDialog = false; // tapDial();
tapIdle(); // Navigator.pop(context);
}); //
// Future.delayed(Duration(seconds: int.parse(idle)), () {
// isDenomDialogShowing = false;
// checkCountZero = false;
// isShowingDialog = false;
// tapIdle();
// });
} }
}); });
} }
...@@ -842,6 +864,8 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback { ...@@ -842,6 +864,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];
isShowingDialog = false; isShowingDialog = false;
isDenomDialogShowing = false;
checkCountZero = false;
tapIdle(); tapIdle();
Navigator.pop(context); Navigator.pop(context);
} }
...@@ -900,19 +924,21 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback { ...@@ -900,19 +924,21 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
void tapIdle() { void tapIdle() {
int duration = int.parse(idle); int duration = int.parse(idle);
idleDuration.value = duration; // set nilai awal untuk idleDuration idleDuration.value = duration; // set nilai awal untuk idleDuration
int count = 0; // tambahkan variabel untuk menghitung durasi int count = 0;
// tambahkan variabel untuk menghitung durasi
timer = Timer.periodic(Duration(seconds: 1), (timer) { timer = Timer.periodic(Duration(seconds: 1), (timer) {
// set timer dengan durasi 1 detik // set timer dengan durasi 1 detik
duration -= 1; duration -= 1;
idleDuration.value = duration; // set nilai baru untuk idleDuration idleDuration.value = duration;
// set nilai baru untuk idleDuration
// print("ini pesan waktu idle : $idleDuration"); // print("ini pesan waktu idle : $idleDuration");
// print("isShowingdialog : $isShowingDialog"); // print("isShowingdialog : $isShowingDialog");
count += 1; // tambahkan hitungan durasi setiap detik count += 1; // tambahkan hitungan durasi setiap detik
if (count == 3 && !isShowingDialog) { if (count == 3 &&
// jika durasi sudah mencapai 3 detik dan dialog tidak sedang ditampilkan !isShowingDialog &&
isShowingDialog = true; !checkCountZero &&
if (timer != null) timer?.cancel(); !isDenomDialogShowing) {
tapIdle();
amountController?.clear(); amountController?.clear();
var infoMap = jsonDecode(infoCard); var infoMap = jsonDecode(infoCard);
plainCardExpirity = infoMap['cardExpirity']; plainCardExpirity = infoMap['cardExpirity'];
...@@ -925,7 +951,7 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback { ...@@ -925,7 +951,7 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
deposit = CurrencyFormat.convertToIdr(infoMap["deposit"], 2); deposit = CurrencyFormat.convertToIdr(infoMap["deposit"], 2);
cardNumber = infoMap["cardNumber"]; cardNumber = infoMap["cardNumber"];
String outletName = PreferencesHelper.getString('outlet_name'); String outletName = PreferencesHelper.getString('outlet_name');
countMax += 1; // countMax += 1;
String nilaiTap = PreferencesHelper.getString('maxTap'); String nilaiTap = PreferencesHelper.getString('maxTap');
String newCardNumber = infoMap["cardNumber"]; String newCardNumber = infoMap["cardNumber"];
AwesomeDialog( AwesomeDialog(
...@@ -935,27 +961,39 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback { ...@@ -935,27 +961,39 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
dismissOnTouchOutside: false, dismissOnTouchOutside: false,
autoHide: Duration(seconds: 2), autoHide: Duration(seconds: 2),
headerAnimationLoop: true, headerAnimationLoop: true,
title: 'Mohon Tunggu Sebentar ...', title: 'Anda sedang di alihkan ke halaman pilih nominal',
titleTextStyle: blackTextStyle.copyWith( titleTextStyle: blackTextStyle.copyWith(
fontSize: 20, fontSize: 20,
fontWeight: bold, fontWeight: bold,
), ),
desc: "Please wait a moment ...", desc: "You are being redirected to the name selection page",
descTextStyle: greyTextStyle.copyWith( descTextStyle: greyTextStyle.copyWith(
fontSize: 18, fontSize: 18,
fontWeight: light, fontWeight: light,
), ),
).show().then((value) { ).show().then((value) {
isDenomDialogShowing = true; // Set penanda dialog denom menjadi true
denom(outletName, infoCard); denom(outletName, infoCard);
// isShowingDialog = false; if (timer != null) {
// if (timer != null) timer?.cancel(); timer!.cancel();
// tapIdle(); }
isShowingDialog = false;
amountController?.clear();
// ...
}); });
} }
if (duration == 0 && !isShowingDialog) { if (duration == 0 && !isShowingDialog) {
// jika idleDuration sudah habis dan dialog tidak sedang ditampilkan // jika idleDuration sudah habis dan dialog tidak sedang ditampilkan
isShowingDialog = true; isShowingDialog = true;
timer?.cancel(); timer?.cancel();
if (isDenomDialogShowing) {
// Tutup dialog denom jika sedang ditampilkan
checkCountZero = false;
Navigator.of(context).pop();
isDenomDialogShowing =
false; // Set penanda dialog denom menjadi false
}
_showTap(); _showTap();
tapDial(); tapDial();
} }
...@@ -984,25 +1022,25 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback { ...@@ -984,25 +1022,25 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
} catch (e) { } catch (e) {
print("Error $isTap"); print("Error $isTap");
AwesomeDialog( AwesomeDialog(
context: context, context: context,
dialogType: DialogType.info, dialogType: DialogType.info,
animType: AnimType.rightSlide, animType: AnimType.rightSlide,
dismissOnTouchOutside: false, dismissOnTouchOutside: false,
headerAnimationLoop: true, headerAnimationLoop: true,
title: 'Pastikan Wristband Anda Tertempel Di Reader !', title: 'Pastikan Wristband Anda Tertempel Di Reader !',
titleTextStyle: blackTextStyle.copyWith( titleTextStyle: blackTextStyle.copyWith(
fontSize: 20, fontSize: 20,
fontWeight: bold, fontWeight: bold,
), ),
desc: "Make sure your wristband is attached to the reader !", desc: "Make sure your wristband is attached to the reader !",
descTextStyle: greyTextStyle.copyWith( descTextStyle: greyTextStyle.copyWith(
fontSize: 18, fontSize: 18,
fontWeight: light, fontWeight: light,
), ),
btnOkOnPress: () { btnOkOnPress: () {
tapBalance(); tapBalance();
}, },
btnOkColor: Colors.blue) btnOkColor: Colors.blue)
.show(); .show();
} }
}); });
...@@ -1031,7 +1069,6 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback { ...@@ -1031,7 +1069,6 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [
Row( Row(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [
...@@ -1111,7 +1148,9 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback { ...@@ -1111,7 +1148,9 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
), ),
textAlign: TextAlign.center, textAlign: TextAlign.center,
), ),
SizedBox(height: 20,), SizedBox(
height: 20,
),
Row( Row(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [
...@@ -1134,7 +1173,6 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback { ...@@ -1134,7 +1173,6 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
), ),
], ],
), ),
], ],
), ),
], ],
...@@ -1201,7 +1239,9 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback { ...@@ -1201,7 +1239,9 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
), ),
textAlign: TextAlign.center, textAlign: TextAlign.center,
), ),
SizedBox(height: 10,), SizedBox(
height: 10,
),
Row( Row(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [
...@@ -1241,20 +1281,23 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback { ...@@ -1241,20 +1281,23 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
} }
void denom(String outletName, var info) { void denom(String outletName, var info) {
checkCountZero = true;
if (timer != null) timer?.cancel();
tapIdle();
SystemChrome.setEnabledSystemUIMode(SystemUiMode.manual, overlays: []); SystemChrome.setEnabledSystemUIMode(SystemUiMode.manual, overlays: []);
showDialog( showDialog(
context: context, context: context,
builder: (context) { builder: (context) {
Future.delayed(Duration(seconds: int.parse(idle)), () { // Future.delayed(Duration(seconds: int.parse(idle)), () {
Navigator.of(context).pop(true); // Navigator.of(context).pop(true);
setState(() { // setState(() {
isShowingDialog = true; // isShowingDialog = true;
if (timer != null) timer?.cancel(); // if (timer != null) timer?.cancel();
dataQris = null; // dataQris = null;
_showTap(); // _showTap();
tapIdle(); // tapIdle();
});// Menutup dialog setelah durasi tertentu // });// Menutup dialog setelah durasi tertentu
}); // });
return StatefulBuilder(builder: (context, StateSetter setState) { return StatefulBuilder(builder: (context, StateSetter setState) {
return Container( return Container(
decoration: BoxDecoration( decoration: BoxDecoration(
...@@ -1264,8 +1307,7 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback { ...@@ -1264,8 +1307,7 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
'assets/img_bg_card.png', 'assets/img_bg_card.png',
), ),
), ),
color: purpleColor color: purpleColor),
),
child: Stack( child: Stack(
children: [ children: [
Center( Center(
...@@ -1285,29 +1327,31 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback { ...@@ -1285,29 +1327,31 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
), ),
), ),
width: 1100, width: 1100,
margin: const EdgeInsets.symmetric(vertical: 10, horizontal: 20), margin: const EdgeInsets.symmetric(
vertical: 10, horizontal: 20),
child: Row( child: Row(
children: [ children: [
Align( // Align(
alignment: Alignment.topLeft, // alignment: Alignment.topLeft,
child: GestureDetector( // child: GestureDetector(
onTap: () { // onTap: () {
setState(() { // setState(() {
Navigator.pop(context); // checkCountZero = false;
timer?.cancel(); // Navigator.pop(context);
dataQris = null; // timer?.cancel();
isShowingDialog = true; // dataQris = null;
_showTap(); // isShowingDialog = true;
tapDial(); // _showTap();
}); // tapDial();
}, // });
child: Icon( // },
Icons.arrow_back, // child: Icon(
size: 32, // Icons.arrow_back,
color: lightBackgroundColor, // size: 32,
), // color: lightBackgroundColor,
), // ),
), // ),
// ),
SizedBox( SizedBox(
width: 400, width: 400,
), ),
...@@ -1324,7 +1368,7 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback { ...@@ -1324,7 +1368,7 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
], ],
), ),
), ),
content: Container ( content: Container(
child: ListBody( child: ListBody(
children: <Widget>[ children: <Widget>[
Container( Container(
...@@ -1353,89 +1397,115 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback { ...@@ -1353,89 +1397,115 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
), ),
Container( Container(
height: 50, height: 50,
padding: EdgeInsets.symmetric(horizontal: 16), padding:
EdgeInsets.symmetric(horizontal: 16),
decoration: BoxDecoration( decoration: BoxDecoration(
border: Border.all(color: Colors.black12), border:
Border.all(color: Colors.black12),
color: Colors.white, color: Colors.white,
borderRadius: BorderRadius.circular(12)), borderRadius:
BorderRadius.circular(12)),
child: Center( child: Center(
child: Row( child: Row(
children: <Widget>[ children: <Widget>[
Expanded( Expanded(
child: TextFormField( child: TextFormField(
style: blackTextStyle.copyWith( style: blackTextStyle.copyWith(
fontSize: 20,
fontWeight: bold,
color: purpleColor,
),
keyboardType: TextInputType
.numberWithOptions(
signed: true,
decimal: true),
controller: amountController,
inputFormatters: [
FilteringTextInputFormatter
.digitsOnly,
CurrencyInputFormatter()
],
textInputAction:
TextInputAction.done,
decoration:
InputDecoration.collapsed(
hintText: '50,000',
hintStyle:
blackTextStyle.copyWith(
fontSize: 20, fontSize: 20,
fontWeight: bold, fontWeight: bold,
color: purpleColor, color: greyColor,
), ),
keyboardType: ),
TextInputType.numberWithOptions( onChanged: (value) {
signed: true, if (timer != null)
decimal: true), timer?.cancel();
controller: amountController, tapIdle();
inputFormatters: [ },
FilteringTextInputFormatter onFieldSubmitted: (value) {
.digitsOnly,
CurrencyInputFormatter()
],
textInputAction:
TextInputAction.done,
decoration:
InputDecoration.collapsed(
hintText: '50,000',
hintStyle:
blackTextStyle.copyWith(
fontSize: 20,
fontWeight: bold,
color: greyColor,
),
),
onFieldSubmitted: (value){
if (timer != null) { if (timer != null) {
timer!.cancel(); timer!.cancel();
} }
AwesomeDialog( AwesomeDialog(
context: context, context: context,
dialogType: DialogType.info, dialogType: DialogType.info,
animType: AnimType.rightSlide, animType:
dismissOnTouchOutside: false, AnimType.rightSlide,
autoHide: Duration(seconds: 2), dismissOnTouchOutside:
false,
autoHide:
Duration(seconds: 2),
headerAnimationLoop: true, headerAnimationLoop: true,
title: 'Mohon Tunggu Sebentar ...', title:
titleTextStyle: blackTextStyle.copyWith( 'Mohon Tunggu Sebentar ...',
titleTextStyle:
blackTextStyle.copyWith(
fontSize: 20, fontSize: 20,
fontWeight: bold, fontWeight: bold,
), ),
desc: "Please wait a moment ...", desc:
descTextStyle: greyTextStyle.copyWith( "Please wait a moment ...",
descTextStyle:
greyTextStyle.copyWith(
fontSize: 18, fontSize: 18,
fontWeight: light, fontWeight: light,
), ),
).show().then((value) { ).show().then((value) {
if(amountController!.text.isEmpty){ if (amountController!
.text.isEmpty) {
AwesomeDialog( AwesomeDialog(
context: context, context: context,
dialogType: DialogType.error, dialogType:
animType: AnimType.rightSlide, DialogType.error,
headerAnimationLoop: true, animType:
title: 'Terjadi Kesalahan', AnimType.rightSlide,
desc: "Anda belum mengisi saldo", headerAnimationLoop:
true,
title:
'Terjadi Kesalahan',
desc:
"Anda belum mengisi saldo",
btnOkOnPress: () { btnOkOnPress: () {
if (timer != null) timer?.cancel(); if (timer != null)
timer?.cancel();
tapIdle(); tapIdle();
}, },
btnOkIcon: Icons.cancel, btnOkIcon: Icons.cancel,
btnOkColor: Colors.red, btnOkColor: Colors.red,
).show(); ).show();
} }
if (mounted){ if (mounted) {
denomLimits( denomLimits(
outletName, outletName,
info, info,
int.parse(amountController!.text.replaceAll(",", "")) int.parse(
); amountController!
} }); .text
.replaceAll(
",",
"")));
}
});
}, },
), ),
), ),
...@@ -1443,7 +1513,6 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback { ...@@ -1443,7 +1513,6 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
), ),
), ),
), ),
], ],
), ),
), ),
...@@ -1452,7 +1521,9 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback { ...@@ -1452,7 +1521,9 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
SizedBox(height: 15,), SizedBox(
height: 15,
),
Text( Text(
'Pilih nominal isi ulang', 'Pilih nominal isi ulang',
style: blackTextStyle.copyWith( style: blackTextStyle.copyWith(
...@@ -1475,71 +1546,79 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback { ...@@ -1475,71 +1546,79 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
children: [ children: [
Expanded( Expanded(
child: GestureDetector( child: GestureDetector(
onTap: () { onTap: () {
if (timer != null) timer?.cancel(); if (timer != null) timer?.cancel();
tapIdle(); tapIdle();
if (mounted) { if (mounted) {
setState(() { setState(() {
amountController!.text = cTopUp1; amountController!.text =
}); cTopUp1;
} });
}, }
child: Container( },
padding: child: Container(
EdgeInsets.symmetric(vertical: 15), padding: EdgeInsets.symmetric(
decoration: BoxDecoration( vertical: 15),
border: Border.all( decoration: BoxDecoration(
color: amountController!.text == border: Border.all(
cTopUp1 color:
amountController!.text ==
cTopUp1
? purpleColor ? purpleColor
: Colors.black12), : Colors.black12),
borderRadius: BorderRadius.circular(7), borderRadius:
), BorderRadius.circular(7),
child: Center( ),
child: Text("50,000", child: Center(
style: blackTextStyle.copyWith( child: Text("50,000",
fontSize: 25, style:
fontWeight: bold, blackTextStyle.copyWith(
)), fontSize: 25,
), fontWeight: bold,
), )),
)), ),
),
)),
SizedBox( SizedBox(
width: 10, width: 10,
), ),
Expanded( Expanded(
child: GestureDetector( child: GestureDetector(
onTap: () { onTap: () {
if (timer != null) timer?.cancel(); if (timer != null) timer?.cancel();
tapIdle(); tapIdle();
if (mounted) { if (mounted) {
setState(() { setState(() {
amountController!.text = cTopUp2; amountController!.text =
}); cTopUp2;
} });
}, }
child: Container( },
padding: child: Container(
EdgeInsets.symmetric(vertical: 15), padding: EdgeInsets.symmetric(
decoration: BoxDecoration( vertical: 15),
border: Border.all( decoration: BoxDecoration(
color: (amountController!.text == border: Border.all(
cTopUp2) color:
(amountController!.text ==
cTopUp2)
? Color(0xff005DAC) ? Color(0xff005DAC)
: Colors.black12), : Colors.black12),
borderRadius: BorderRadius.circular(7), borderRadius:
), BorderRadius.circular(7),
child: Center( ),
child: Text("150,000", child: Center(
style: blackTextStyle.copyWith( child: Text("150,000",
fontSize: 25, style:
fontWeight: bold, blackTextStyle.copyWith(
)), fontSize: 25,
), fontWeight: bold,
), )),
)) ),
),
))
], ],
), ),
SizedBox( SizedBox(
...@@ -1549,66 +1628,74 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback { ...@@ -1549,66 +1628,74 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
children: [ children: [
Expanded( Expanded(
child: GestureDetector( child: GestureDetector(
onTap: () { onTap: () {
if (timer != null) timer?.cancel(); if (timer != null) timer?.cancel();
tapIdle(); tapIdle();
if (mounted) { if (mounted) {
setState(() { setState(() {
amountController!.text = cTopUp3; amountController!.text =
}); cTopUp3;
} });
}, }
child: Container( },
padding: child: Container(
EdgeInsets.symmetric(vertical: 15), padding: EdgeInsets.symmetric(
decoration: BoxDecoration( vertical: 15),
border: Border.all( decoration: BoxDecoration(
color: (amountController!.text == border: Border.all(
cTopUp3) color:
(amountController!.text ==
cTopUp3)
? Color(0xff005DAC) ? Color(0xff005DAC)
: Colors.black12), : Colors.black12),
borderRadius: BorderRadius.circular(7), borderRadius:
), BorderRadius.circular(7),
child: Center( ),
child: Text("100,000", child: Center(
style: blackTextStyle.copyWith( child: Text("100,000",
fontSize: 25, style:
fontWeight: bold, blackTextStyle.copyWith(
)), fontSize: 25,
), fontWeight: bold,
), )),
)), ),
),
)),
SizedBox( SizedBox(
width: 10, width: 10,
), ),
Expanded( Expanded(
child: GestureDetector( child: GestureDetector(
onTap: () { onTap: () {
if (timer != null) timer?.cancel(); if (timer != null)
timer?.cancel();
tapIdle(); tapIdle();
if (mounted) { if (mounted) {
setState(() { setState(() {
amountController!.text = cTopUp4; amountController!.text =
cTopUp4;
}); });
} }
}, },
child: Container( child: Container(
padding: padding: EdgeInsets.symmetric(
EdgeInsets.symmetric(vertical: 15), vertical: 15),
decoration: BoxDecoration( decoration: BoxDecoration(
border: Border.all( border: Border.all(
color: (amountController!.text == color: (amountController!
cTopUp4) .text ==
cTopUp4)
? Color(0xff005DAC) ? Color(0xff005DAC)
: Colors.black12), : Colors.black12),
borderRadius: borderRadius:
BorderRadius.circular(7), BorderRadius.circular(7),
), ),
child: Center( child: Center(
child: Text("200,000", child: Text("200,000",
style: blackTextStyle.copyWith( style:
blackTextStyle.copyWith(
fontSize: 25, fontSize: 25,
fontWeight: bold, fontWeight: bold,
)), )),
...@@ -1623,7 +1710,8 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback { ...@@ -1623,7 +1710,8 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
), ),
SizedBox(height: 30), SizedBox(height: 30),
Container( Container(
margin: const EdgeInsets.only(right:300, left:300), margin: const EdgeInsets.only(
right: 300, left: 300),
child: Row( child: Row(
children: [ children: [
Expanded( Expanded(
...@@ -1632,8 +1720,7 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback { ...@@ -1632,8 +1720,7 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
subtitle: ' / proceed', subtitle: ' / proceed',
onPressed: () { onPressed: () {
setState(() { setState(() {
if (timer != null) if (timer != null) timer?.cancel();
timer?.cancel();
AwesomeDialog( AwesomeDialog(
context: context, context: context,
...@@ -1642,27 +1729,33 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback { ...@@ -1642,27 +1729,33 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
dismissOnTouchOutside: false, dismissOnTouchOutside: false,
autoHide: Duration(seconds: 2), autoHide: Duration(seconds: 2),
headerAnimationLoop: true, headerAnimationLoop: true,
title: 'Mohon Tunggu Sebentar ...', title:
titleTextStyle: blackTextStyle.copyWith( 'Mohon Tunggu Sebentar ...',
titleTextStyle:
blackTextStyle.copyWith(
fontSize: 20, fontSize: 20,
fontWeight: bold, fontWeight: bold,
), ),
desc: "Please wait a moment ...", desc: "Please wait a moment ...",
descTextStyle: greyTextStyle.copyWith( descTextStyle:
greyTextStyle.copyWith(
fontSize: 18, fontSize: 18,
fontWeight: light, fontWeight: light,
), ),
).show().then((value) { ).show().then((value) {
if(amountController!.text.isEmpty){ if (amountController!
.text.isEmpty) {
AwesomeDialog( AwesomeDialog(
context: context, context: context,
dialogType: DialogType.error, dialogType: DialogType.error,
animType: AnimType.rightSlide, animType: AnimType.rightSlide,
headerAnimationLoop: true, headerAnimationLoop: true,
title: 'Terjadi Kesalahan', title: 'Terjadi Kesalahan',
desc: "Anda belum mengisi saldo", desc:
"Anda belum mengisi saldo",
btnOkOnPress: () { btnOkOnPress: () {
if (timer != null) timer?.cancel(); if (timer != null)
timer?.cancel();
tapIdle(); tapIdle();
}, },
btnOkIcon: Icons.cancel, btnOkIcon: Icons.cancel,
...@@ -1695,17 +1788,22 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback { ...@@ -1695,17 +1788,22 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
children: [ children: [
ValueListenableBuilder( ValueListenableBuilder(
valueListenable: idleDuration, valueListenable: idleDuration,
builder: (context, value, child) => CircularProgressIndicator( builder: (context, value, child) =>
CircularProgressIndicator(
strokeWidth: 5, strokeWidth: 5,
value: (idleDuration.value.toDouble()) / _maxDuration, value: (idleDuration.value.toDouble()) /
valueColor: AlwaysStoppedAnimation<Color>(Colors.blue), _maxDuration,
valueColor:
AlwaysStoppedAnimation<Color>(
Colors.blue),
), ),
), ),
RotatedBox( RotatedBox(
quarterTurns: 4, quarterTurns: 4,
child: ValueListenableBuilder( child: ValueListenableBuilder(
valueListenable: idleDuration, valueListenable: idleDuration,
builder: (context, value, child) => Text( builder: (context, value, child) =>
Text(
value.toString(), value.toString(),
style: TextStyle(fontSize: 18), style: TextStyle(fontSize: 18),
), ),
...@@ -1717,7 +1815,6 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback { ...@@ -1717,7 +1815,6 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
], ],
), ),
), ),
), ),
), ),
), ),
...@@ -1728,7 +1825,7 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback { ...@@ -1728,7 +1825,7 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
}); });
} }
void _showQris(BuildContext context) { void _showQris(BuildContext context) async {
bool isProcessGet = false; bool isProcessGet = false;
bool isProcessCheck = false; bool isProcessCheck = false;
Future.delayed(Duration(seconds: 30), () { Future.delayed(Duration(seconds: 30), () {
...@@ -1741,7 +1838,7 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback { ...@@ -1741,7 +1838,7 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
}); });
} }
}); });
showDialog( await showDialog(
context: context, context: context,
builder: (context) { builder: (context) {
return StatefulBuilder(builder: (context, StateSetter setState) { return StatefulBuilder(builder: (context, StateSetter setState) {
...@@ -1760,7 +1857,7 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback { ...@@ -1760,7 +1857,7 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
const EdgeInsets.symmetric(horizontal: 150, vertical: 30), const EdgeInsets.symmetric(horizontal: 150, vertical: 30),
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.circular(28), borderRadius: BorderRadius.circular(28),
color:lightBackgroundColor, color: lightBackgroundColor,
), ),
child: Scaffold( child: Scaffold(
body: Column(children: [ body: Column(children: [
...@@ -1856,42 +1953,40 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback { ...@@ -1856,42 +1953,40 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
children: [ children: [
//button batalkan di showqris //button batalkan di showqris
TextButton( TextButton(
onPressed: () { onPressed: () async {
setState(() => isProcessCheck = true); setState(() => isProcessCheck = true);
_cekStatus().then((value) {
setState(() { try {
if (value) { bool value = await _cekStatus();
print("pembayaran berhasil dilakukan");
showPop(approvalCode); if (value) {
} else { print("pembayaran berhasil dilakukan");
AwesomeDialog( showPop(approvalCode);
context: context, } else {
dismissOnTouchOutside: false, await AwesomeDialog(
dialogType: DialogType.warning, context: context,
animType: AnimType.rightSlide, dismissOnTouchOutside: false,
headerAnimationLoop: true, dialogType: DialogType.warning,
title: autoHide: Duration(seconds: 3),
'Apakah anda yakin ingin membatalkan pembayaran ?', animType: AnimType.rightSlide,
desc: headerAnimationLoop: true,
"Are you sure you want to cancel the payment ?", title: 'Anda telah membatalkan transaksi',
btnOkOnPress: () { desc: "You have canceled the transaction",
Navigator.pop(context); ).show().then((value) {
setState(() { Navigator.of(context).pop();
timer?.cancel(); timer?.cancel();
dataQris = null; dataQris = null;
isShowingDialog = true; checkCountZero = false;
_showTap(); isShowingDialog = true;
tapDial(); _showTap();
}); tapDial();
// if (timer != null) timer?.cancel(); });
}, }
btnOkIcon: Icons.cancel, } catch (e) {
btnOkColor: Colors.red) // Handle any errors that occur during _cekStatus()
.show(); } finally {
} setState(() => isProcessCheck = false);
isProcessCheck = false; }
});
});
}, },
child: (isProcessCheck) child: (isProcessCheck)
? Column( ? Column(
...@@ -1899,22 +1994,16 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback { ...@@ -1899,22 +1994,16 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
Container( Container(
width: 250, width: 250,
height: 70, height: 70,
margin: const EdgeInsets.only( margin: const EdgeInsets.only(bottom: 10),
bottom: 10,
),
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.circular(20), borderRadius: BorderRadius.circular(20),
color: purpleColor, color: purpleColor,
boxShadow: [ boxShadow: [
BoxShadow( BoxShadow(
color: Colors.grey.withOpacity(0.3), color: Colors.grey.withOpacity(0.3),
//color of shadow
spreadRadius: 3, spreadRadius: 3,
//spread radius
blurRadius: 7, blurRadius: 7,
// blur radius offset: Offset(3, 3),
offset: Offset(3,
3), // changes position of shadow
), ),
], ],
), ),
...@@ -2050,91 +2139,106 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback { ...@@ -2050,91 +2139,106 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
), ),
child: Center( child: Center(
child: TweenAnimationBuilder<Duration>( child: TweenAnimationBuilder<Duration>(
duration: Duration(minutes: 5), duration: Duration(minutes: 5),
tween: Tween( tween: Tween(
begin: Duration(minutes: 5), begin: Duration(minutes: 5),
end: Duration.zero), end: Duration.zero),
onEnd: () { onEnd: () {
AwesomeDialog( AwesomeDialog(
context: context, context: context,
dialogType: DialogType.warning, dialogType: DialogType.warning,
dismissOnTouchOutside: false, dismissOnTouchOutside: false,
animType: AnimType.rightSlide, animType: AnimType.rightSlide,
headerAnimationLoop: true, headerAnimationLoop: true,
title: title:
'Waktu pembayaran anda sudah habis !', 'Waktu pembayaran anda sudah habis !',
desc: desc:
"Your payment time has expired !", "Your payment time has expired !",
btnOkOnPress: () async { btnOkOnPress: () async {
setState(() => isProcessCheck = true); setState(
try { () => isProcessCheck = true);
bool result = await _cekStatus(); try {
setState(() { bool result = await _cekStatus();
if (result) { setState(() {
print("pembayaran berhasil dilakukan"); if (result) {
Navigator.pop(context); print(
showPop(approvalCode); "pembayaran berhasil dilakukan");
} else { Navigator.pop(context);
setState(() => isProcessCheck = false); showPop(approvalCode);
AwesomeDialog( } else {
context: context, setState(() =>
dialogType: DialogType.error, isProcessCheck = false);
animType: AnimType.rightSlide, AwesomeDialog(
headerAnimationLoop: true, context: context,
title: 'Belum Terbayar , Silahkan Ulangi Kembali !', dialogType:
desc: "Not paid yet , please try again !", DialogType.error,
btnOkOnPress: () { animType: AnimType
Navigator.pop(context); .rightSlide,
setState(() { headerAnimationLoop:
timer?.cancel(); true,
dataQris = null; title:
isShowingDialog = true; 'Belum Terbayar , Silahkan Ulangi Kembali !',
_showTap(); desc:
tapDial(); "Not paid yet , please try again !",
}); btnOkOnPress: () {
}, Navigator.pop(
btnOkIcon: Icons.cancel, context);
btnOkColor: Colors.red) setState(() {
.show(); checkCountZero =
} false;
// isProcessCheck = false; timer?.cancel();
}); dataQris = null;
} catch (e) { isShowingDialog =
print("Error: $e"); true;
setState(() => isProcessCheck = false); _showTap();
} tapDial();
}, });
btnOkIcon: Icons.cancel, },
btnOkColor: Colors.red) btnOkIcon:
.show(); Icons.cancel,
}, btnOkColor:
builder: (BuildContext context, Colors.red)
Duration value, Widget? child) { .show();
String twoDigits(int n) => }
n.toString().padLeft(2, "0"); // isProcessCheck = false;
final minutes = twoDigits(value.inMinutes); });
final seconds = } catch (e) {
twoDigits(value.inSeconds % 60); print("Error: $e");
// todo for checking in 30 seconds lates setState(
if (minutes == '00' && () => isProcessCheck = false);
int.parse(seconds) == int.parse("30")) { }
if (!isHitApi) { },
isHitApi = true; btnOkIcon: Icons.cancel,
_cekStatus(isBackgroundServices: true); btnOkColor: Colors.red)
print("pembayaran berhasil dilakukan"); .show();
} },
builder: (BuildContext context, Duration value,
Widget? child) {
String twoDigits(int n) =>
n.toString().padLeft(2, "0");
final minutes = twoDigits(value.inMinutes);
final seconds =
twoDigits(value.inSeconds % 60);
// todo for checking in 30 seconds lates
if (minutes == '00' &&
int.parse(seconds) == int.parse("30")) {
if (!isHitApi) {
isHitApi = true;
_cekStatus(isBackgroundServices: true);
print("pembayaran berhasil dilakukan");
} }
}
return Padding(
padding: const EdgeInsets.symmetric( return Padding(
vertical: 5), padding: const EdgeInsets.symmetric(
child: Text('$minutes:$seconds', vertical: 5),
textAlign: TextAlign.center, child: Text('$minutes:$seconds',
style: TextStyle( textAlign: TextAlign.center,
color: Colors.black, style: TextStyle(
fontWeight: FontWeight.bold, color: Colors.black,
fontSize: 30))); fontWeight: FontWeight.bold,
}, fontSize: 30)));
},
), ),
), ),
), ),
...@@ -2170,28 +2274,33 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback { ...@@ -2170,28 +2274,33 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return WillPopScope( return WillPopScope(
child: Scaffold( child: Scaffold(
resizeToAvoidBottomInset: false,
backgroundColor: lightBackgroundColor, backgroundColor: lightBackgroundColor,
body: SingleChildScrollView( body: SingleChildScrollView(
scrollDirection: Axis.vertical, scrollDirection: Axis.vertical,
child: Column( child: Center(
mainAxisAlignment: MainAxisAlignment.center, child: Column(
crossAxisAlignment: CrossAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: [ crossAxisAlignment: CrossAxisAlignment.center,
ListView( children: [
shrinkWrap: true, ListView(
padding: const EdgeInsets.symmetric( shrinkWrap: true,
horizontal: 45, padding: const EdgeInsets.symmetric(
vertical: 8, horizontal: 45,
vertical: 1,
),
children: [
SizedBox(height: 30),
buildcardInfo(),
SizedBox(height: 40),
buildwalletCard(),
SizedBox(height: 20),
buildServices(context),
SizedBox(height: 20),
// buildFloat(),
],
), ),
children: [ ],
buildcardInfo(), ),
buildwalletCard(),
buildServices(context),
// buildFloat(),
],
),
],
), ),
), ),
), ),
...@@ -2212,28 +2321,38 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback { ...@@ -2212,28 +2321,38 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
width: 100, width: 100,
), ),
SizedBox( SizedBox(
width: 25, width: 31,
), ),
SizedBox( Column(
width: 1, children: [
), TimerBuilder.periodic(Duration(seconds: 1), builder: (context) {
TimerBuilder.periodic(Duration(seconds: 1), builder: (context) { // print("${getSystemTime()}");
// print("${getSystemTime()}"); return Row(
return Row( children: [
children: [ Text(
Text( "${getSystemTime()}",
"${getSystemTime()}", style: TextStyle(
style: TextStyle( color: darkBackgroundColor,
color: darkBackgroundColor, fontSize: 27,
fontSize: 27, fontWeight: bold,
fontWeight: bold, ),
), ),
],
);
}),
SizedBox(height: 2),
Text(
"${getDate()}",
style: TextStyle(
color: blackColor,
fontSize: 20,
fontWeight: semiBold,
), ),
], ),
); ],
}), ),
SizedBox( SizedBox(
width: 10, width: 31,
), ),
Image.asset( Image.asset(
"assets/wahoo.png", "assets/wahoo.png",
...@@ -2252,7 +2371,7 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback { ...@@ -2252,7 +2371,7 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
return Center( return Center(
child: Container( child: Container(
width: 1090, width: 1090,
height: 480, height: 500,
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.circular(28), borderRadius: BorderRadius.circular(28),
image: const DecorationImage( image: const DecorationImage(
...@@ -2430,6 +2549,29 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback { ...@@ -2430,6 +2549,29 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
fontStyle: FontStyle.italic, fontStyle: FontStyle.italic,
), ),
), ),
const SizedBox(
height: 25,
),
// Row(
// children: [
// TimerBuilder.periodic(Duration(seconds: 1), builder: (context) {
// // print("${getSystemTime()}");
// return Row(
// children: [
// Text(
// "${getDate()}",
// style: TextStyle(
// color: darkBackgroundColor,
// fontSize: 15,
// fontWeight: semiBold,
// ),
// ),
// ],
// );
// }),
// ],
// ),
], ],
), ),
), ),
...@@ -2439,78 +2581,80 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback { ...@@ -2439,78 +2581,80 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
//SECTION level //SECTION level
Widget buildServices(BuildContext context) { Widget buildServices(BuildContext context) {
return Container( return Container(
height: 80,
margin: const EdgeInsets.only( margin: const EdgeInsets.only(
top: 25, top: 25,
bottom: 25,
), ),
child: Stack( child: Stack(
children: [ children: [
// widget lainnya di sini // widget lainnya di sini
Positioned( // Positioned(
bottom: 20, // bottom: 20,
right: 0, // right: 0,
child: Stack( // child: Stack(
alignment: Alignment.center, // alignment: Alignment.center,
children: [ // children: [
ValueListenableBuilder( // ValueListenableBuilder(
valueListenable: idleDuration, // valueListenable: idleDuration,
builder: (context, value, child) => CircularProgressIndicator( // builder: (context, value, child) => CircularProgressIndicator(
strokeWidth: 5, // strokeWidth: 5,
value: (idleDuration.value.toDouble()) / _maxDuration, // value: (idleDuration.value.toDouble()) / _maxDuration,
valueColor: AlwaysStoppedAnimation<Color>(Colors.blue), // valueColor: AlwaysStoppedAnimation<Color>(Colors.blue),
), // ),
), // ),
RotatedBox( // RotatedBox(
quarterTurns: 4, // quarterTurns: 4,
child: ValueListenableBuilder( // child: ValueListenableBuilder(
valueListenable: idleDuration, // valueListenable: idleDuration,
builder: (context, value, child) => Text( // builder: (context, value, child) => Text(
value.toString(), // value.toString(),
style: TextStyle(fontSize: 18), // style: TextStyle(fontSize: 18),
), // ),
), // ),
), // ),
], // ],
), // ),
), // ),
Positioned( // Positioned(
bottom: 36, // bottom: 36,
left: 0, // left: 0,
child: Row( // child: Row(
children: [ // children: [
Container( // Container(
decoration: BoxDecoration( // decoration: BoxDecoration(
color: Colors.blue, // color: Colors.blue,
shape: BoxShape.circle, // shape: BoxShape.circle,
), // ),
width: 12, // width: 12,
height: 12, // height: 12,
), // ),
], // ],
), // ),
), // ),
Positioned( // Positioned(
bottom: 30, // bottom: 30,
left: 30, // left: 30,
child: Row( // child: Row(
children: [ // children: [
TimerBuilder.periodic(Duration(seconds: 1), builder: (context) { // TimerBuilder.periodic(Duration(seconds: 1), builder: (context) {
// print("${getSystemTime()}"); // // print("${getSystemTime()}");
return Row( // return Row(
children: [ // children: [
Text( // Text(
"${getDate()}", // "${getDate()}",
style: TextStyle( // style: TextStyle(
color: darkBackgroundColor, // color: darkBackgroundColor,
fontSize: 15, // fontSize: 15,
fontWeight: semiBold, // fontWeight: semiBold,
), // ),
), // ),
], // ],
); // );
}), // }),
], // ],
), // ),
), // ),
Column( Column(
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
children: [ children: [
...@@ -2565,19 +2709,43 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback { ...@@ -2565,19 +2709,43 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
// subtitle: " topup balance", // subtitle: " topup balance",
// ), // ),
// ), // ),
TextButton( Stack(
onPressed: () { alignment: Alignment.center,
timer?.cancel(); children: [
isShowingDialog = true; ValueListenableBuilder(
_showTap(); valueListenable: idleDuration,
tapDial(); builder: (context, value, child) => CircularProgressIndicator(
}, strokeWidth: 5,
child: const HomeServices( value: (idleDuration.value.toDouble()) / _maxDuration,
iconUrl: 'assets/ic_send.png', valueColor: AlwaysStoppedAnimation<Color>(Colors.blue),
title: 'Cek Saldo', ),
subtitle: ' balance', ),
), RotatedBox(
quarterTurns: 4,
child: ValueListenableBuilder(
valueListenable: idleDuration,
builder: (context, value, child) => Text(
value.toString(),
style: TextStyle(fontSize: 18),
),
),
),
],
), ),
// TextButton(
// onPressed: () {
// timer?.cancel();
// checkCountZero = false;
// isShowingDialog = true;
// _showTap();
// tapDial();
// },
// child: const HomeServices(
// iconUrl: 'assets/ic_send.png',
// title: 'Cek Saldo',
// subtitle: ' balance',
// ),
// ),
], ],
), ),
) )
......
...@@ -87,16 +87,16 @@ class _SplashPageState extends State<SplashPage> with TickerProviderStateMixin{ ...@@ -87,16 +87,16 @@ class _SplashPageState extends State<SplashPage> with TickerProviderStateMixin{
} }
if (storageStatus.isGranted && phoneStatus.isGranted) { if (storageStatus.isGranted && phoneStatus.isGranted) {
await initService(); // initService();
checkActivationAfterDelay(); checkActivationAfterDelay();
} else { } else {
// Handle the case when user declines the permission request // Handle the case when user declines the permission request
} }
} }
Future<void> initService() async { // Future<void> initService() async {
await StartService.initLibrary(); // await StartService.initLibrary();
} // }
void checkActivationAfterDelay() { void checkActivationAfterDelay() {
Future.delayed(Duration(seconds: 3), () { Future.delayed(Duration(seconds: 3), () {
......
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