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