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,7 +390,8 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback { ...@@ -384,7 +390,8 @@ 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()
.then((value) {
timer?.cancel(); timer?.cancel();
isShowingDialog = true; isShowingDialog = true;
_showTap(); _showTap();
...@@ -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(() {
...@@ -439,12 +446,19 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback { ...@@ -439,12 +446,19 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
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: () {
...@@ -690,8 +704,10 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback { ...@@ -690,8 +704,10 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
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);
Future.delayed(Duration(seconds: int.parse(idle)), () {
if (timer != null) timer?.cancel(); if (timer != null) timer?.cancel();
isShowingDialog = false; isShowingDialog = false;
tapIdle(); 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 { ...@@ -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();
} }
...@@ -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,11 +1397,14 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback { ...@@ -1353,11 +1397,14 @@ 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>[
...@@ -1368,8 +1415,8 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback { ...@@ -1368,8 +1415,8 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
fontWeight: bold, fontWeight: bold,
color: purpleColor, color: purpleColor,
), ),
keyboardType: keyboardType: TextInputType
TextInputType.numberWithOptions( .numberWithOptions(
signed: true, signed: true,
decimal: true), decimal: true),
controller: amountController, controller: amountController,
...@@ -1390,52 +1437,75 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback { ...@@ -1390,52 +1437,75 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
color: greyColor, color: greyColor,
), ),
), ),
onFieldSubmitted: (value){ onChanged: (value) {
if (timer != null)
timer?.cancel();
tapIdle();
},
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(
...@@ -1481,24 +1552,28 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback { ...@@ -1481,24 +1552,28 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
if (mounted) { if (mounted) {
setState(() { setState(() {
amountController!.text = cTopUp1; amountController!.text =
cTopUp1;
}); });
} }
}, },
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!.text ==
cTopUp1 cTopUp1
? purpleColor ? purpleColor
: Colors.black12), : Colors.black12),
borderRadius: BorderRadius.circular(7), borderRadius:
BorderRadius.circular(7),
), ),
child: Center( child: Center(
child: Text("50,000", child: Text("50,000",
style: blackTextStyle.copyWith( style:
blackTextStyle.copyWith(
fontSize: 25, fontSize: 25,
fontWeight: bold, fontWeight: bold,
)), )),
...@@ -1516,24 +1591,28 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback { ...@@ -1516,24 +1591,28 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
if (mounted) { if (mounted) {
setState(() { setState(() {
amountController!.text = cTopUp2; amountController!.text =
cTopUp2;
}); });
} }
}, },
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!.text ==
cTopUp2) cTopUp2)
? Color(0xff005DAC) ? Color(0xff005DAC)
: Colors.black12), : Colors.black12),
borderRadius: BorderRadius.circular(7), borderRadius:
BorderRadius.circular(7),
), ),
child: Center( child: Center(
child: Text("150,000", child: Text("150,000",
style: blackTextStyle.copyWith( style:
blackTextStyle.copyWith(
fontSize: 25, fontSize: 25,
fontWeight: bold, fontWeight: bold,
)), )),
...@@ -1555,24 +1634,28 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback { ...@@ -1555,24 +1634,28 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
if (mounted) { if (mounted) {
setState(() { setState(() {
amountController!.text = cTopUp3; amountController!.text =
cTopUp3;
}); });
} }
}, },
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!.text ==
cTopUp3) cTopUp3)
? Color(0xff005DAC) ? Color(0xff005DAC)
: Colors.black12), : Colors.black12),
borderRadius: BorderRadius.circular(7), borderRadius:
BorderRadius.circular(7),
), ),
child: Center( child: Center(
child: Text("100,000", child: Text("100,000",
style: blackTextStyle.copyWith( style:
blackTextStyle.copyWith(
fontSize: 25, fontSize: 25,
fontWeight: bold, fontWeight: bold,
)), )),
...@@ -1585,21 +1668,24 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback { ...@@ -1585,21 +1668,24 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
Expanded( Expanded(
child: GestureDetector( child: GestureDetector(
onTap: () { onTap: () {
if (timer != null) timer?.cancel(); if (timer != null)
timer?.cancel();
tapIdle(); tapIdle();
if (mounted) { if (mounted) {
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!
.text ==
cTopUp4) cTopUp4)
? Color(0xff005DAC) ? Color(0xff005DAC)
: Colors.black12), : Colors.black12),
...@@ -1608,7 +1694,8 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback { ...@@ -1608,7 +1694,8 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
), ),
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 {
bool value = await _cekStatus();
if (value) { if (value) {
print("pembayaran berhasil dilakukan"); print("pembayaran berhasil dilakukan");
showPop(approvalCode); showPop(approvalCode);
} else { } else {
AwesomeDialog( await AwesomeDialog(
context: context, context: context,
dismissOnTouchOutside: false, dismissOnTouchOutside: false,
dialogType: DialogType.warning, dialogType: DialogType.warning,
autoHide: Duration(seconds: 3),
animType: AnimType.rightSlide, animType: AnimType.rightSlide,
headerAnimationLoop: true, headerAnimationLoop: true,
title: title: 'Anda telah membatalkan transaksi',
'Apakah anda yakin ingin membatalkan pembayaran ?', desc: "You have canceled the transaction",
desc: ).show().then((value) {
"Are you sure you want to cancel the payment ?", Navigator.of(context).pop();
btnOkOnPress: () {
Navigator.pop(context);
setState(() {
timer?.cancel(); timer?.cancel();
dataQris = null; dataQris = null;
checkCountZero = false;
isShowingDialog = true; isShowingDialog = true;
_showTap(); _showTap();
tapDial(); tapDial();
}); });
// if (timer != null) timer?.cancel();
},
btnOkIcon: Icons.cancel,
btnOkColor: Colors.red)
.show();
} }
isProcessCheck = false; } catch (e) {
}); // Handle any errors that occur during _cekStatus()
}); } finally {
setState(() => 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
), ),
], ],
), ),
...@@ -2066,50 +2155,65 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback { ...@@ -2066,50 +2155,65 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
desc: desc:
"Your payment time has expired !", "Your payment time has expired !",
btnOkOnPress: () async { btnOkOnPress: () async {
setState(() => isProcessCheck = true); setState(
() => isProcessCheck = true);
try { try {
bool result = await _cekStatus(); bool result = await _cekStatus();
setState(() { setState(() {
if (result) { if (result) {
print("pembayaran berhasil dilakukan"); print(
"pembayaran berhasil dilakukan");
Navigator.pop(context); Navigator.pop(context);
showPop(approvalCode); showPop(approvalCode);
} else { } else {
setState(() => isProcessCheck = false); setState(() =>
isProcessCheck = false);
AwesomeDialog( AwesomeDialog(
context: context, context: context,
dialogType: DialogType.error, dialogType:
animType: AnimType.rightSlide, DialogType.error,
headerAnimationLoop: true, animType: AnimType
title: 'Belum Terbayar , Silahkan Ulangi Kembali !', .rightSlide,
desc: "Not paid yet , please try again !", headerAnimationLoop:
true,
title:
'Belum Terbayar , Silahkan Ulangi Kembali !',
desc:
"Not paid yet , please try again !",
btnOkOnPress: () { btnOkOnPress: () {
Navigator.pop(context); Navigator.pop(
context);
setState(() { setState(() {
checkCountZero =
false;
timer?.cancel(); timer?.cancel();
dataQris = null; dataQris = null;
isShowingDialog = true; isShowingDialog =
true;
_showTap(); _showTap();
tapDial(); tapDial();
}); });
}, },
btnOkIcon: Icons.cancel, btnOkIcon:
btnOkColor: Colors.red) Icons.cancel,
btnOkColor:
Colors.red)
.show(); .show();
} }
// isProcessCheck = false; // isProcessCheck = false;
}); });
} catch (e) { } catch (e) {
print("Error: $e"); print("Error: $e");
setState(() => isProcessCheck = false); setState(
() => isProcessCheck = false);
} }
}, },
btnOkIcon: Icons.cancel, btnOkIcon: Icons.cancel,
btnOkColor: Colors.red) btnOkColor: Colors.red)
.show(); .show();
}, },
builder: (BuildContext context, builder: (BuildContext context, Duration value,
Duration value, Widget? child) { Widget? child) {
String twoDigits(int n) => String twoDigits(int n) =>
n.toString().padLeft(2, "0"); n.toString().padLeft(2, "0");
final minutes = twoDigits(value.inMinutes); final minutes = twoDigits(value.inMinutes);
...@@ -2170,10 +2274,10 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback { ...@@ -2170,10 +2274,10 @@ 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: Center(
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
...@@ -2182,12 +2286,16 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback { ...@@ -2182,12 +2286,16 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
shrinkWrap: true, shrinkWrap: true,
padding: const EdgeInsets.symmetric( padding: const EdgeInsets.symmetric(
horizontal: 45, horizontal: 45,
vertical: 8, vertical: 1,
), ),
children: [ children: [
SizedBox(height: 30),
buildcardInfo(), buildcardInfo(),
SizedBox(height: 40),
buildwalletCard(), buildwalletCard(),
SizedBox(height: 20),
buildServices(context), buildServices(context),
SizedBox(height: 20),
// buildFloat(), // buildFloat(),
], ],
), ),
...@@ -2195,6 +2303,7 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback { ...@@ -2195,6 +2303,7 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
), ),
), ),
), ),
),
onWillPop: onWillPop); onWillPop: onWillPop);
} }
...@@ -2212,11 +2321,10 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback { ...@@ -2212,11 +2321,10 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
width: 100, width: 100,
), ),
SizedBox( SizedBox(
width: 25, width: 31,
),
SizedBox(
width: 1,
), ),
Column(
children: [
TimerBuilder.periodic(Duration(seconds: 1), builder: (context) { TimerBuilder.periodic(Duration(seconds: 1), builder: (context) {
// print("${getSystemTime()}"); // print("${getSystemTime()}");
return Row( return Row(
...@@ -2232,8 +2340,19 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback { ...@@ -2232,8 +2340,19 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
], ],
); );
}), }),
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